Perhaps. But it is complicated. But we are constantly looking at it, and there are some changes underway that may make things easier. The TL;DR is that docker compose seems best suited to development and perhaps some narrowly targeted use cases, like preview mode.
For starters, here is a demo of what you can do today: Demo running docker compose up on fly machines . I’ll warn you that it is not pretty… there is some additional setup, but the main problem is that if you run docker compose up
on a fly machine, that machine is not servicing requests until that request is complete.
I’m not too worried about the additional setup… we can address that once we tackle the harder problem. Possible solutions:
- Blue/green deployment - start a new machine but keep the old machine running until the new machine is ready. The problem here is data and volumes - I’ve yet to see a docker compose yaml file without a a database and having your new machine come up with an empty database is not the desired end result.
- Temporarily run both the old and new versions on a single machine and only route requests to the new version once it passes a health check, after which point the old version is torn down. Kamal does something like this.
- Treat the docker compose file as a template but don’t actually use docker compose for deploy. Build the necessary images first then deploy then replace those steps with ones that reference the resulting image. Find a way to deploy that quickly. At the moment, fly machines run a single image, it would be helpful if we could get to the point where fly machines could run multiple images in namespaces – essentially more like containers. This is a big undertaking, but similar things are needed for Fly Kubernetes so it may just happen.
If I had to guess, the first thing you are likely to see is some sort of docker compose import function that converts your existing docker compose yaml file into one or more fly toml files that can be deployed with a single command. Once that is working, perhaps we will be able to optimize away the intermediate step (and/or make it transparent to you).