lando / core-next

Next generation Lando v4 runtime
https://docs.lando.dev/v/next
GNU General Public License v3.0
4 stars 4 forks source link

Container snapshots for fast database reloads #37

Open mortona42 opened 1 year ago

mortona42 commented 1 year ago

Long ago, back when vagrant was our favorite local dev environment, I used this sahara plugin to take a snapshot of the box that is quicker to reload: https://github.com/jedi4ever/sahara.

This is fantastic for testing migrations or other operations that modify the database, which you need to revert to test again.

I'm a docker n00b so I'm not sure what the corresponding option is here. If there's a fast way to save and load a copy of the container, we could set up commands to switch it out.

GoonerW commented 1 year ago

You can always run lando db-export and lando db-import to backup and restore the database.

mortona42 commented 1 year ago

Yep, that's what I'm doing now but it can take a while for a large database. I'm looking for something faster.

GoonerW commented 1 year ago

Fair enough

pirog commented 1 year ago

fwiw @mortona42 we are planning on a "lando save" command in Lando 4 that, under the hood, will take container snapshots

xurizaemon commented 1 year ago

Love to see this - we've been using a similar approach for fast-start developer and CI environments, building images separately (via Gitlab CI / kaniko) and then overriding the image URL in Lando configuration. Has worked well for the last couple years, and really nice for team to have access to consistent, fresh source data (for migration projects) where time cost is kept down to "pull and start the container".

If I recall right, an important detail for us was that when pre-building images for use in Lando, we found we had to base off the Bitnami image.

Comment mostly to say (1) yay, this feature will be welcome, (2) it's really useful and I think saved our team a lot of "wait on DB load" / "which version are you looking at?" work, and (3) it's possible to do much of this currently, using existing Lando and Docker tooling.