By rhombusone
Hi there,
One area of my workflow — like many — that is weak, is how I go from local to production. At the moment it’s dangerously messy.
I build offline, then go straight to my production droplet, create the SQL database and import and create my git hooks which pull straight into the live directory. I am really interested in finding out about using another droplet as a staging server but have yet to find a tutorial for it on Digital Ocean.
Is this something anyone fancies writing up? Seems like a missing area in the tutorial area. I can’t get my head around how the workflow would go using a staging server that keeps things from getting cluttered if you’re dealing with multiple sites. Mapping sub domains to folders seems like over time it could get massively cluttered. Is there any other options out there?
Need some advice on this
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
Following this tutorial by Justin you can setup a production server that uses git hooks for deployment based on commits to the master branch.
Repeating that process on another server (or the same one if you’re short on droplets) and changing the post-receive hook to watch for commits to the staging branch instead of master .
Lastly I would add a remote such as:
git remote add staging user@staging.website.com:repo
Automating the push from staging to master will depend greatly on your workflow, automated testing, code review and similar things specific to your repository / project.
For small projects and applications I add my automated tests to the post-receive hook, if all tests pass it will tell me in the response of git push staging <branch> so I can then merge to the master branch and push to production manually.
Additionally, commits against the hotfix branch on the staging server are automatically merged to master and pushed to production if all of the tests pass, if for any reason tests don’t pass on the production server it will revert back.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.