
Fully Booked - Docker 化部署,使用 DigitalOcean 和 Cloudflare
Fully Booked 以五个 Docker 服务的形式上线,部署在 Cloudflare 后面的一台 DigitalOcean droplet 上,让一个很小的团队也能运营一个托管定金的市场平台。一个仓库构建所有镜像,一个 compose 文件和一个 Makefile 把发布简化为 pull、build 和 up,Caddy 代理负责证书和安全头,Playwright 在服务器上渲染每一份报价单和发票的 PDF。由于各服务从一开始就相互独立,后来无需重建就迁移到了自托管的 Kubernetes 集群。
完整故事
这套基础设施让一个收取定金的交易平台,由一个小团队运行五项服务,而且不出意外。
托管定金的交易平台不能宕机
Fully Booked 收取客户的定金,向运营商发放收入,并送达双方都依赖的各种文件。在这里,宕机可不只是不方便:无法付款的客户会去别家预订,打不开报价单的运营商会丢掉这单生意。
整个平台由五项服务组成,包括客户网站、运营商网站、管理后台、文档网站和一个后端,由一个非常小的团队开发和维护。部署方式必须简单到可以手动运行,又稳固到值得信赖。
五项服务,一个代码仓库,一条命令
每项服务都从同一个代码仓库构建为独立的 Docker 镜像。四个网站被构建成轻量的静态服务器,NestJS 后端承载 GraphQL API,MongoDB 和上传的文件则存放在持久化卷上。一个 compose 文件把它们连接到同一个私有网络中,一个 Makefile 把每次发布简化为 pull、build 和 up 三步。


Cloudflare 在前,外加两个刻意的例外
Cloudflare 托管每个子域名的 DNS,并为公开网站提供代理,负责缓存、证书和防护。有两条记录特意保持直连:一条是运营商网站,好让 Apple 读取那个让链接直接打开应用的文件;另一条是 API,好让 Square 的支付 webhook 顺利到达而不被拦截。
这两处任何一处出错,要么每份 PDF 里的深度链接都会失效,要么支付无法确认,所以两者都在 DNS 表旁边写明了原因。


承担安全工作的反向代理
位于边缘的 Caddy 容器会自动签发证书、压缩响应、重定向所有 www 地址,为 API 添加 strict transport、frame 和 content type 等安全头,并以应用商店要求的 content type 提供应用关联文件。


在生产环境中生成文件
每一份报价单、取消信函、发票、预订确认函和司机行程单,都由运行在后端镜像中的 Playwright 在服务器端生成。让无头浏览器在生产容器里成功安装,是整个项目中最难的一环,也正因如此,运营商才能在几秒钟内用手机发出一份精美的 PDF。




从一台服务器到一个集群
在最初的几个阶段,这台 droplet 服务器支撑起了整个平台。当每月账单和单台机器的局限开始显现时,同样的镜像被零停机迁移到自托管的 Kubernetes 集群,之所以能做到,是因为它们从一开始就是作为独立服务构建的。
对创始人来说,这意味着无需重建、没有中断;对运营商和客户来说,一切照旧,只是系统一直稳定运行。这些服务本身的故事,请见Fully Booked 的完整故事。
他们的评价
Excellent time keeping, great attitude, brilliant skill. highly recommend
12月 05, 2024
(5.0)Monir is an exceptional developer with outstanding expertise in his field. His advanced skills enable him to deliver results that surpass those of competitors. He is very thorough and has keen attention to detail, Monir is an excellent listener who can transform your ideas into reality with precision.
11月 28, 2024
(5.0)Today marks one year of working with Monir, and this time has allowed me to know Monir as a truly dedicated individual. We have collaborated on my project daily for the past year, and not once has Monir failed to respond. Monir has invested tremendous effort and focus into this project, working late nights and early mornings, always available to answer calls and resolve issues. There has never been a moment when Monir turned down work or shirked responsibility. The project is growing day by day, and if it becomes a success, it will be largely thanks to Monir's unwavering dedication.
7月 03, 2024
(5.0)I cannot express enough gratitude for Monir's exceptional work as a full-stack developer. Over the past 8 months, Monir has been instrumental in bringing my vision to life by diligently crafting a sophisticated platform that exceeds all expectations. Monir's proficiency in his craft is unparalleled. His technical expertise, coupled with his creative problem-solving skills, has consistently resulted in innovative solutions that have elevated our platform to new heights. His ability to seamlessly navigate through complex challenges showcases his mastery of both front-end and back-end development. Beyond his technical prowess, Monir's professionalism and dedication are truly commendable. He has demonstrated unwavering commitment and reliability throughout the entire development process, ensuring that every aspect of the platform is meticulously crafted to perfection. Working with Monir has been an absolute pleasure. His clear communication, attention to detail, and proactive approach have made collaboration effortless and enjoyable. He has not only met deadlines consistently but has also gone above and beyond to deliver features that surpass expectations. In conclusion, Monir is not just a developer; he is a visionary who brings passion, expertise, and dedication to every project he undertakes. I am immensely grateful for his invaluable contributions to our platform, and I wholeheartedly recommend him to anyone seeking a top-tier full-stack developer. Thank you, Monir, for your outstanding work and unwavering commitment to excellence. You are truly a standout talent in your field.
3月 27, 2024
(5.0)Monir is a very experienced developer. I have been working with him very closely for 8 months now. He has achieved every goal that we planned. He has taken on very complex challenges with the project that we have created and has been able to solve every issue that we've faced. He is extremely hard working. He works day and night. He's work ethic is excellent. He never complains or give excuses. My project is beautiful now and I can't wait to promote it to the world.
1月 21, 2024
(5.0)Monir has been working on my project for the last 3-4 months. We have been speaking and creating ideas to improve this project on a daily basis. The project is now complete and I can honestly say Monir is one of the best people I've ever worked with. Every single commitment that Monir promised from the beginning of this journey he stuck to and achieved. He never moaned, complained or made an excuse about anything. He completed every single commitment that we agreed upon. Monir worked early mornings and late nights until he produce the project I asked of him, and now my business journey is ready to move forward and I'm completely glad that I choose Monir to create this platform for me. The project consisted of an admin panel a customer website and an app. All projects were built to high specification and have very sophisticated features. I would definitely recommend monir to anyone looking for a serious developer.
10月 18, 2023
(5.0)你可能也喜欢

博客是来自生产一线的笔记:架构决策、经受住真实用户考验的 AI 系统、能自己挣回成本的基础设施。写于工作之中,而不是隔岸观火。


