Update:
It has become apparent that this process can be made simpler:
- Assume we are deploying staging.wingsofhistory.org to wingsofhistory.org
- Continue to use the same database that is defined in the destination version to be overwritten.
- Use the default value for the Packages section of Duplicator Pro, but make sure there are no existing packages in that folder.
- Use the default content folder located in the donor WP site, such as /home/explainer/wingsofhistory.org/wp-content/backups-dup-pro
- Run Duplicator Pro, when it completes, continue.
- Use FileZilla with an ssh connection to DreamHost to access the target folder /home/explainer/ … wingsofhistory.org
- Select the wp-content folder (see 4 above) and look for *installer.php, which should be copied to the home folder of the target. Rename it by stripping off everything but ‘installer.php’
- Copy the *archive.daf file, which should also be copied to the target home folder.
- Then, go to a browser and enter the URL of the newly updated server, such as https://www.wingsofhistory.org/installer.php
- That should bring up a page of installation instructions. Just read through them and push the buttons as needed.
- You will see the installer running, and then extraction, and then database update. Just follow along and verify the database selected is the one you intended.
- You will get an Admin Console selection, press it and enter the admin page of the newly installed WP site.
- You will see indications of installation files to be cleaned up. Allow that to complete.
- Now, you should have a functioning new site.
Forward
While building this website, I was learning a lot of new tools and procedures. I had never seen the internals of a WordPress site, nor had I ever used the DreamHost hosting site. I had a lot to learn.
While researching the potential WP plugins that I might use on this site, I experienced quite a few crash conditions that caused me to lose the work I had been doing. It is quite easy to crash a WP site when working from the inside.
Therefore, I determined to leverage the host and sub-host URL options to create multiple website images [Development, Staging, and Production] as follows:
- Production is mapped to the site hostname https://www.wingsofhistory.org, and the folder on DreamHost is wingsofhistory.org
- Development is mapped to the site sub hostname https://www.wingsofhistory.org, and the folder on DreamHost is development.wingsofhistory.org
- Staging is mapped to the site sub hostname https://www.wingsofhistory.org, and the folder on DreamHost is staging.wingsofhistory.org
Databases
In every WordPress image, there is a reference to a MySQL database. Databases are allocated via the DreamHost cPanel, which is the collective name of the web pages DreamHost uses for creating and monitoring resources, including hostnames, users, and databases, among other things. Let’s talk first about databases. By default, DreamHost will allocate a database with a long random name to each WordPress image. By convention, that file name is defined within the file wpconfig.php, in the home folder. I found the naming to be not helpful, so have adopted a naming scheme that makes some sense to me:
db_<hostname>_<sequence number>, such as db_development_31, or db_woh_27. Note that the ‘woh’ represents the hostname wingsofhistory.org.
So, the procedure is to look at the database list on the DreamHost site, and determine what the next sequence number is and to create a new database of the above format. Save that name, you will have to use it in the Step 2 below.
The good news is that we have a cool plugin, called Duplicator Pro, which makes copying a Development image over to a Staging or Production image in just a few steps (more steps than I would like but this does work reliably). Let’s do an example. Suppose you have been working on updates on the Development image, and you want to do some testing, but don’t wish to destabilize the Production image yet, so you are going to do a migration from development to staging. Here we go…
- Copy the file wpconfig.php from the staging.wingsofhistory.org file folder on DreamHost. Use FileZilla to copy this file to a working folder on your local computer. Then edit the file in order to update the database name (look for ‘DB_NAME’) at around line 21… and replace it with the new database name.
- Save the last copy staging.wingsofhistory.org by renaming it to xx-staging.wingofhistory.org, where xx is the sequence number of the database in use, as extracted from the file wpconfig.php in the staging.wingsofhistory.org folder. In order to do this, you can use the FileZilla Rename command when accessing the remote site home folder.
- Now that you have saved the old staging.wingsofhistory.org folder, you need to create a new staging.wingsofhistory.org folder within the DreamHost root folder, you can use the FileZilla Create Directory command to do that.
- Copy the file wpconfig.php from your local editable folder and place it in staging.wingsofhistory.org on DreamHost. Use FileZilla to do that.
- For the present, we will assume that the Duplicator Pro plugin is properly configured. Since that is basically a one-time operation, we will cover that later.
- Notice that there is the folder duplicator_bin in the home folder. That was created in the Duplicator Pro configuration as a convenient repository for the migration products.
- Run Duplicator Pro.
- Find the duplicator_bin folder and copy *archive.daf and *installer.php to staging.wingsofhistory.org. Duplicator Pro prepends a unique time-stamp as a prefix.
- You should now have 3 files in staging.wingsofhistory.org. Now rename *installer.php to installer.php
- Now, go to your browser input field and type “https://www.wingsofhistory.org/installer.php. That should find the installer.php in your staging.wingsofhistory.org file, load it and execute it.
Tools
- FileZilla. Install it locally and then configure it with your cPanel credentials so that you can work on the remote site from your desktop.
- SSH Terminal window. If you are comfortable with using a Linux terminal, you can use that as an alternative to FileZilla. Once I found the folder Rename command in FileZilla, I haven’t needed the SSH Terminal view.
- DreamHost cPanel. This is the basic login view for managing DreamHost resources. You will need it to create new databases, add users, and to retire databases no longer needed.
- A local text editor. You will have to edit the file wpconfig.php to add the new database name.
Configure the Duplicator Pro plugin
- Click on the Duplicator Pro menu in the left panel, then select Storage sub menu. Click the Add New button on the page, to the right of the Providers label.
- Edit the Name field to be ‘duplicator_bin’
- Edit the Storage Folder field to be ‘/home/explainer/duplicator_bin’
- Press the Save Provider button
- Now we have identified the folder we intend to use to receive the duplication files produced by Duplicator Pro.
Run the Duplicator Pro plugin
- Select the Packages sub-menu of Duplicator Pro
- If you see No Packages Found, we are ready to rock, so click the Create New button.
- Check the box under Storage next to duplicator_bin
- Click Next
- The Duplicator Pro plugin will ….