Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Tom Tate
Tom Tate
16,016 Points

What's an ideal Wordpress dev environment and management process for local, staging, and production?

I'm getting ready to work with my first client on a Wordpress development project.

I've done well so far developing locally and migrating to a production server, but I want to introduce staging into the mix for feedback, and content entry.

Are there any good tools, docs, or methods for managing this?

My ideal workflow would be...

  • Develop locally
  • Push to staging, on my own domain/hosting (any recommendations? AWS, shared hosting, some other option?)
  • Have client review, enter content as needed.
  • Once ready for deployment, copy over to client's shared hosting account.
  • Repeat as needed for future iterations.

Would be awesome to use git to manage versions and deployments, as well, but what are some important items to note in doing so? I'm guessing I wouldn't want to put binary files through version control, but then wouldn't I run into sync issues?

Sorry - I realize this post is all over the place, any thoughts, or recommendations based on your experience?

3 Answers

Andrew McCormick
Andrew McCormick
17,729 Points

My workflow is the typical dev -> stagining -> production . My dev environment is typically local or I've been using c9.io more and more and ssh into a VPS I set up just for dev. This code matches the dev branch of my git repository. Once I'm ready to show my client, I push to staging.

To push to staging I merge my dev branch into my staging branch and then I either use git FTP or have dploy.io (automatic deployment) to deploy my staging branch to my staging site. My staging url is just client.mydomain.com or mydomain.com/client . I use htaccess password and robots.txt to keep search engines and unwanted visitors out of my dev subdomians.

rinse, wash, repeat, until the client says it's a go.

When we are ready to go live, I merge my staging branch into my master branch. And once again use git FTP or have dploy.io set up to deploy the code to the production server. (side note, I never have dploy.io set up to automaticly deploy my master branch..no no no no)

With wordpress you also have the database element. For that, I use WP Migrate DB Pro and have used it for a while now. So every time I go form dev -> staging or staging-> master I migrate the DB using that plugin.

Finally is the question of what goes into my Git. The only thing I ignore is my wp-config.php . For that I will manually add that file to each server once, just so my credentials are not in a remote git repository (even if it's 'private'). I know a lot of people will to say to keep core separate or ignore images, etc. That just doesn't work for me (or maybe I don't like change :) )

Tom Tate
Tom Tate
16,016 Points

This is an awesome answer - thanks!

I've used dploy.io to push static site code from git to an AWS S3 Bucket. Great tool, it didn't occur to me to use that for this purpose.

Git ignore the wp-config file is a good tip, as well. I would have never thought to do that either.

Thanks again - saving me some headaches.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Just a heads up that we will have a Modern WordPress Workflow course coming out this spring that will get into this in a lot of depth.

As an easy start to adding in a staging server, you might look into hosting companies like SiteGround that offer staging as part of their hosting stack. Otherwise you can just use another hosting account you have separate from wherever the live client site will live.

Nathan Newell
Nathan Newell
7,634 Points

I've been using c9 for my WordPress development, which has been awesome when collaborating with team members. Then enabling the application to be viewed publically when I am ready to share with the client.

As to staging, I have never really done it in development mode (through c9). it's something I really want to explore and thanks to Andrews post I feel like giving it a go.

I have a VPS on SiteGround so I use the staging server on there when the site is live, which is easy peasy to use.

As for migrating to a live server I use "Duplicator" plugin for WordPress. It is by far the easiest and effortless procedure I have come across. Google it. Kinda off topic regarding staging but just wanted to share.