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
UniStudy#0 今時のDevOpsの取り組み事例集
Search
Wataru Noguchi
October 16, 2015
Technology
0
520
UniStudy#0 今時のDevOpsの取り組み事例集
* Docker
* Jenkins, Capistrano, GitLab, ChatWork
Wataru Noguchi
October 16, 2015
Tweet
Share
More Decks by Wataru Noguchi
See All by Wataru Noguchi
しょしんしゃようDocker事例集
wnoguchi
0
1.4k
Other Decks in Technology
See All in Technology
生成AIで小説を書くためにプロンプトの制約や原則について学ぶ / prompt-engineering-for-ai-fiction
nwiizo
6
4k
「クラウドコスト絶対削減」を支える技術—FinOpsを超えた徹底的なクラウドコスト削減の実践論
delta_tech
4
110
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
2
300
Yamla: Rustでつくるリアルタイム性を追求した機械学習基盤 / Yamla: A Rust-Based Machine Learning Platform Pursuing Real-Time Capabilities
lycorptech_jp
PRO
4
210
Tech-Verse 2025 Global CTO Session
lycorptech_jp
PRO
0
1.5k
20250707-AI活用の個人差を埋めるチームづくり
shnjtk
1
1.1k
低レイヤを知りたいPHPerのためのCコンパイラ作成入門 完全版 / Building a C Compiler for PHPers Who Want to Dive into Low-Level Programming - Expanded
tomzoh
4
3.4k
B2C&B2B&社内向けサービスを抱える開発組織におけるサービス価値を最大化するイニシアチブ管理
belongadmin
1
4.7k
より良いプロダクトの開発を目指して - 情報を中心としたプロダクト開発 #phpcon #phpcon2025
bengo4com
1
3.2k
AIの全社活用を推進するための安全なレールを敷いた話
shoheimitani
2
110
How Community Opened Global Doors
hiroramos4
PRO
1
140
生まれ変わった AWS Security Hub (Preview) を紹介 #reInforce_osaka / reInforce New Security Hub
masahirokawahara
0
400
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Code Reviewing Like a Champion
maltzj
524
40k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Gamification - CAS2011
davidbonilla
81
5.3k
4 Signs Your Business is Dying
shpigford
184
22k
The Invisible Side of Design
smashingmag
301
51k
Done Done
chrislema
184
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Optimizing for Happiness
mojombo
379
70k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
125
52k
Transcript
今時のDevOps 取組み事例集 (株)ユニキャスト ソフトウェアエンジニア 野口航 第0回 ユニキャスト勉強会@日立市
お前誰?: 野口航(@wnoguchi) • しがないソフトウェアエンジニア(29歳) • 茨城県日立市在住 • 愛機は今話題沸騰中のL•n•v• • DevOpsへ取組み
• 株式会社ユニキャスト所属 • シェアハウス「コクリエ」に居住 • 夢はユーザ企業、とうきょうぐらし!
もくじ(とりくみ) • 事例1: 自分のサイトを Docker(さくらのVPS)で運用してみた(一部 障害あり) • 事例2: 会社の開発環境用Vagrant仮想マシンをDockerで書き換えて みた(失敗)
• 最近のトレンド: Boot2docker より Docker Toolbox のほうがよさ げ? • 事例3: Jenkins, Capistrano, GitLabを連携した自動デプロイ環境 の構築
事例1 自分のサイトをDockerで運用してみた • はてなブログで http://blog.pg1x.com/ 技術ブログ運営しています。 • 静的コンテンツもまとめて扱いたくて http://pg1x.com/ に統合したい。
• Dockerでサイト作ってみた • アップロードしたファルも永続化するようにした • MySQLのデータは永続化される
事例1 自分のサイトをDockerで運用してみた Dockerfile #wordpress/Dockerfile at 4823a04099 · docker-library/wordpress # https://goo.gl/qjtEPa
FROM wordpress # ボリュームの共有をおこなうため、実行ユーザ、グループのIDを変更 RUN usermod -u 1000 -U www-data RUN groupmod -g 1000 www-data VOLUME [“/var/www/html/wp-content”] ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] Wordpressのイメージは自前でカスタマイズ DockerのVolumeのアクセス権限の問題について - Qiita http://goo.gl/6DdCQ5
事例1 自分のサイトをDockerで運用してみた [wnoguchi@smtp docker-wordpress]$ docker build -t wnoguchi/wordpress . Sending
build context to Docker daemon 20.85 MB Sending build context to Docker daemon Step 0 : FROM wordpress ---> 4613a7aba13e Step 1 : RUN usermod -u 1000 -U www-data ---> Running in bde6cfe62556 ---> 4d10460a2de0 Removing intermediate container bde6cfe62556 Step 2 : RUN groupmod -g 1000 www-data ---> Running in f2f3fb96616e ---> 81b7b01c71dc Removing intermediate container f2f3fb96616e Step 3 : ENTRYPOINT /entrypoint.sh ---> Running in a4dc06c85735 ---> 992c2908310e Removing intermediate container a4dc06c85735 Step 4 : CMD apache2-foreground ---> Running in c1bc24c7658d ---> d3348cf9792c Removing intermediate container c1bc24c7658d Successfully built d3348cf9792c
事例1 自分のサイトをDockerで運用してみた docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy
docker run --name=mysql -d ¥ -e 'MYSQL_ROOT_PASSWORD=blahblahblah' ¥ -e 'MYSQL_DATABASE=wordpress' ¥ -v /opt/mysql/data:/var/lib/mysql ¥ mysql:5.7 docker run -d ¥ -e VIRTUAL_HOST=pg1x.com ¥ -e 'WORDPRESS_DB_PASSWORD=blahblahblah' ¥ -v /opt/wordpress/wp-content:/var/www/html/wp-content ¥ --link mysql:mysql ¥ wnoguchi/wordpress
事例1 自分のサイトをDockerで運用してみた
事例1 自分のサイトをDockerで運用してみた
事例2 会社の開発環境用 Vagrant仮想マシンをDockerで書き換えてみた • 結論:失敗しました • やらなきゃならないこと • 1つのVMの中にApache, PHP,
MySQL, ImageMagick ごった煮 • サービスごとに連携している部分は切り離して、 mutable な部分はボリュームとして 切り出さないといけない • つまり、APのコンテナとMySQLのコンテナには最低限分離しないといけない • PHPアプリケーションのコンテナとMySQLのコンテナのリンクに失敗(応用 力と時間がなかった)
事例2 会社の開発環境用 Vagrant仮想マシンをDockerで書き換えてみた Vagrant.configure(2) do |config| config.vm.box = "puppetlabs/centos-7.0-64-nocm" config.vm.network
"forwarded_port", guest: 80, host: 8080 config.vm.network "forwarded_port", guest: 3306, host: 3306 config.vm.provision "shell", inline: <<-SHELL sudo yum -y install httpd sudo yum -y install php sudo yum -y install php-mbstring sudo yum -y install php-mysql # EPEL リポジトリを有効にして php-mcrypt を入れる sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel- release-7-5.noarch.rpm sudo yum -y install --enablerepo="epel" php-mcrypt sudo yum -y install mariadb-server sudo yum -y install ImageMagick sudo systemctl enable httpd sudo systemctl enable mariadb sudo systemctl start httpd sudo systemctl start mariadb sudo systemctl disable firewalld sudo systemctl stop firewalld # デバッグ用 sudo yum -y install php-xdebug # 手動実行してください(MariaDB) #mysql_secure_installation SHELL end FROM centos MAINTAINER
[email protected]
RUN yum -y install httpd RUN yum -y install php RUN yum -y install php-mbstring RUN yum -y install php-mysql # EPEL リポジトリを有効にして php-mcrypt を入れる RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel- release-7-5.noarch.rpm RUN yum -y install --enablerepo="epel" php-mcrypt #RUN yum -y install mariadb-server RUN yum -y install ImageMagick # デバッグ用 RUN yum -y install php-xdebug # 手動実行してください(MariaDB) #mysql_secure_installation # コンテナ内のポート80番を公開 EXPOSE 80 # ENTRYPOINT ["/usr/sbin/httpd"] CMD ["-D", "FOREGROUND"] いい感じ!! Vagrantfile Dockerfile
事例2 会社の開発環境用 Vagrant仮想マシンをDockerで書き換えてみた いい、感じ? vagrant up vagrant up vagrant teraterm
docker run –d ¥ --link mysql:mysql ¥ unicast/foo-img Windows上でやってます(Windowsは修羅の道)
Boot2docker使っていたらDocker Machine奨 められた WARNING: The 'boot2docker' command line interface is
officially deprecated Docker Machine 使えよ! っていうかDocker Toolbox使おうぜ! https://www.docker.com/toolbox 乗るしかない。 このビッグウェーブに。 Boot2docker Docker Toolbox
Boot2docker使っていたらDocker Machine奨 められた • これで僕も流行に乗れる • UIが Windows 10 に似てる
• プログレスバーが円に なってて特に
Boot2docker使っていたらDocker Machine奨 められた ENOENT: no such file or directory, open
'C:¥Users¥<redacted>¥ca.pem' Windowsを使っているからなのか?!
参考書 • Dockerエキスパート養成読本[活用の基礎と実践ノウハウ満載!] (Software Design plus) http://www.amazon.co.jp/dp/4774174416 • → http://goo.gl/gVjwAu
事例3: Jenkins, Capistrano, GitLab を連携した 自動デプロイ環境の構築 デプロイ cap demo deploy
定期的にチェック Gitチェックアウト ビルド結果通知
事例3: Jenkins, Capistrano, GitLab を連携した 自動デプロイ環境の構築
事例3: Jenkins, Capistrano, GitLab を連携した 自動デプロイ環境の構築
ご清聴ありがとうございました。