Last active
December 19, 2015 13:49
-
-
Save speier/5964482 to your computer and use it in GitHub Desktop.
experimenting with git powered deployment
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
| 01. `sudo apt-get install git` | |
| 02. `adduser git` | |
| 03. `visudo` add `git ALL=(ALL:ALL) ALL` | |
| 04. `login git` | |
| 05. `ssh-keygen -t rsa` | |
| 06. `mkdir project` | |
| 07. `mkdir project.git` | |
| 08. `cd project.git` | |
| 09. `git init --bare` | |
| 10. `cd hooks` | |
| 11. `nano post-receive` (see contents below) | |
| 12. `chmod +x post-receive` | |
| 13. install node.js (https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) |
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 | |
| APP_TREE=/home/git/project | |
| GIT_WORK_TREE=$APP_TREE git checkout -f | |
| cd $APP_TREE | |
| npm install | |
| # we have a few private packages on github, without versioning, those needs to be installed by name | |
| # npm install xy-package | |
| restart project |
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
| `git remote remove heroku` | |
| `git remote add production [email protected]:project.git` | |
| `git push production master` |
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
| description "project daemon" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| chdir /home/git/project | |
| exec /usr/bin/node server.js > /var/log/project.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment