Roots Discourse

Migrating Existing Bedrock/Sage WP site

sage

#1

I’m trying to migrate an existing bedrock site to a new server. I have zero experience with either tools… All of the documentation I have found relate to migrating to from vanilla WP to bedrock or from bedrock to vanilla WP. Could someone point me to the info I’ll need to do this, or explain the steps I’ll need to take? Thanks in advance for your help.


#2

The steps are close to a normal vanilla WordPress site:

  1. Obtain an export of the database.
    • If you have SSH access/WP-CLI, running wp db export (ideally in the root of the project so its not public) will give you an export of the database.
    • Otherwise, use MySQL itself or a plugin like WP Migrate DB.
  2. Backup a copy of the entire application.
    • If you have access to the site’s Git repo, all that you should need is a copy of the uploads (web/app/uploads).
  3. You will also want to make sure you have a copy of the .env file in the root of the Bedrock project (if you are copying the application, you’ll have a copy of it).
    • Bedrock uses .env instead of wp-config.php to store environment variables.

With all of these parts, you have everything you need to move the site, however, it would very beneficial to investigate the following:

If not, some helpful information to gather would be:

  • What versions of Bedrock and Sage do you have? Checking the CHANGELOG.md file in each of the project roots will give you a good guess of what they are.
    • Knowing this will also help you identify any challenges with PHP version compatibility on the new server. The explicit reference to the required PHP version should be in the composer.json of each project.
  • Do you have SSH access to the server?
    • Is WP-CLI installed?
  • Is there a related Git repository that you have access to?
  • Was there an alternative deployment method (other than Trellis) used with the site?
  • Is the server Nginx or Apache?
    • If its accessible, a copy of the virtual host or server block entry would be helpful.
  • What was WP_ENV set to in .env?
  • Was DISALLOW_FILE_MODS disabled in config/?
    • Depending on the Bedrock version, this assignment will be located in application.php or environments/production.php. It’s possible it could have been overridden in .env as well.
    • If this was changed (to false), then you will need to ensure you get everything in the bedrock/web/app directory as some plugins or updates to plugins may not not be checked into version control.

All of that being said, you will want to make sure the new server can support Bedrock. Confirm the following for yourself:

  • PHP version is adequate to run Bedrock and Sage.
  • The server/service supports a separate web root. Bedrock uses a sub directory (web) as the web root.
    • In Apache, you can do some magic with .htaccess to overcome this if you don’t have access to the Apache virtual host config, but it’s not ideal.

The ideal and official solution for deploying Bedrock is Trellis. I highly recommend checking it out and — if you are able to — using it since it will make your work 100% easier.