-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy
executable file
·28 lines (23 loc) · 1.12 KB
/
deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash -ex
BRANCH=${BRANCH:="master"}
TARGET_SERVER=${TARGET_SERVER:="staging"}
mix edeliver build release --branch=$BRANCH --verbose
mix edeliver deploy release to $TARGET_SERVER --verbose
# Restarting the app through edeliver:
# `mix edeliver restart $TARGET_SERVER --verbose`
# It does not use systemd for restarting the app process. It seems it executes more or less this on the server:
# `/home/phoenix/phoenix_website/bin/phoenix_website stop && /home/phoenix/phoenix_website/bin/phoenix_website start`
#
# We want to restart the app through systemd. So, we do not use edevliver for restarting the app.
# Probably it would be good to find a better solution that uses edeliver for this task, so we wouldn't need to hardcode
# the hosts here.
case "$TARGET_SERVER" in
"staging") HOST="phoenix-website-staging.lunarlogic.io" ;;
"production") HOST="phoenix-website.lunarlogic.io" ;;
*) exit 1
esac
# It's username where the app is deployed.
# It's configured in Ansible playbooks apps/phoenix-website/playbook.yml
USERNAME=phoenix
./${BASH_SOURCE%/*}/restart $USERNAME $HOST
mix edeliver migrate $TARGET_SERVER up --verbose