Shipyard 開発環境構築(1)

Docker WebUI の Shipyard がとてもいいです。
https://github.com/shipyard/shipyard

完璧かといったらそうではない。
やりたいことに少し手の届かないところもあります。

せっかくだからちょっと中身を見てみようかなと。
取り合えずCentOS7 を使って開発環境の構築にチャレンジしてみました。
上記サイトの環境構築手順に沿って構築開始。

まずは、以下サイトを参考にNodejs をインストールします。
http://qiita.com/daskepon/items/16a77868d38f8e585840

# yum -y install epel-release
# yum -y update
# yum -y install nodejs npm

問題なくはいったので、次はGo を入れてみます。

# yum -y install golang

よし。問題なし。
ここから Shipyard の README 通りに環境を作ってみます。

# mkdir test-work
# cd test-work
# go get github.com/tools/godep
   package github.com/tools/godep: cannot download, $GOPATH not set. For more details see: go help gopath

ん? エラーになりました。
gopathってやつが環境変数に登録されてないと無いと駄目みたいです。
少し調べてみると、どこでもいいからGo言語用のフォルダを一個作る必要があるようです。


よし。やってみよう。

# vi .bash_profile

   export=~/go_home

# source .bash_profile
# echo $GOHOME
   /root/go_home

#go get github.com/tools/godep
    go: missing Git command. See http://golang.org/s/gogetcmd
    package github.com/tools/godep: exec: "git": executable file not found in $PATH

おっと、今度は gitが無いと。
Git をインストール。再度実行します。

# yum -y install git
#go get github.com/tools/godep
# ll go_home/
合計 0
drwxr-xr-x. 2 root root 18  2月 17 16:20 bin
drwxr-xr-x. 3 root root 24  2月 17 16:20 pkg
drwxr-xr-x. 4 root root 40  2月 17 16:20 src

なんだか前に進んだようです。
次はcontrollフォルダに移動してなんかやれっていますが
contorollフォルダってどこだよ。。。あ、srcの中なのか。

# make test-work
# cd test-work/
# git clone https://github.com/shipyard/shipyard.git
 Cloning into 'shipyard'...
 remote: Counting objects: 7331, done.
 remote: Total 7331 (delta 0), reused 0 (delta 0)
 Receiving objects: 100% (7331/7331), 14.34 MiB | 2.67 MiB/s, done.
 Resolving deltas: 100% (4003/4003), done.

# ls
 shipyard

# cd controller
# make deps
 make: godep: コマンドが見つかりませんでした
 make: *** [deps] エラー 127

ん?これ最初の手順で成功したはずなんだけどな。。。
あ、GOPATH も パス通さなきゃダメなのか。

# vi ~/.bash_profile

  export GOPATH=~/go_home

  PATH=$PATH:$HOME/bin:$GOPATH/bin
  export PATH

# source ~/.bash_profile

パス通したので再度実行。

# cd controller
# make deps
 go: missing Mercurial command. See http://golang.org/s/gogetcmd
 package code.google.com/p/go.crypto/bcrypt: exec: "hg": executable file not found in $PATH
 godep: restore: exit status 1
 go: missing Mercurial command. See http://golang.org/s/gogetcmd
 package code.google.com/p/goprotobuf/proto: exec: "hg": executable file not found in $PATH
 godep: restore: exit status 1
 go: missing Mercurial command. See http://golang.org/s/gogetcmd
 package code.google.com/p/goprotobuf/proto: exec: "hg": executable file not found in $PATH
 godep: restore: exit status 1
 make: *** [deps] エラー 1

今度は Mercurial が無いと。
しょうがないなぁ

# yum -y install *mercurial*
# make deps
# ll
合計 48
-rw-r--r--. 1 root root   105  2月 17 16:25 Dockerfile
drwxr-xr-x. 2 root root    37  2月 17 16:25 Godeps
-rw-r--r--. 1 root root   515  2月 17 16:25 Makefile
-rw-r--r--. 1 root root   306  2月 17 16:25 fig.yml
-rw-r--r--. 1 root root 25372  2月 17 16:25 main.go
drwxr-xr-x. 2 root root    77  2月 17 16:25 manager
drwxr-xr-x. 4 root root    30  2月 17 16:25 middleware
-rw-r--r--. 1 root root   354  2月 17 16:25 readme.md
drwxr-xr-x. 7 root root  4096  2月 17 16:25 static

※static フォルダができる

うまくいったようなので次の手順へ。

# npm install -g bower
# cd static/
# bower install
bower ESUDO         Cannot be run with sudo

Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.

http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814

You can however run a command with sudo using --allow-root option

rootで作業すると駄目なのか。
オプションつけろと言われた気がするのでつけてみる。

# cd static/
# bower install --allow-root

成功したっポイ。
次の手順へ。

# cd controller
# make build

 main.go:18:2: cannot find package "github.com/shipyard/shipyard" in any of:
        /usr/lib/golang/src/pkg/github.com/shipyard/shipyard (from $GOROOT)
        /root/test-work/shipyard/controller/Godeps/_workspace/src/github.com/shipyard/shipyard (from $GOPATH)
        /root/go_home/src/github.com/shipyard/shipyard
 main.go:19:2: cannot find package "github.com/shipyard/shipyard/controller/manager" in any of:
        /usr/lib/golang/src/pkg/github.com/shipyard/shipyard/controller/manager (from $GOROOT)
        /root/test-work/shipyard/controller/Godeps/_workspace/src/github.com/shipyard/shipyard/controller/manager (from $GOPATH)
        /root/go_home/src/github.com/shipyard/shipyard/controller/manager
 main.go:20:2: cannot find package "github.com/shipyard/shipyard/controller/middleware/access" in any of:
        /usr/lib/golang/src/pkg/github.com/shipyard/shipyard/controller/middleware/access (from $GOROOT)
        /root/test-work/shipyard/controller/Godeps/_workspace/src/github.com/shipyard/shipyard/controller/middleware/access (from $GOPATH)
        /root/go_home/src/github.com/shipyard/shipyard/controller/middleware/access
 main.go:21:2: cannot find package "github.com/shipyard/shipyard/controller/middleware/auth" in any of:
        /usr/lib/golang/src/pkg/github.com/shipyard/shipyard/controller/middleware/auth (from $GOROOT)
        /root/test-work/shipyard/controller/Godeps/_workspace/src/github.com/shipyard/shipyard/controller/middleware/auth (from $GOPATH)
        /root/go_home/src/github.com/shipyard/shipyard/controller/middleware/auth
 main.go:22:2: cannot find package "github.com/shipyard/shipyard/dockerhub" in any of:
        /usr/lib/golang/src/pkg/github.com/shipyard/shipyard/dockerhub (from $GOROOT)
        /root/test-work/shipyard/controller/Godeps/_workspace/src/github.com/shipyard/shipyard/dockerhub (from $GOPATH)
        /root/go_home/src/github.com/shipyard/shipyard/dockerhub
 godep: go exit status 1
 make: *** [build] エラー 1

ん?これ shipyard が無いっていってるよう。
多分こうかな?

# go get github.com/shipyard/shipyard
# make build

 # _/root/test-work/shipyard/controller
 /usr/bin/ld: -lpthread が見つかりません
 /usr/bin/ld: -lc が見つかりません
 collect2: エラー: ld はステータス 1 で終了しました
 /usr/lib/golang/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful  exit status 0x100
 godep: go exit status 2
 make: *** [build] エラー 1

まだまだエラーはなくならないようですw

※つづく?