Question

How would I properly set up local and production development for WordPress project?

Posted August 29, 2020 148 views
WordPress

Hi DO community!

I have a question or a guideline on the WordPress project.

I’ve been tasked to do WordPress project for the company but I don’t know how to separate local development from production. Obviously I don’t want to code in the live website. I want to code locally and then with all of the approval deploy the changes to production.

I’ve already created an instance with the following specs:
Ubuntu 18.04 LTS
NGINX
PHP
MySQL
SSL certificate has been installed by the Let’s Encrypt

In this case, workflow differs when you develop local vs production.

I’ve read the using Git or Docker might help but I am not sure how to do that right.

Thanks in advance

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hi @admax88,

I’ll recommend using Git as well. Git will allow you to push your files online and then you can download them/clone them once ready on your droplet. If you are uncertain at how to use git, it’s real easy, it won’t take you more than an hour or two to get used to it. Here is an article which will help you out :

https://www.digitalocean.com/community/cheatsheets/how-to-use-git-a-reference-guide

Alternatively, you can use FTP and upload your code once you are finished with developing the website but that’s a lot slower process than using git.

Regards,
KFSys

by Lisa Tagliaferri
This cheat sheet-style guide provides a quick reference to some of the more common Git commands you may use when managing repositories and collaborating on software.

Hi @KFSys,

I am thankful for your reply.

This is another confirmation that Git is the right tool for it.

Do I need to use environment variable to set one variable for development and another for production?

I came across this article explaining how to use environment variables.

https://www.twilio.com/blog/working-with-environment-variables-in-node-js-html

Thanks,
admax

edited by MattIPv4
  • Hi @admax88,

    Regarding the NodeJS part, you’ll need to find the best way that works for you. Usually, there are some best practices but as long as it works for you, it’s alright.

    If you are talking about git, you can use branches. Let’s say you have one branch which is development and production would be the master branch.

    Regards,
    KFSys

Submit an Answer