Question

Setting up development/deploy/production -server

  • Posted September 10, 2014

Hi

My workflow today sucks and is no way good. So I have decided I would like to change how I work. And that is as follows: A vagrant box, for local development. With version control, using GIT. And then a development server running both git and a web server, and sql server. So a setup where I got. GIT, MySQL, PHP, Nginx and

  1. GIT repo setup on a development server (Found this great tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-git-server-on-a-vps)

  2. A deploy script that on all commits would deploy to the development webroot for that GIT repo/project but with some hook or something.

  3. A deploy script to the production server, don’t know how to best trigger this, please come with advice and some tutorial on how to implement this.

  4. A production server, (All tutorials I read pretty much states, “This configuration should not be used in production. Only on development servers”) So some good tutorial on setting up a production server. Containing, MySQL, PHP and Nginx. E-mail support for PHP applications.

  5. And finally a happy life ;)

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

I work in a similar way to how you want to do it. (Plus points for Vagrant BTW, it’s the ONLY way to develop locally!)

This is how I do it though…

  1. Get your production and development boxes setup in exactly the same way. LEMP is my recommendation on LEB such as the $5 DO box. Get them hardened and locked down. There are loads of good articles on here explaining how to setup your server and then configure UFW and F2B.
  2. Create your vagrant build as similar to the development and production servers as you can though.
  3. Setup your local files for your app / website / blog etc.
  4. Add your files and vagrant build to a new Git repo.
  5. Push this out to bitbucket (Github alternative with free private repos)
  6. Set up bare git repo’s on your production and development servers that are configured to run a post-commit hook to checkout to the sites directory.
  7. Develop and when you are ready to demonstrate to clients, coworkers etc. do a git push to ‘development’ / ‘production’ to see it on the live servers.

On that note, vagrant share is a really good way to temporarily demonstrate work before you push to your development and ultimately production servers.

With regards to email on DO boxes, I would recommend using Mandrill or MailGun for convenience.

I have a number of sites setup with DO in this way and it serves the purpose.

Is it the dream development workflow? Probably not and there are a few alternatives each with their advantages and disadvantages. You could go down the Capistrano route or use rsync to push out files. Capistrano is probably more robust and has roll back capabilities, rsync is simpler and quicker to setup.

My advice is to experiment with each system and refine the process to suit your needs. Good luck.

I work in a similar way to how you want to do it. (Plus points for Vagrant BTW, it’s the ONLY way to develop locally!)

This is how I do it though…

  1. Get your production and development boxes setup in exactly the same way. LEMP is my recommendation on LEB such as the $5 DO box. Get them hardened and locked down. There are loads of good articles on here explaining how to setup your server and then configure UFW and F2B.
  2. Create your vagrant build as similar to the development and production servers as you can though.
  3. Setup your local files for your app / website / blog etc.
  4. Add your files and vagrant build to a new Git repo.
  5. Push this out to bitbucket (Github alternative with free private repos)
  6. Set up bare git repo’s on your production and development servers that are configured to run a post-commit hook to checkout to the sites directory.
  7. Develop and when you are ready to demonstrate to clients, coworkers etc. do a git push to ‘development’ / ‘production’ to see it on the live servers.

On that note, vagrant share is a really good way to temporarily demonstrate work before you push to your development and ultimately production servers.

With regards to email on DO boxes, I would recommend using Mandrill or MailGun for convenience.

I have a number of sites setup with DO in this way and it serves the purpose.

Is it the dream development workflow? Probably not and there are a few alternatives each with their advantages and disadvantages. You could go down the Capistrano route or use rsync to push out files. Capistrano is probably more robust and has roll back capabilities, rsync is simpler and quicker to setup.

My advice is to experiment with each system and refine the process to suit your needs. Good luck.