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
43
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
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
アーキテクチャモダナイゼーションを実現する組織
satohjohn
1
1.1k
GCASアップデート(202601-202603)
techniczna
0
240
OpenClaw を Amazon Lightsail で動かす理由
uechishingo
0
240
プラットフォームエンジニアリングはAI時代の開発者をどう救うのか
jacopen
8
4.1k
Mitigating geopolitical risks with local-first software and atproto
ept
0
130
頼れる Agentic AI を支える Datadog のオブザーバビリティ / Powering Reliable Agentic AI with Datadog Observability
aoto
PRO
0
240
身体を持ったパーソナルAIエージェントの 可能性を探る開発
yokomachi
1
130
Cortex Code CLI と一緒に進めるAgentic Data Engineering
__allllllllez__
0
510
コンテキスト・ハーネスエンジニアリングの現在
hirosatogamo
PRO
6
620
新規事業×QAの挑戦:不確実性を乗りこなす!フェーズごとに求められるQAの役割変革
hacomono
PRO
0
130
PMとしての意思決定とAI活用状況について
lycorptech_jp
PRO
0
150
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
85
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
BBQ
matthewcrist
89
10k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Unsuck your backbone
ammeep
672
58k
Ethics towards AI in product and experience design
skipperchong
2
230
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
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