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
さくらのクラウドとDocker Swarm Modeで誰でもわかる簡単デプロイ @ さくら...
Search
chibiegg
December 23, 2019
Technology
0
4.4k
さくらのクラウドと Docker Swarm Modeで 誰でもわかる簡単デプロイ @ さくらの聖夜2019 / Simple Deployment with SAKURA Cloud and Docker Swarm
chibiegg
December 23, 2019
Tweet
Share
More Decks by chibiegg
See All by chibiegg
コンフィデンシャルコンピューティングは本当に機密なのか?@ 2025-08-23 LOCAL Developer Day ’25 Security with 在札幌米国総領事館 / Confidential Computing Truly Confidential? @ 2025-08-23 LOCAL Developer Day ’25 Security with the U.S. Consulate General in Sapporo
chibiegg
0
14
パブリッククラウドにおける機密コンピューティング@さくらのTech Day 2024-11-12 / Confidential Computing in Public Cloud
chibiegg
0
330
tiupによるTiDBの構築 @ TiUG Meetup #3 Osaka / Building TiDB with TiUP
chibiegg
1
260
Stable Diffusionの使い方と追加学習によるLoRAの作成~GPUコンテナサービス “高火力 DOK” の活用~ @ 2024-06-29 OSC2024 Hokkaido / Stable Diffusion and Creating LoRA with Additional Training ~ with 'Koukaryoku DOK' ~
chibiegg
1
2.2k
長期間TiDBを使ってきた話 @ 私たちはなぜNewSQLを使うのかTiDB選定5社が語る選定理由と活用LT / Experiences with TiDB Over Time
chibiegg
3
1.8k
3年近くTiDBを使ってきた話 @ TiUG Kick Off #0 / My Journey with TiDB: Nearly Three Years On @ TiDB User Group Kick Off #0
chibiegg
4
1.3k
SDR (Software Defined Radio) を使った無線の解析 @ 2023-02-11 SECCON 電脳会議 2022 / Wireless Analyzing using SDR @ SECCON 2022
chibiegg
1
1.8k
分散DBを運用してみて〜TiDB の仕組みと実例〜 @ さくらの夕べ Tech Night #5 Online / About TiDB @ SAKURA internet Tech Nignt #5 Online
chibiegg
1
630
クラウドネイティブなデータベースTiDB の魅力@db tech showcase 2021 / PingCAP TiDB with SAKURA internet
chibiegg
1
470
Other Decks in Technology
See All in Technology
AWS資格は取ったけどIAMロールを腹落ちできてなかったので、年内に整理してみた
hiro_eng_
0
180
設計は最強のプロンプト - AI時代に武器にすべきスキルとは?-
kenichirokimura
1
350
What's the recommended Flutter architecture
aakira
1
910
[JDDStudy #10] 社内Agent勉強会の取り組み紹介
yp_genzitsu
1
130
どうなる Remix 3
tanakahisateru
2
350
CloudFormationコンソールから、実際に作られたリソースを辿れるようになろう!
amixedcolor
1
150
バクラクの AI-BPO を支える AI エージェント 〜とそれを支える Bet AI Guild〜
tomoaki25
1
440
今、MySQLのバックアップを作り直すとしたら何がどう良いのかを考える旅
yoku0825
0
150
「データ無い! 腹立つ! 推論する!」から 「データ無い! 腹立つ! データを作る」へ チームでデータを作り、育てられるようにするまで / How can we create, use, and maintain data ourselves?
moznion
6
3.3k
コード1ミリもわからないけど Claude CodeでFigjamプラグインを作った話
abokadotyann
1
160
やり方は一つだけじゃない、正解だけを目指さず寄り道やその先まで自分流に楽しむ趣味プログラミングの探求 2025-11-15 YAPC::Fukuoka
sugyan
1
170
Introducing RFC9111 / YAPC::Fukuoka 2025
k1low
1
210
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Producing Creativity
orderedlist
PRO
348
40k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Building an army of robots
kneath
306
46k
Embracing the Ebb and Flow
colly
88
4.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.3k
Building Adaptive Systems
keathley
44
2.8k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.1k
Bash Introduction
62gerente
615
210k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
How GitHub (no longer) Works
holman
315
140k
Transcript
さくらのクラウドと Docker Swarm Modeで 誰でもわかる簡単デプロイ 2019-12-23 @さくらの聖夜2019 ©SAKURA internet Inc.
さくらインターネット株式会社 執行役員 技術推進統括担当 兼 CISO 江草 陽太
⾃⼰紹介 2 【所属等】 さくらインターネット株式会社 新卒入社 執行役員 技術推進統括担当 兼 CISO 【開発】
• さくらのVPS API/DB/制御システム担当 • sakura.io ハードウエア仕様、ファームウエア開発 システム設計、開発、インフラ設計、構築 • 社内システム/データセンター自動化 • さくらのエンジニアリングラボ 【その他】 • CSAJ U22プログラミングコンテスト審査員 • Home NOC Operators’ Group (AS59105) @chibiegg
⾃⼰紹介 3 【経歴】 • ロボカップジュニア (中学・高校) / NHK大学ロボコン • 大阪大学工学部電子情報工学科情報通信工学専攻
• 個人事業主 • 大阪大学大学院工学研究科中退 • SECCON CTF 2014 国内4位 • ISUCON5/ISUSON7/ISUCON8本戦、ISUCON9問題作成 • ICTSC7 大人チーム 【専門】 • ソフトウエアエンジニア • NW/SC/DBスペシャリスト • 回路設計/組み込みソフトウエア 【趣味】 旅行/温泉/写真/電子工作/プログラミング/かわいい服 @chibiegg
よくあるアプリケーション 4 Nginx django Redis PostgreSQL
よく使うミドルウエア 5 • Nginx • リバースプロキシと静的ファイル配信 • Django • Webアプリケーション本体
• Redis/Memcached • グラフデータ等のキャッシュ • PostgreSQL/MariaDB • データベース
古典的な⽅法でのデプロイ 6 • パッケージのインストール • posrgresql-10, python3-pip, redis, nginx •
ソースコードを持って来る • Pythonパッケージをインストールする • 各種設定ファイルを書く • データベースをセットアップする • サービス登録する
2019/12/23 ©SAKURA internet Inc. 7 開発にDocker Composeを使う
開発にDocker Composeを使う 8 • 開発環境は⼿元のmacOSなど • いろんな開発を並⾏して⾏うため、環境構築が⼤変 • データベース、Redis、Pythonのバージョン、etc… •
Docker Composeを使うことで簡単に • コンテナを使うため独⽴した環境が⽤意できる • 他の環境に影響しない、壊さない • 初めて実⾏する⼈もコマンド2つ • `docker-compose build` `docker-compose up` のみ • docker-compose.ymlに全て書いてある • 削除も⼀⾏ `docker-compose rm`
開発にDocker Composeを使う 9 • git clone
[email protected]
:isucon/isucon9- portal.git • cd
isucon9-portal • docker-compose build • docker-compose up • http://localhost:8000/ を開く
2019/12/23 ©SAKURA internet Inc. 10 Docker Composeでのデプロイ 〜1台だけで動かす〜
Docker Composeでのデプロイ 11 Docker ComposeとSystemdを使う • パッケージのインストール • docker, docker-compose
• ソースコードを持って来る • docker-compose.yml が含まれている • Systemdにサービス登録する
1台によるDocker Composeでの課題 12 • ソースコード更新の時に、ダウンタイムが発⽣する • イメージビルドや起動にかかる時間による ↓ ローリングアップデート あるいは
ブルー・グリーンデプロイが欲しい
2019/12/23 ©SAKURA internet Inc. 13 Docker Swarm Modeでのデプロイ 〜複数台で動かす〜
Docker Swarm Mode 14 サーバ OS Docker Engine App App
一台でのDocker Compose サーバ サーバ サーバ OS OS OS Docker Engine Docker Engine Docker Engine App App App App App App Docker Cluster 管理レイヤ Docker Swarm Mode オーケストレーション サービス検出・クラスタ管理 Dockerのコンテナ管理
Docker Swarm Modeでのデプロイ 15 • Docker Swarmのインストール • ⼿作業でも簡単 •
Ansibleで⾃動化も簡単 • ソースコードを持って来る • docker stack deploy コマンドで設定を反映 • イメージのバージョンを変えると ローリングアップデートされる!
注意点 16 • 永続化データがあるアプリケーションはコンテナ で実⾏しない • データベースはDocker外で起動する • NFSなどを利⽤する⽅法もある
Docker Swarm ⾃体の使い⽅は… 17 https://www.slideshare.net/zembutsu/introduction-to-docker-swarm
さくらのクラウドで実環境でも使える構成を紹介 18 エンハンスドLB Nginx Swarm Worker Swarm Manager DBアプライアンス スイッチ
192.168.0.0/24 https://www.example.com/ ポート番号毎にアプリケーションをデプロイし、Nginxでリバースプロキシするといい感じ SSLはLet’s Encryptで自動更新! HTTP/2にも対応!
さくらのクラウドで実環境でも使える構成を紹介 19 エンハンスドLB Swarm Worker Swarm Manager DBアプライアンス スイッチ 192.168.0.0/24
https://www.example.com/ ポート番号毎にアプリケーションをデプロイし、ELBのルール機能でリバースプロキシ ルールベースロードバランスに対応!
2019/12/23 ©SAKURA internet Inc. 20 One more thing ...
2019/12/23 ©SAKURA internet Inc. 21 たしかに!
2019/12/23 ©SAKURA internet Inc. 22 さくらのエンジニアリングラボ
2019/12/23 ©SAKURA internet Inc. 23 どんどん新しいサービスをプロトタイピングし 早期のタイミングでお客様にも直接使っていただく
2019/12/23 ©SAKURA internet Inc. 24 わたしも作るか…
2019/12/23 ©SAKURA internet Inc. 25 金曜日
2019/12/23 ©SAKURA internet Inc. 27 土曜日
2019/12/23 ©SAKURA internet Inc. 28 日曜日
2019/12/23 ©SAKURA internet Inc. 29 火曜日
2019/12/23 ©SAKURA internet Inc. 30 先週
2019/12/23 ©SAKURA internet Inc. 31 先週水曜日
2019/12/23 ©SAKURA internet Inc. 32 今日
2019/12/23 ©SAKURA internet Inc. 33 ということは
2019/12/23 ©SAKURA internet Inc. 34 今⽇からさくらのクラウドでご利⽤いただけます
2019/12/23 ©SAKURA internet Inc. 35 今⽇からさくらのクラウドでご利⽤いただけます
2019/12/23 ©SAKURA internet Inc. 36 今⽇のAdvent Calendarで仕組みを紹介しています Private Docker Container
Registryサービスを作った話 https://qiita.com/chibiegg/private/746e0825c602f947ab1c