-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Automatic deployer script | ||
# This script is meant to be run on solar.coala.io! | ||
|
||
WORKDIR=/opt/solar | ||
|
||
log() { | ||
echo "$(date -u "+%b %Y %T") $USER: $*" | ||
} | ||
|
||
fail() { | ||
log "FAIL: $*" | ||
exit 1 | ||
} | ||
|
||
update_service() { | ||
directory=$1 | ||
name=$(basename $directory) | ||
|
||
pushd $directory | ||
|
||
log "Updating $name ..." | ||
|
||
docker-compose up --force-recreate --build -d | ||
|
||
if [ $? -ne 0 ]; then | ||
log "An error has occured while updating $name!" | ||
fi | ||
|
||
popd | ||
} | ||
|
||
update_services() { | ||
for service in "$@"; do | ||
update_service $service | ||
done | ||
} | ||
|
||
log "Starting Automated Deployment ..." | ||
|
||
cd $WORKDIR || fail "Working directory doesn't exist" | ||
|
||
log "Pulling changes ..." | ||
git pull || fail "An error has occured while pulling updates" | ||
|
||
log "Retrieving services ..." | ||
|
||
services=$(find $WORK_DIR -maxdepth 2 -name "docker-compose.yml" -printf "%h\n") | ||
services_len=$(echo "$services" | wc -l) | ||
|
||
log "Found $services_len services, here's a list of them: " | ||
|
||
for service in $services; do | ||
log " * $(basename $service)" | ||
done | ||
|
||
log "Updating services ..." | ||
|
||
update_services $services | ||
|
||
log "Deployment finished! Have a nice day!" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
-----BEGIN PGP MESSAGE----- |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| ||
eqFF8OoEH+AT1MDmYWmZIWi8zAfvOXnAcEIStbugE1lL | ||
=uiUy | ||
-----END PGP MESSAGE----- |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
decrypt: | ||
magic_key: "repo/.ci/magic_key.asc" | ||
merge: | ||
fast-forward: only | ||
script: echo "Nothing to do." | ||
deploy: | ||
script: | ||
- eval "$(ssh-agent -s)" | ||
- chmod 600 ../magic_key | ||
- ssh-add ../magic_key | ||
- ssh [email protected] "bash -s" < ./repo/.ci/deploy.sh |