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
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
50
20k
United Airlines Customer Service– Call 1-833-341-3142 Now!
airhelp
0
170
AI時代の開発生産性を加速させるアーキテクチャ設計
plaidtech
PRO
3
160
fukabori.fm 出張版: 売上高617億円と高稼働率を陰で支えた社内ツール開発のあれこれ話 / 20250704 Yoshimasa Iwase & Tomoo Morikawa
shift_evolve
PRO
2
7.8k
生まれ変わった AWS Security Hub (Preview) を紹介 #reInforce_osaka / reInforce New Security Hub
masahirokawahara
0
480
面倒な作業はAIにおまかせ。Flutter開発をスマートに効率化
ruideengineer
0
260
MobileActOsaka_250704.pdf
akaitadaaki
0
130
Beyond Kaniko: Navigating Unprivileged Container Image Creation
f30
0
130
スタートアップに選択肢を 〜生成AIを活用したセカンダリー事業への挑戦〜
nstock
0
210
品質と速度の両立:生成AI時代の品質保証アプローチ
odasho
1
360
赤煉瓦倉庫勉強会「Databricksを選んだ理由と、絶賛真っ只中のデータ基盤移行体験記」
ivry_presentationmaterials
2
370
Lazy application authentication with Tailscale
bluehatbrit
0
210
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Music & Morning Musume
bryan
46
6.6k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Being A Developer After 40
akosma
90
590k
Faster Mobile Websites
deanohume
307
31k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Docker and Python
trallard
44
3.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
740
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