Sarah Moyer

WordPress Development for Web Agencies

  • Home
  • Work with Me
    • for Agencies
    • for Designers
    • for Business Owners
    • FAQs
    • Website Care
  • Portfolio
  • Blog
  • Contact

Local Dev WordPress + Coda 2 + Docker + Terminal + WP Engine

Last updated on March 31, 2018 · Posted in How To · dev process  · process  · wpengine

  • Make a local site
  • Make a local site (from WP Engine)
  • Move/rename/update local site

If you use Coda 2 to build WordPress websites, you can use their built-in local root to test changes before updating the live site.

Make a local website

  1. Website Files: download a copy of your website onto your computer or local environment. You’ll need the folder where wp-content, wp-admin, etc. are stored.
  2. Database File: do a mysql dump and drop the .sql file directly into the /wp-content/ folder.

Make a local website from WP Engine

On WP Engine, go to Backup Points > Production > Download ZIP button.

Pick “Partial backup” and check everything except “Media uploads.”

Unzip the downloaded site-archive…zip.

Docker

  1. Install Docker on your Mac.
  2. Download and unzip the docker file.

Terminal

Open the site archive folder in Terminal (or equivalent). Meaning, drag the folder into terminal.

In terminal, run

docker/start

The first time, it will take a while to complete.

Stop and Start

If you need to rename your site files or move them to a new location, you should probably run

docker/stop

first, then after you’ve rename and moved it, run

docker/start

Local Site

Look for the site at http://localhost:9980

Coda

In the site listings, click the i icon beside your live WordPress website.

Under Site, add these fields:

Local URL: http://localhost:9980

Remote Root: /wp-content/themes/your-theme

Local Root: “Set” to the site files you just downloaded. You’ll want to select “/theme/your-theme” to just sync your theme if you have other things set up for media files, etc. Otherwise, the remote root and local root should be corresponding folders.

Check: Use Publishing (so your changes on local won’t auto update live, defeating the purpose of local dev)

Set Local Files

In bottom center of Coda, click Split Screen. 

Then click the last folder listed in breadcrumbs, and click Choose… in the dropdown menu. Select the correct local theme folder that you just downloaded.

Compare Local and Live files

Distinguish between local and live : circle and cloud icons

Update local files

In Coda’s split screen, simply drag and drop the live theme over to the local theme. Click Replace to overwrite the folder.

Move/rename/update local site

To move or rename local site

Stop docker dev first. (note that docker was renamed to dev) In Terminal, run:

dev/stop --destroy

Move or rename your local site folder. I moved it out of Dropbox, because it was suggested to me not to keep Git repositories in Dropbox as its sync system can cause conflicts. I put the folder into a folder on my computer:

/Users/username/Sites/

Then in Terminal, change the directory:

cd /Users/username/Sites/Website_Folder

On your desktop, restart Docker:

In Terminal, start dev again:

dev/start

In a browser, access http://localhost:9980 or your local site url to see if it works correctly.

To update database of local site

Download a copy of the live database in phpMyAdmin.

Rename file to mysql.sql

Drop it into your local site’s /wp-content/ folder, overwriting the old one.

In Terminal, rebuild the database from the SQL file:

dev/start --rebuild

 

 

Was this post helpful?

Comments

  1. Robert Freytag says

    November 19, 2019 at 10:37 am

    Super helpful!
    Thank you very much for this setup!

    I used the “full backup” of wp engine, which now includes the sql file.

    Also, if you update the dockerfile to use
    image: “wordpress:php7.1″” and
    image: “wordpress:cli-php7.1”

    it will pull the current wordpress (5.3).

    Thanks again!

    Reply
    • Sarah Moyer King says

      November 19, 2019 at 2:04 pm

      You’re welcome, Robert! Glad to be of help. Also, thanks for the info!

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Anti-Spam by WP-SpamShield

Recommended Resources

Copyright © 2023 by Sarah Moyer · Privacy Policy