Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CloudGarageRancherMeetupTokyo#10
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
MiyataAKiyoshi
October 11, 2017
Technology
0
690
CloudGarageRancherMeetupTokyo#10
Deploying Docker Container Images to CloudGarage
MiyataAKiyoshi
October 11, 2017
Tweet
Share
More Decks by MiyataAKiyoshi
See All by MiyataAKiyoshi
2018.10#ssmjp-CloudGarageDevAssistProgram
miyataakiyoshi
0
41
CloudGarageRenewal2018.02
miyataakiyoshi
0
370
CloudGarageConcrete5TokyoMeetup#12
miyataakiyoshi
0
88
CloudGarageRancherMeetupFukuoka#2
miyataakiyoshi
0
500
CloudGarageRancherMeetupTokyo#9
miyataakiyoshi
0
380
CloudGarageServiceOutline
miyataakiyoshi
0
1.3k
Other Decks in Technology
See All in Technology
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.6k
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
220
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
1.6k
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
650
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
1k
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
2
3k
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
280
pool.ntp.orgに ⾃宅サーバーで 参加してみたら...
tanyorg
0
140
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
380
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
93k
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
140
22nd ACRi Webinar - NTT Kawahara-san's slide
nao_sumikawa
0
100
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
What's in a price? How to price your products and services
michaelherold
247
13k
Utilizing Notion as your number one productivity tool
mfonobong
3
220
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
250
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
A Soul's Torment
seathinner
5
2.3k
Optimizing for Happiness
mojombo
379
71k
Building an army of robots
kneath
306
46k
Between Models and Reality
mayunak
1
190
Navigating Weather and Climate Data
rabernat
0
110
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
63
Transcript
Copyright © NHN Techorus Corp. NHNテコラス株式会社 クラウドサービス開発室 宮田 晃佳 Dockerコンテナイメージの
クラウド環境へのデプロイ Service Site Facebook Twitter https://cloudgarage.jp @CloudGarage.PR @CloudGarage_PR
Page 2 Instance-01 Instance-02 Instance-03 Replication 前提 DB (Rancher-Server) DB
(Rancher-Server) DB (Rancher-Server) Docker-container RANCHER-Server Docker-container RANCHER-Server Docker-container RANCHER-Server 複数のサーバーインスタンスの環境に、牧場を持っている牧場主
Page 3 Instance-01 Instance-02 Instance-03 Replication 最終ゴール DB (Rancher-Server) DB
(Rancher-Server) DB (Rancher-Server) Docker-container RANCHER-Server Docker-container RANCHER-Server Docker-container RANCHER-Server 第3牧場で「たぬき」を飼う 実行環境
Page 4 サーバーインスタンス Service Site Facebook Twitter https://cloudgarage.jp @CloudGarage.PR @CloudGarage_PR
Page 5 hashtag #CloudGarage 事前準備(1) GitLab用のドメインを取得 GitLab用ドメインで2種類のAレコードを設定・取得 CloudGarageの接続許可ポート設定 http 80
ssh 3000 Terminalログインが22ポートを 利用中のため、3000ポートで代用 ・GitLab Server ・GitLab Container Registry Instahce01 Instance02 Instance03
Page 6 事前準備(2) 牧場3のインスタンスでGitLab Container Registry用の設定を追加 Docker Registryは通常https通信で利用 http通信を行うためには、各インスタンスのDockerのサービス設定を変更 Ubuntuの変更方法は以下
(A)インスタンスにログイン ssh root@(各インスタンスのグローバルIPアドレス) (B)docker サービスを編集 (C)Docker サービスを再起動 # vi /etc/systemd/system/multi-user.target.wants/docker.service ExecStart=/usr/bin/dockerd -H fd:// ↓ ↓ ↓ ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry [ドメイン名] # systemctl daemon-reload # systemctl restart docker Instahce01 Instance02 Instance03
Page 7 hashtag #CloudGarage GitLabの起動
Page 8 hashtag #CloudGarage GitLab インストール(1) Rancherにログインし、GitLabインストール Rancherにログインし、[インフラストラクチャ]->[ホスト]の順にクリック サーバーインスタンス(今回は牧場03)の[編集]ボタンをクリック ラベルを追加して[保存]をクリック
キー:server_group 値 :gitlab Instahce01 Instance02 Instance03
Page 9 hashtag #CloudGarage GitLab インストール(2) メニューバーより[スタック]->[スタックを追加]ボタンをクリック 名前を入力し、[作成]ボタンをクリック 名前:Gitlab Instahce01
Instance02 Instance03
Page 10 hashtag #CloudGarage GitLab インストール(3) 作成したGitlabをクリックして、[サービス追加]ボタンをクリック Instahce01 Instance02 Instance03
Page 11 hashtag #CloudGarage GitLab インストール(4) [サービスを追加]の設定 名前 :Server イメージ名を選択:gitlab/gitlab-ce:latest
ポートマップ : パブリックホストポート プライベートコンテナポート 80 80 3000 22 Instahce01 Instance02 Instance03
Page 12 hashtag #CloudGarage GitLab インストール(5) [サービスを追加][コマンド]タブの設定 GITLAB_OMNIBUS_CONFIG external_url 'http://gitlab.xxxxxxxxxx.jp'
registry_external_url 'http://register. xxxxxxxxxx.jp' gitlab_rails['gitlab_shell_ssh_port'] = 3000 Instahce01 Instance02 Instance03
Page 13 hashtag #CloudGarage GitLab インストール(6) [サービスを追加][ボリューム]タブの設定 /srv/gitlab/config:/etc/gitlab /srv/gitlab/logs:/var/log/gitlab /srv/gitlab/data:/var/opt/gitlab
[サービスを追加][スケジューリング]タブの設定 条件 :must フィールド:ホストラベル キー :server_group 値 :gitlab Instahce01 Instance02 Instance03
Page 14 hashtag #CloudGarage GitLab インストール(7) GitLabの起動を確認 http://gitlab.xxxxxxxxxx.jp/ Instahce01 Instance02
Instance03
Page 15 hashtag #CloudGarage GitLab:Container Registry
Page 16 hashtag #CloudGarage GitLabの設定(1) 初期パスワードを登録しログイン後、プロジェクトの作成 [+]ボタンをクリック [New Project]を選択 Instahce01
Instance02 Instance03
Page 17 hashtag #CloudGarage GitLabの設定(2) プロジェクトの作成 Project name:test Instahce01 Instance02
Instance03
Page 18 hashtag #CloudGarage GitLabの設定(3) プロジェクト作成完了 [Registry]をクリックし作成できていることを確認 右ペインに表示される内容でDockerイメージをpushできます docker login時にアカウントとパスワードが必要なので忘れずに
Instahce01 Instance02 Instance03
Page 19 hashtag #CloudGarage Rancherの設定(1) Rancherのレジストリに追加 [インフラストラクチャ]->[レジストリ]を選択し[レジストリを追加]ボタンをクリック Instahce01 Instance02 Instance03
Page 20 hashtag #CloudGarage Rancherの設定(2) CUSTOMレジストリを追加 アドレス :GitLab Containter Registry用のURL
ユーザー :GitLabのアカウント パスワード:GitLabのパスワード Instahce01 Instance02 Instance03
Page 21 hashtag #CloudGarage 利用例)WordPress
Page 22 hashtag #CloudGarage 操作コマンドの確認 GitLab Container Registry [コピー]ボタンをクリックすると、RegistryのURLをコピー register.xxxxxxxxxx.jp/root/test
右ペインのコマンドで、 Build/pushなどができます Instahce01 Instance02 Instance03
Page 23 hashtag #CloudGarage Instahce01 Instance02 Instance03 牧場1にアクセスし、WordPressのコンテナイメージ取得 $ docker
image pull wordpress $ docker image pull mysql:5.7 WordPressのコンテナイメージをGitLabにpullする $ docker login register.xxxxxxxxxxxxxxxxxxx.jp Username: [設定したユーザ名] Password: [設定したパスワード] Login Succeeded $ docker image tag wordpress register.xxxxxxxxxxxxxxxxxxx.jp/root/wordpress $ docker image tag mysql:5.7 register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql $ docker push register.xxxxxxxxxxxxxxxxxxx.jp/root/wordpress $ docker push register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql WordPress:コンテナイメージの配置 これまでの説明と同様に、WordPress用のRegistryを登録 Instahce01 Instance02 Instance03 「WordPress」と「MySQL」の2つを準備(後で利用します!) register.xxxxxxxxxxxxxxxxxxx.jp/root/wordpress register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql
Page 24 hashtag #CloudGarage WordPress:Rancherでの管理準備 Rancherにログインし、実行環境にラベル追加 Rancherにログインし、[インフラストラクチャ]->[ホスト]の順にクリック サーバーインスタンス(牧場1)の編集ボタンをクリック ラベルを追加して[保存]をクリック(今回は牧場2も忘れずに) キー:server_group
値 :wordpress Instahce01 Instance02 Instance03
Page 25 hashtag #CloudGarage WordPress:Rancherでの管理準備 メニューバーより[スタック]->[スタックを追加]ボタンをクリック 名前を入力し、[作成]ボタンをクリック 名前:WordPress Instahce01 Instance02
Instance03
Page 26 hashtag #CloudGarage WordPress:Rancherにコンテナイメージ登録 作成したWordPressをクリックして、[サービス追加]ボタンをクリック Instahce01 Instance02 Instance03 [サービスを追加]の設定
- MySQL 名前 :MySQL1 イメージ名を選択:GitLabにPullしたイメージ register.xxxxxxxxxxxxxxxxxxx.jp/root/mysql
Page 27 hashtag #CloudGarage [コマンド]タブの設定 - MySQL WordPress:Rancherにコンテナイメージ登録 条件 :must
フィールド:ホストラベル キー :server_group 値 :wordpress Instahce01 Instance02 Instance03 [スケジューリング]タブの設定 - MySQL 変数:MYSQL_ROOT_PASSWORD 値 :mysql
Page 28 hashtag #CloudGarage WordPress:Rancherにコンテナイメージ登録 [サービスを追加]の設定 - WordPress 名前 :WordPress1
イメージ名を選択:GitLabにPullしたイメージ register.xxxxx.jp/root/wordpress ポートマップ :80 > 80 サービスリンク :MySQL1 > mysql Instahce01 Instance02 Instance03
Page 29 hashtag #CloudGarage WordPress:Rancherにコンテナイメージ登録 変数:WORDPRESS_DB_PASSWORD 値 :mysql [コマンド]タブの設定 -
WordPress [スケジューリング]タブの設定 - WordPress 条件 :must フィールド:ホストラベル キー :server_group 値 :wordpress
Page 30 hashtag #CloudGarage WordPress:コンテナクローン MySQL1のクローン作成 名前:MySQL2 Instahce01 Instance02 Instance03
Page 31 hashtag #CloudGarage WordPress:コンテナクローン WordPress1のクローン作成 名前 :WordPress サービスリンク :MySQL2
> mysql Instahce01 Instance02 Instance03
Page 32 hashtag #CloudGarage WordPress:コンテナクローン WordPress1のクローン作成
Page 33 Instance-01 Instance-02 Instance-03 Replication 最終ゴール DB (Rancher-Server) DB
(Rancher-Server) DB (Rancher-Server) Docker-container RANCHER-Server Docker-container RANCHER-Server Docker-container RANCHER-Server 第3牧場で「たぬき」を飼う
Service Site Facebook Twitter hashtag https://cloudgarage.jp @CloudGarage.PR @CloudGarage_PR #CloudGarage