Reputation: 16439
I decided to start using docker in all my projects, and I'm interested in best practices, when it comes to deployment.
If I have a local docker environment, that is running a php-apache, mysql, and redis service, what's the best strategy when deploying? Do you have a custom docker-compose config for production, which removes the redis and mysql services (assuming you'd want those on their own dedicated server)?
Upvotes: 2
Views: 2302
Reputation: 300
There are a number of viable ways to run PHP containers in production, so it's a little hard to answer your question comprehensively. I'll offer a few options:
As a note on database containers, you can containerize your database, and assuming that you put the actual data in a volume and have a sensible backup system in place there's no reason that containers won't be safe. You probably want to start by running just one container for your database or by using a hosted database service as scaling a database across multiple containers can get complicated (but here's a little bit about how you might do it with MySQL).
Upvotes: 2
Reputation: 16439
I guess I'll be answering this myself.
After some more intensive digging, I found out that it's not a very good idea to deploy the database within a container. If I use swarm, it would be very difficult to maintain data integrity across the whole system.
Looks like most people just host the database separately, and only containerize the db in local development environments.
So for deployment, best option right now is to deploy just the configured web server and any other stateless server requirements.
Upvotes: 1