Deployment Notes

How to Deploy a WordPress Site

Types of Deployment

  1. Totally new project on local development site.
  2. Deploy development site to production production.
  3. Migrate/clone production site to development (local) site.
  4. Migrate/clone development site to new production site.
  5. Push changes from development site to an existing production site.

Components of WordPress Site

  • Core WordPress files.
  • Third-Party Plugin Files.
  • Third-Party Theme Files.
  • Local Plugin Files.
  • Local Theme Files.
  • Uploaded Content
  • Database

Manually Cloning a WordPress Site

Note, I have not successfully cloned a WordPress Site, though the problem maybe with Apache2 instead of WordPress.  For some reason, the URL Rewrite rules are giving bogus results causing the request to fail with “/var/www/html/index.php” not found.

  1. Export database from Master Website
    1. Include option to drop existing tables during the import before loading data.
  2. Copy all files from Master Website to Clone Website.
    1. Make sure all clone files have 664 and all clone directories have 775 permissions.
      1. find . -type f -exec chmod 664 {} \;
      2. find . -type d -exec chmod 775 {} \;
    2. Make sure all clone files and directories are owned by the web server and are assigned to the same group as the web server.
      1. If web server is in the same group as the owner, that works too.
  3. Import database to Clone Website.
  4. Manually update Clone Database so that all references to the Site URL are changed to the Clone Website.
    1. My script, update.php, does that.
    2. In wp_posts, update GUID column.
    3. In wp_postmeta, update meta_value column.
    4. In wp_options, update option_value column.
    5. Make sure to unserialize values before switching URLs.
    6. UPDATE wp_options SET meta_value = ” WHERE meta_key = ‘recently_edited’;
    7. In wp_usermeta, check all the meta_values where the meta_key = ‘home_path’.  If the path does not reflect the clone website.
      1. NoMoreCaptchas uses the home_path to save log data.
  5. Edit wp-config.php
    1. Make sure the following constants are properly defined:
      1. DB_USER
      2. DB_PASSWORD
      3. DB_NAME
      4. DB_HOST
      5. table_prefix
  6. Make sure Clone Database is “repaired”
    1. Edit wp-config.php — Add “define(‘WP_ALLOW_REPAIR’, true);”
    2. In browser, go to http://{website}/wp-admin/maint/repair.php
    3. Run database repair
    4. Edit wp-config.php — Remove “define(‘WP_ALLOW_REPAIR’, true);”
  7. Rebuild the Permalink cache
    1. Click on the dashboard -> Appearance -> Permalink menu item.
    2. Select a different method of permalink format (radio buttons) than the one currently being used.
    3. Save new selection.
    4. Select the original method of permalink format.
    5. Save original selection.
  8. If everything is correct, the Clone Website should be functional.

Comments are closed.