patterndockerMinor
Update production server (apache, wordpress, mysql) on docker containers, from staging server
Viewed 0 times
updateproductiondockerwordpressstagingmysqlservercontainersfromapache
Problem
For our web servers running on Docker containers (Apache, mysql, wordpress, etc) we have a production and a staging virtual machines.
DEVs and content team work on staging and then I tar ball the files from the wordpress container and dump the mysql DB and scp them to production server.
Once in production I untar the files to the wordpress container and "restore" the DB.
(in fact we use a server in the middle, but I'm skipping that here to keep it short)
I was thinking on an internal docker registry, but that's only for images... so I will need to start/restart the images to container.
Or some kind of internal "GIT"? where I can push/pull versions?
what will be a better way to update production server?
DEVs and content team work on staging and then I tar ball the files from the wordpress container and dump the mysql DB and scp them to production server.
Once in production I untar the files to the wordpress container and "restore" the DB.
(in fact we use a server in the middle, but I'm skipping that here to keep it short)
I was thinking on an internal docker registry, but that's only for images... so I will need to start/restart the images to container.
Or some kind of internal "GIT"? where I can push/pull versions?
what will be a better way to update production server?
Solution
My thoughts based on your described scenario are:
I would also recommend tying all this together with a tool like Ansible, i.e. use Ansible to
Disclaimer: Although I've worked on DevOps automation for Wordpress sites, I am by no means an expert on Wordpress, so suggestions and clarifications welcome.
Hope this helps.
- Your tarball strategy, as described, might sound safe but is prone to risk in my opinion. A better approach is to version-control the WP files you will modify, while keeping the core intact and within the Docker container. Here's a reference I have used in the past that talks about version-control strategies for WP. You would of course need to spend some time and understand which folders/files to version-control for your specific site.
- The version-controlled files would be checked out on the host machine (which runs Docker) and be volume-mounted within your Docker container.
- Everytime your changes are validated in
Stagethey get pushed to Git. Getting these changes intoProdwould essentially be agit pull.
- If you wish you might also use a tool like composer as part of your deployment workflow. A dependency manager should be part of any deployment worklow.
I would also recommend tying all this together with a tool like Ansible, i.e. use Ansible to
- update local git repo
- run the composer bits
- ensure docker container is running
Disclaimer: Although I've worked on DevOps automation for Wordpress sites, I am by no means an expert on Wordpress, so suggestions and clarifications welcome.
Hope this helps.
Context
StackExchange DevOps Q#3363, answer score: 2
Revisions (0)
No revisions yet.