2025-06-24
Recalled this prod story.
Had to restart a container on a vm to update its config (can also be changed via ui). Previous guy set it up, and he left the org by then, luckily we can ssh into the vm. We restarted container, only to find out that the docker run command didn't mount volumes. OOF.
วันนี้มีคนถามว่าจะ migrate gitlab on-prem ไปบน cloud vm ยังไง เลยนึกถึงเรื่องนี้
หลายปีมาแล้ว production service ต้อง restart เพราะมีการแก้ config ก็คือเอาไฟล์ใหม่ไปยัดแล้ว restart service น่ะแหละ (มันแก้จาก web ui ก้ได้ หรือปักไฟล์ให้อ่านก้ได้เหมือนกัน)
คนขึ้นไว้ออกไปแล้ว ยังดี ssh เข้าไปที่ vm ได้
เข้าไปปุ๊ป มี docker รันทิ้งไว้อยู่ แต่เป็นการรันแบบ docker run ... ตรงๆ ไม่ได้มี docker compose อันนี้ไม่เท่าไหร่
ที่พีค คือ มันเป็น stateful service คือต้องมีการ mount volume ไว้ แต่ เจ้า container ที่รันทิ้งไว้ ไม่ได้ mount volume ไว้......
แล้วดัน restart ไปแล้วด้วย ใครแก้อะไรไปบ้างไม่รู้ ที่แน่ๆ ตอนนั้นทำได้แค่เอาของที่ dev ส่งให้ล่าสุดไป mount คาไว้ก่อน แล้วรอโดนลูกค้าสวด
เรื่องนี้สอนให้รู้ว่า ของที่ระลึกบางอย่าง ไม่ต้องทิ้งไว้ให้ก็ได้