Preparation Steps on Original Server
There are a number of steps that should be performed on the original server to ensure that the move to the new server is as quick as possible. This is very important when moving to the production environment so that downtime can be minimized to less than 1 minute.
The basic steps are summarized here with the detailed commands following:
- Shutdown the web docker container on the original server.
- Start MySQL Workbench on the original server.
- Edit the wp_options for siteurl and home so that they match the hostname of the target server
- Close MySQL Workbench
- Shutdown the mysql docker container on the original server
- Copy the wp_docker directory in /root/Downloads to a USB drive
The detailed steps to prepare for the move are:
- Shutdown the web docker container using the command
docker stop wpdocker_web_1
- Start the MySQL Workbench by using the Start Menu -> Programming -> MySQL Workbench and providing the password for the MySQL root user on the connection at 172.17.0.2:3306
- Query the wp_option table and update the siteurl and home rows with the new server hostname, e.g. www.valcom.ca
- Close MySQL Workbench
- Shutdown the mysql docker container using the command
docker stop wpdocker_mysql_1
- Copy the directory wp_docker from /root/Downloads to a USB drive
Run Docker Wordpress on the New Server
The summary of steps on the new server to get Wordpress running are:
- Copy the directory wp_docker from the USB drive to a staging directory on the new server, e.g. /root/Downloads/staging
- If there is a an existing Wordpress docker installation running on the target server, then shut down the wordpress and mysql docker containers
- Remove the directory /root/Downloads/wp_docker and all its contents
- Move the wp_docker directory from the staging position to the /root/Downloads directory
- In a root command prompt change directory to /root/Downloads/wp_docker
- Start the wordpress and mysql docker containers using the docker-compose file.
The detailed steps for the move and activation are as follows:
- Copy the directory wp_docker from the USB drive to the directory /root/Downloads/staging
- Shutdown the wordpress and mysql docker containers on the target server, if required
docker stop wpdocker_web_1 docker stop wpdocker_mysql_1
- Remove the directory /root/Downloads/wp_docker
rm -Rf /root/Downloads/wp_docker
- Move the directory wp_docker in /root/Downloads/staging to /root/Downloads
mv /root/Downloads/staging/wp_docker /root/Downloads/wp_docker
- Change directory in a command prompt to /root/Downloads/wp_docker
- Start the wordpress and mysql docker containers. NOTE: if this is the first time this command is run on the target server then mysql, apache2, php and wordpress will be downloaded and installed complete with correct configuration automatically, but taking a number of minutes to complete.
docker-compose up -d
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.