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
从零开始,打造 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
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
360
Building a Meta Ray-Ban display app
akkeylab
0
180
私のClaude Code活用法 (個人開発編) - PHPerKaigi mini #4(2026/08/24)
panda_program
1
140
今さら聞けない .NET CLI
htkym
0
210
リアルな遅延を測る仕様
kota_yata
1
120
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
250
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
110
源内ハンズオン概要編
hideg
0
210
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
250
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
250
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
720
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
270
Featured
See All Featured
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
220
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
280
How to Talk to Developers About Accessibility
jct
2
520
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
Site-Speed That Sticks
csswizardry
13
1.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Google's AI Overviews - The New Search
badams
0
1.1k
Documentation Writing (for coders)
carmenintech
77
5.5k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
520
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
430
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 因地制宜 注重⾃自身特点,设计镜像层次及打包流程 ⼀一劳永逸 打包流程按功能模块化,建项⽬目如搭积⽊木 化繁为简 配置要尽可能简单,避免低效的重复劳动 授⼈人以⻥鱼 简单易易⽤用,体验友好,才是⼀一款合格的⼯工具
懒
反思
搅基或内推 请关注
谢谢⼤大家 祝各位码运昌隆隆