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
MiyataAKiyoshi
October 11, 2017
Technology
0
680
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
37
CloudGarageRenewal2018.02
miyataakiyoshi
0
360
CloudGarageConcrete5TokyoMeetup#12
miyataakiyoshi
0
86
CloudGarageRancherMeetupFukuoka#2
miyataakiyoshi
0
500
CloudGarageRancherMeetupTokyo#9
miyataakiyoshi
0
370
CloudGarageServiceOutline
miyataakiyoshi
0
1.3k
Other Decks in Technology
See All in Technology
LangSmith×Webhook連携で実現するプロンプトドリブンCI/CD
sergicalsix
1
230
無意味な開発生産性の議論から抜け出すための予兆検知とお金とAI
i35_267
4
13k
CRE Camp #1 エンジニアリングを民主化するCREチームでありたい話
mntsq
1
130
生成AI開発案件におけるClineの業務活用事例とTips
shinya337
0
260
SEQUENCE object comparison - db tech showcase 2025 LT2
nori_shinoda
0
140
OSSのSNSツール「Misskey」をさわってみよう(右下ワイプで私のOSCの20年を振り返ります) / 20250705-osc2025-do
akkiesoft
0
170
タイミーのデータモデリング事例と今後のチャレンジ
ttccddtoki
6
2.4k
IPA&AWSダブル全冠が明かす、人生を変えた勉強法のすべて
iwamot
PRO
2
140
Sansanのデータプロダクトマネジメントのアプローチ
sansantech
PRO
0
160
United Airlines Customer Service– Call 1-833-341-3142 Now!
airhelp
0
170
成長し続けるアプリのためのテストと設計の関係、そして意思決定の記録。
sansantech
PRO
0
120
20250705 Headlamp: 專注可擴展性的 Kubernetes 用戶界面
pichuang
0
270
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Documentation Writing (for coders)
carmenintech
72
4.9k
Typedesign – Prime Four
hannesfritz
42
2.7k
Building Adaptive Systems
keathley
43
2.7k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
820
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
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