Created
September 6, 2014 18:13
-
-
Save jasonrhodes/a879bf384c521c1a9c67 to your computer and use it in GitHub Desktop.
My git post-receive hook for Digital Ocean -- I make a bare repo in /var/repos/{reponame}/app.git and then add this code to the post-receive hook in app.git/hooks then set up a remote via ssh to the app.git folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Store git files in a different directory than the repo | |
git --work-tree=/var/www/meatspace-markov-memeify --git-dir=/var/repos/meatspace-markov-memeify/app.git checkout -f | |
# Install npm deps | |
cd /var/www/meatspace-markov-memeify && npm install | |
# If index.js is running, restart--otherwise start! | |
forever restart --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/index.js --port=8000 || forever start --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/index.js --port=8000 | |
# If listen.js is running, restart--otherwise start! | |
forever restart --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/listen.js || forever start --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/listen.js |
What is your development/deployment workflow with digitalocean apps like this? Do you develop locally and then push to a development server (on port 3000) for test features and only conditionally push up to a production server? Would love some insight into this, any articles, personal experience greatly appreciated. Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Starting to think I should keep the forever stuff written in my repo so i can edit it and push changes. Hmm yeah prolly.