Last active
November 26, 2015 11:11
-
-
Save rashkur/5e958547f5f1e56c2c03 to your computer and use it in GitHub Desktop.
update remote nginx configs from gitlab hook
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
... | |
if repo_path.include? "YOUR_REPO.git" | |
system('/some/path/update-front.sh') | |
end | |
... |
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
... | |
rem_user ALL = NOPASSWD: /etc/init.d/openresty reload |
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/bash | |
HOME_DIR="/some/path" | |
CMD_LINE="cd /etc/nginx && git pull && sudo /etc/init.d/openresty reload" | |
SERVER_LIST=(front1.example.com front2.example.com front3.example.com front4.example.com) | |
REMOTE_USER="rem_user" | |
KEY_FILE="$HOME_DIR/id_rsa" | |
echo "Got new commit at $(TZ='Europe/Kiev' date +'%Y/%d/%m %H:%M:%S')" >> $HOME_DIR/update_front.log | |
for SERVER in "${SERVER_LIST[@]}" ; do ssh -o StrictHostKeyChecking=no -i "$KEY_FILE" -t -t "$REMOTE_USER"@"$SERVER" "$CMD_LINE" ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment