Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
从零开始,打造 Ruby 项目的容器化集成工具
Search
Ivan Chou
September 19, 2017
Programming
340
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
从零开始,打造 Ruby 项目的容器化集成工具
Ivan Chou
September 19, 2017
Other Decks in Programming
See All in Programming
フロントエンドUIフレームワークのこれまでとこれから
ssssota
4
2.1k
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
6
3.4k
App Intentsのビルドプロセスを支える技術
kntkymt
0
180
不幸な GC
chencmd
0
900
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
140
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
270
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
130
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
140
XHTMLが残したもの
yosuke_furukawa
PRO
2
640
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
770
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
700
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
Odyssey Design
rkendrick25
PRO
2
800
A Soul's Torment
seathinner
7
3.6k
Site-Speed That Sticks
csswizardry
13
1.5k
GitHub's CSS Performance
jonrohan
1033
470k
Automating Front-end Workflow
addyosmani
1369
210k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
270
Transcript
从零开始 为 Ruby 项⽬目容器器化打造集成⼯工具
⽤用 docker 来部署 Rails 项⽬目 这个有什什么好讲的?
Rubyist 周艺 铲屎官 曾就职于「速递易易」 现在在「知⼈人」in「彩程」 @IChou 沉浸在 Review 中的「⼀一只猫2」
全国最⼤大的智能快递柜公司 ⾄至少…暂时…应该是
快递柜01 快递柜02 快递柜03 快递柜04 快递柜05 快递柜06 快递柜6w …… Business Center
(Rails) Sidekiq Queue01 Queue02 Queue03 Queue04 Queue05 Queue14 …… RubyApp01 RubyApp02 RubyApp03 RubyApp04 RubyAppX …… OtherApp 若⼲干 ⾃自建DDOS ⽆无脑 Retry
上线⼀一不不⼩小⼼心就 解锁了了成就 不不过没关系 反正都是「阿⾥里里云的锅」
Microservices 应⽤用数量量爆炸、请求链路路复杂、雪崩⻛风险 Capistrano 服务器器资源分配不不均、回滚不不总是可靠、单次部署数量量受限 OneAPM ⼀一个⽉月总有那么⼏几天报警有问题或者不不及时 Staff 只有⼀一名运维⼯工程师
▸ 榨⼲干服务器器资源,控制⽀支出(主要原因) ▸ 秒级扩容 ▸ 真正实时的监控和告警 ▸ 快速可靠的回滚 ▸ 熔断机制
▸ 简化运维操作(图形化产品) 亟待解决的问题:
None
搞事情~ 搞事情~ ⼀一个实习⼀一对基 吴天亮 速递易易第⼀一运维 ⾦金金海海洋 娶了了成都妹⼉儿的江苏⼈人 胡鸿达 基础平台⽼老老⼤大
GoCD https://www.gocd.org Open source continuous delivery server to model and
visualize complex workflows with ease
Rancher an open source project that provides a complete platform
for operating Docker in production https://github.com/rancher/rancher
GoCD Rancher IMAGE How to build? How to deploy?
docker_compose https://github.com/docker/compose discourse_docker https://github.com/discourse/discourse_docker
base_image ubuntu_image GoCD Ruby APP + work_image Docker Registry Rancher
build deploy Rancher cli discourse_docker
OpenResty Kafka Kibana Ruby APP Rancher balancer work_image 钉钉机器⼈
理理想中 事实上
▸ 部署更更慢了了(20min 以上很正常) ▸ 配置更更复杂了了 ▸ 迁移进度慢、成本⾼高 ▸ 不不稳定因素增加了了 容器器化带来的新问题
来,我们商量量个事⼉儿 不不难吧 相信你 ⼀一周可以搞定么? 你抽点时间把容器器化这块重构了了
因地制宜 1 Maybe you think this is the translation of
the title, but it’s not. hahaha ~ 重新设计镜像,规划打包流程
base_image ubuntu_image Ruby APP + work_image 10 mins at least
ruby:2.3.1 base_image Gemfile + App_base_image Ruby APP + work_image about 30sec install deps & bundle Before After
100 200 300 400 500 600 700 800 900 (MB)
Before After 镜像减肥 镜像设计的核⼼心思想:是简,不不是⼩小
Base_Image 打包内容⼀一览 ▸ 本地化 (语⾔言、时区、apt 源、gem 源) ▸ 必需的依赖 (libmysqlclient-dev
etc.) ▸ 被认为必要的⼯工具 (sudo curl cron vim htop runit nscd) ▸ OpenResty ▸ live 账户初始化 ▸ pups
⼀一劳永逸 2 Maybe you think this is the translation of
the title, but it’s not. hahaha ~ 功能模块化,建项⽬目如搭积⽊木
PUPS Simple yaml based bootstrapper for Linux machines https://github.com/SamSaffron/pups Powered
by Ruby
web.puma.template.yml Merge yaml files Run shell command Create/replace files Hook
support Params
container.yml templates
docker run templates content of all templates pups content run
cmd docker commit docker tag PUPS from base_image push image 这是个⿊黑箱镜像啊~ 镜像打包⼯工具 packer
None
Template 编写原则 ▸ Convention Over Configuration ▸ DRY ▸ Flexible
enough
化繁为简 3 Maybe you think this is the translation of
the title, but it’s not. hahaha ~ 配置要够简单,也要够灵活
之前的配置⽂文件 container.yml rancher-compose.yml docker-compose.yml X 2 X 40 = 240
之前的部署命令
⽬目标:⼀一个⽉月内完成 20+ 项⽬目的容器器化迁移 限定:不不能影响新需求开发进度,⾃自⼰己抽时间
镜像部署⼯工具 deployer container.yml rancher-compose.yml docker-compose.yml path/to/deployer #{PROJECT_NAME} production $GO_PIPELINE_LABEL
So easy! ⼀一个⽉月 “所有”⽼老老项⽬目全部迁移到容器器
runit + entrypoint.sh etc/ !"" runit/ # !"" 1.d #
# %"" 00-commands-for-launch # %"" 3.d # %"" 01-commands-for-halt !"" service/ # !"" cron # # !"" run # # %"" supervise # !"" nginx -> /etc/service-available/nginx # !"" nscd # # !"" run # # %"" supervise # %"" puma -> /etc/service-available/puma %"" service-available/ !"" nginx # !"" run # %"" supervise %"" puma !"" run %"" supervise
授⼈人以⻥鱼 4 Maybe you think this is the translation of
the title, but it’s not. hahaha ~ 管理理界⾯面化,降低使⽤用成本
配置管理理界⾯面化 ▸ 偷懒 ▸ 新功能快速推⾏行行 ▸ 可复⽤用的系统 ▸ 权限控制
ROCKETS BASE IMAGE PACKER DEPLOYER ? WEB
总结 5 因地制宜 注重⾃自身特点,设计镜像层次及打包流程 ⼀一劳永逸 打包流程按功能模块化,建项⽬目如搭积⽊木 化繁为简 配置要尽可能简单,避免低效的重复劳动 授⼈人以⻥鱼 简单易易⽤用,体验友好,才是⼀一款合格的⼯工具
懒
反思
搅基或内推 请关注
谢谢⼤大家 祝各位码运昌隆隆