WordPress requires no introduction and same is the case with EasyEngine, a tool which makes life easy of WordPress hosted servers as well as system admins and DevOps guys. This open source tool is now all set to adopt docker containers for its 4th version.
Although this is a welcome move from rtCamp, the company behind this tool,but unfortunately not all developers and system admins are familiar with containers. However, moving to docker is the need of an hour and thanks to rtcamp guys who adopted it for their 4th version of EasyEngine.
Migrating your WordPress install might be a headache especially if you are not a developer or run a high traffic site. EE is currently used by many high traffic WordPress sites globally. In addition to this headache playing with containers is not everyone’s cup of tea. Let’s find out how you can migrate your existing WordPress install to EE v4 without much efforts.
Step 1: Backup you existing WP files and its respective Database
All you need is a wp-content directory as a backup and your DB backup. There is absolutely no need to copy all files and folders simply because all of your plugins, themes and images are stored in wp-content directory.
Simply take a backup of wp-content directory and your DB file in sql format in a tar.gz file. Place this file in your html directory or a directory which is exposed to port 80.
Note: if you have played with wp-content or wp architecture for custom development, you need to make the necessary changes and migrated those files / folders accordingly.
Step 2: Install EE v4 on a brand new server
In order to install EE v4, you need a new server which does not have any other tools or scripts preinstalled. We use and recommend Ubuntu 18.04 LTS server from E2ENetworks or Digital Ocean.
Login into your new server and copy paste the following command as below:
wget -qO ee rt.cx/ee4 &&
sudo bash ee
This will automatically download EE v4 scripts, Docker etc and also install them.
Now, create site with your existing site name using
ee site create domain.com --type=wp --php=7.3 --cache --ssl=le
The above command will create site with your domain and install WP as well as setup Redis for you.It will also setup SSL for your domain. Just save the site info in Notepad which includes WordPress credentials as well as DB credentials.
Login into PhpMyAdmin using DB credentials from your browser through the following url
http://domain.com/ee-admin/pma/ and select all tables from the DB and drop them.
Step 3: Migrate your existing WP
After you drop all the tables from DB either import your existing db backup from phpmyadmin if the size of your .sql file is in few MBs. Else, import it using
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root –password=root DATABASE through CLI.
All of your WP Files and Folders are located here /opt/easyengine/sites/domain.com/app/htdocs
Now, change directory using cd opt/easyengine/sites/domain.com/app/htdocs and delete existing wp-content using rm -rf wp-content
Download your existing backup in the same directory using wget http:// or https://domain.com/file.tar.gz
Extract the file using tar -zxvf file.tar.gz command. Now, change ownership and permission of wp-content directory by using
chown -R www-data:www-data wp-content
Lastly, edit your wp-config.php file and ensure that you replace table prefix with your current table prefix used in your DB and save the necessary changes.
Change NameServers or A record IP to the new one. Login into your wp dashboard and just save permalinks once.
Its Done. Your site is now live on your new server.