This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # dockerホスト作成 | |
| $ docker-machine create -d sakuracloud \ | |
| --sakuracloud-access-token=[ACCESS TOKEN] \ | |
| --sakuracloud-access-token-secret=[ACCESS TOKEN SECRET] \ | |
| sakura-pages | |
| # dockerコマンドから作成したdockerホストを使う | |
| $ eval $(docker-machine env sakura-pages) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' | |
| services: | |
| gollum: | |
| build: . | |
| ports: | |
| - "80:80" | |
| volumes: | |
| - $PWD:/wiki | |
| command: ["gollum", "--port", "80" , "--allow-uploads" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ① さくらのAPI経由でCPU負荷を取得、判定 | |
| ② DockerMachineでさくらのクラウド上にマシンを作成 | |
| マシン作成と同時にGSLBヘの登録、Dockerコンテナの起動が行われます。 | |
| ③ GSLBが死活監視で追加されたサーバでのサービス起動を確認します。 | |
| 確認ができたら新サーバのIPをDNS応答するようになります。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ローカルdockerへの接続 | |
| docker -H unix:///var/run/docker.sock 〜 | |
| # TCP経由の場合 | |
| docker -H tcp://192.168.0.11:2376 〜 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:latest | |
| RUN mkdir /bot && cd /bot | |
| WORKDIR /bot | |
| COPY ./sacloud-bot /bot | |
| RUN npm install | |
| ENTRYPOINT ["node","bot.js"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // APIクライアント作成 | |
| api := API.NewClient(params.token, params.secret, params.zone) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #************************************************************************************** | |
| # TerraForm for さくらのクラウド | |
| #************************************************************************************** | |
| # tfファイルのサンプルです。 | |
| # 以下に記載のtfファイル + SSH鍵を用意しておき、 | |
| # `terraform apply`すると以下の内容でさくらのクラウド上にプロビジョニングが行われます。 | |
| # | |
| # 1) 手元のSSH公開鍵をアップロード | |
| # 2) ディスク作成(Ubuntu 14.04をソースアーカイブとしたもの) | |
| # 3) サーバー作成(パスワード認証無効化状態) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #GSLBのFQDNをtest.example.comのCNAMEとして登録 | |
| value = "${sakuracloud_gslb.mygslb.FQDN}." #注:末尾にピリオドつける | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 確認 | |
| terraform plan | |
| # 実行 | |
| terraform apply | |
| # 作ったマシンのグローバルIP確認(2台分表示される) | |
| terraform show | grep "shared_nw_address" | |
| # 作ったマシンへのSSH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ssh root@[確認したグローバルIP] | |
| # パスワードはsakura.tfで指定したものを入力 | |