This is an example for when we WORK on Production. Pushing directly to production is an option for projects that are completely new and there is no content on it.
- If this is complete new website.
- No data migration will be done to this site other than manual content adding.
- Data will only be added once development has stopped.
- If everything is built on production then launching this website will be done without any effort.
- No need to use WP Engine buttons to [Delpoy] to production from stage.
- No stage URL will ever end-up on production.
- Stage can be used as a backup of the DB.
You will set up WP engine production on your local environment, and you will push to it directly skipping Stage. You will set up Stage as a Remote so one everything is done you can push to Stage from your local environment everything you have.
- Have WP Engine account and your ssh public key added to your account.
- Get our special
.gitignorefile that ignores WP core, because WP engine,
- Have WP-CLI working on your machine
- http://wp-cli.org because you will use it for installing core and adding plugins to your local environment
Setup step by step:
- Navigate to folder where you are setting up you local environment
$ cd ~/..wordpress../my_wp_install_name
- Clone Production from WP Engine
$ git clone --recursive firstname.lastname@example.org:production/INSTALLNAME.git .
- Set up your Stage as remote.
$ git remote add INSTALLNAME-stage email@example.com:staging/INSTALLNAME.git
- Fetch remote Stage
$ git fetch INSTALLNAME-stage
- Add special
.gitignorefile to root directory
- This ignores all of WP core because WP engine handles core updates, we will not be putting core in git
- On your local you will install core using WP-CLI later on
.gitignoreto WP Engine repository from here https://gist.github.com/lehelmatyus/7ca04af6be50c8f48dfb81dd8c5913e4
- Install local instance of WordPress using WP-CLI
$ wp core download
- Get The DB from WP Engine
- Go to WP Engine Interface and navigate to phpMyAdmin link should be (https://my.wpengine.com/installs/INSTALLNAME/phpmyadmin)
- Export DB from WP Engine as an SQL file
- Create a DB on your local machine
- Import DB from the export you just did
- Configure your on you local environment
- Rename a wp-config-sample.php file on you local environment to wp-confg.php
- Change all necessary variables:
DB_NAME , DB_USER, DB_HOST
define('DB_NAME', 'DBNAME'); /** MySQL database username */ define('DB_USER', 'USER'); /** MySQL database password */ define('DB_PASSWORD', 'PASSWORD'); /** MySQL hostname */ define('DB_HOST', 'localhost');
WP_SITEURLto whatever your local URL is
- Install and activate any necessary plugins using WP-CLI
$ wp plugin install
- Push all changes to WP Engine via Git