Last active
December 14, 2015 08:39
-
-
Save nicerobot/5059378 to your computer and use it in GitHub Desktop.
Heroku-like
This file contains hidden or 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/bash | |
# http://www.readability.com/read?url=http://pynash.org/2013/02/25/Heroku-Like-Deploys-on-AWS.html | |
# http://stackoverflow.com/questions/5009324/node-js-nginx-and-now | |
app=${1:-app${RANDOM}} | |
cd | |
# TODO provision | |
sudo apt-get install nginx nodejs | |
mkdir -p git/${app}.git ${app} || exit ${LINENO} | |
( | |
cd git/${app}.git/hooks | |
curl -ksO [this]/post-receive | |
chmod +x post-receive | |
) | |
# TODO modify nginx /etc/nginx/sites-available/default | |
sudo services nginx restart | |
cd ${app} | |
./app.sh |
This file contains hidden or 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
upstream app_yourdomain { | |
server 127.0.0.1:3000; | |
} | |
server { | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://app_yourdomain/; | |
proxy_redirect off; | |
} | |
} |
This file contains hidden or 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 | |
#GIT_WORK_TREE=${HOME}/$(basename ${PWD} .git) git checkout -f | |
GIT_WORK_TREE=${HOME}/$(basename ${PWD} .git) git pull |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment