We’ve come a really long way in this series. We set up a local development environment for WordPress, created a child theme, and took a deep dive into my Git workflow. Now it’s time to deploy from Local to Flywheel. Here’s how!
A Few Ways to Deploy from Local
Any time you launch a traditional WordPress site, you need to set up two things: (1) a MYSQL database and (2) a place for all of your uploads, themes, and plugins to live.
Local automates this process with Flywheel and WP Engine, the hosts it currently integrates with. If those won’t be your hosting providers, you can export the site and manually add the files to your own host.
- Start your site in Local.
- Right click on the site name in the sites list. Choose
- Follow the prompts to save the exported site to a specific location on your computer.
- Important: If you did any version control with Git, unzip the file Local exported to your computer. In your terminal, navigate to the folder with your
.gitdirectory and delete it. It’s bad practice to store the
.gitdirectory in production environments.
Below is the folder structure when you unzip and open your site’s
.zip file. Your directory may look different depending on your Local version.
├── YOUR-SITE │ ├── app │ │ ├── public # All WordPress folders and files, including wp-content │ │ ├── sql │ │ │ └── local.sql # Your database combined into one file │ ├── conf │ ├── logs │ └── local-site.json
Given the wide variety of scenarios, I won’t cover how to do this with every host. From here, you can follow the instructions from your hosting provider to add your WordPress site.
Basically, you’ll use the
local.sql file in the
/app/sql directory of your exported site to populate the database on your host. You’ll also import the
wp-content directory from
/app/public/ to your host’s server.
For more on this, I recommend “How to MANUALLY Migrate Your WordPress Site” by Josh Hall and “Migrate a WordPress site to a new host and new domain manually” by WPLearning Lab. That’s how I learned!
If you are planning to use WP Engine or Flywheel, the process is super simple! Here’s how I deploy from Local to Flywheel:
- In your Flywheel dashboard, click
CREATE A NEW SITEor
+ NEW SITE.
- Follow the prompts to set up your owner and plan, as well as set up your new WordPress site. (Note: You will basically create a new WordPress site at this step to provision a space for your build to migrate to. It will be deleted once you push your site from Local to Flywheel).
- In Local, go to the
Connecttab and select
CONNECT TO A PLATFORM. Then select Flywheel to connect Local to your Flywheel account.
- Go to the
Local Sitestab and start your site. At the bottom right of your screen, you’ll see
Connected to no host selected. Click that button to connect your Local site to Flywheel.
- Click the
Push to Flywheelbutton. Select a site under
Push site to, choose an environment, select
Include database, and
PUSH TO FLYWHEEL. You should receive an email at the address in your Flywheel account saying that the site successfully pushed.
And just like that, you built and deployed a WordPress site with Local! Great job! You can now point your domain to the IP address listed in your Flywheel site dashboard. You can also manage caching, SSH access, run backups and a lot more all from your Flywheel dashboard.
I hope you enjoy your deployed site! 🚀