#rancher-agentを構築しよう
関連記事
rancher-agentとなるサーバーにも同様にrancherOSをインストールしておく
rancher-agentをrun
- 以下はrancher-serverの管理画面で操作する
- 管理画面のADMINタブ -> SETTING
-
Host Registration URL -> something else
http://{rancher-serverのprivateIP}:8080
-
![Screen Shot 2016-06-07 at 10.19.05.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F62822%2F7e71d579-8096-ae28-37cc-e076d8e29d4b.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=1a4cb1f1b3e654065300f9e5b09cee54)
- INFRASTRUCTURE -> HOSTS -> Add Host
-
type
custom
-
5 Copy, paste, and run the command below to register the host with Rancher:
言われたとうりコピーする それぞれrancher-agentに貼り付けてコマンドを実行する
-
5 Click close below. The new host should pop up on the Hosts screen within a minute.
INFRASTRUCTURE -> HOSTS しばらく眺めてたらhostの画面が現れる! editから名前を変更しておく"agent01""agent02"とか
-
![Screen Shot 2016-06-07 at 10.18.18.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F62822%2F3fe3efe2-336e-1406-3edc-12ff0429adf7.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=985605113870b593042ac1c558b2e305)
![Screen Shot 2016-06-07 at 10.20.33.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F62822%2F3518d167-5866-85c1-2495-606e3c53fa93.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=21f83dfec83e796174a13104610b6202)
一通り完了
サービスが展開できる用意が整った
-
rancher/server
-
rancher/agent
-
haproxy
-
CATALOG でぽちぽちやると適当なサービスを運用することができる
試しにwordpressを動かしてみる
![Screen Shot 2016-06-07 at 10.26.44.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F62822%2F748c51de-e1c7-ee6a-c430-6f871fdc45ce.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=e312a91844efee58e2915a20f6809543)
![Screen Shot 2016-06-07 at 10.27.38.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F62822%2Fbcac1b0e-28a9-c28d-c104-e0afb8938c5b.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=09fd8d044038980db887930d0ee617a9)
- Launchを押すとコンテナが作られて、wpを見れるようになる!!
##今後の課題
- コンテナが消えるとデータも消える -> NFSをつくってmysqlのデータを永続化
- ポートが重なるとコンテナが上がらなくなる -> ロードバランサをつくってurlで分ける
- ローカルで開発したdocker imageを本番環境でデプロイ -> registryを使ってみよう