Last active
March 8, 2023 18:08
-
-
Save 1mike12/1dc54ded1a399fbd150e5ecc151ea528 to your computer and use it in GitHub Desktop.
Revisions
-
1mike12 revised this gist
Feb 10, 2019 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash TRAGET="/var/www/project" SERVER="/var/www/project/server" CLIENT="/var/www/project/reactcode" GIT_DIR="/var/repos/project.git" BRANCH="master" @@ -12,9 +12,13 @@ do then echo "Ref $ref received. Deploying ${BRANCH} branch to production..." git --work-tree=$TRAGET --git-dir=$GIT_DIR checkout -f echo "installing react modules" cd $CLIENT npm install echo "building client" npm run build cd $SERVER echo "installing server modules" npm install echo "Running knex migration" npx knex migrate:latest -
1mike12 revised this gist
Feb 10, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ 2. `cd project.git && git init --bare` 3. `cd project.git/hooks && touch post-receive` 4. copy paste post-receive script 5. make executable `chmod +x post-receive` ### local `git remote add production [email protected]:/var/www/project.git` -
1mike12 revised this gist
Feb 10, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,5 +5,6 @@ 4. copy paste post-receive script ### local `git remote add production [email protected]:/var/www/project.git` `git push production` -
1mike12 revised this gist
Feb 10, 2019 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,9 @@ ### server 1. make a `project/` directory and `project.git/` directory 2. `cd project.git && git init --bare` 3. `cd project.git/hooks && touch post-receive` 4. copy paste post-receive script ### local `git remote add production [email protected]:/var/www/project.git` `git push production` -
1mike12 revised this gist
Feb 10, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ### server 1. make a project/ directory and project.git/ directory 2. cd project.git && git init --bare 3. go into project.git/hooks and create post-receive ### local -
1mike12 revised this gist
Feb 10, 2019 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ #!/bin/bash TRAGET="/var/www/project" SERVER="/var/www/project/server" CLIENT="/var/www/project/react" GIT_DIR="/var/repos/project.git" BRANCH="master" while read oldrev newrev ref @@ -12,8 +12,10 @@ do then echo "Ref $ref received. Deploying ${BRANCH} branch to production..." git --work-tree=$TRAGET --git-dir=$GIT_DIR checkout -f cd $CLIENT npm install cd $SERVER npm install echo "Running knex migration" npx knex migrate:latest echo "restarting PM2" -
1mike12 renamed this gist
Oct 3, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
1mike12 revised this gist
Aug 23, 2018 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ### server 1. make a project and project.git folder and project/ folder 2. git init --bare in project.git 3. go into project.git/hooks and create post-receive ### local git remote add production [email protected]:/var/www/project.git -
1mike12 revised this gist
Aug 23, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ### server make a project and project.git folder and project/ folder git init --bare in project.git go into project.git/hooks and create post-receive -
1mike12 revised this gist
Jul 28, 2018 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ ### server make a project and project.git folder git init --bare in project.git go into project.git/hooks and create post-receive ### local git remote add production [email protected]:/var/www/project.git git push production -
1mike12 created this gist
Jul 28, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/bin/bash TRAGET="/var/www/tickers" SERVER="/var/www/tickers/server" CLIENT="/var/www/tickers/react" GIT_DIR="/var/www/tickers.git" BRANCH="master" while read oldrev newrev ref do # only checking out the master (or whatever branch you would like to deploy) if [[ $ref = refs/heads/$BRANCH ]]; then echo "Ref $ref received. Deploying ${BRANCH} branch to production..." git --work-tree=$TRAGET --git-dir=$GIT_DIR checkout -f cd $SERVER yarn install echo "Running knex migration" npx knex migrate:latest echo "restarting PM2" pm2 restart server else echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server." fi done