-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_and_run.sh.sample
37 lines (28 loc) · 1.1 KB
/
setup_and_run.sh.sample
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
29
30
31
32
33
34
35
36
37
#!/bin/sh
echo "Stop running daemon"
_build/prod/rel/sportfest/bin/sportfest stop || echo "No running instance"
echo "Refreshing code base"
sudo git fetch
sudo git reset --hard HEAD
sudo git merge origin/main
echo "Setting environment variables"
export SECRET_KEY_BASE=SICHERES_PASSWORT
export DATABASE_URL=ecto://postgres:postgres@localhost/sportfest_prod
export PHX_HOST=HOSTNAME_ODER_LOCALHOST
export PORT=4001
echo "Loading dependencies to compile code and assets"
# initial setup
mix deps.get --only prod
MIX_ENV=prod mix compile
# compile assets
MIX_ENV=prod mix assets.deploy
echo "Building release"
MIX_ENV=prod mix release --overwrite
echo "Running migrations"
_build/prod/rel/sportfest/bin/sportfest eval "Sportfest.Release.migrate"
# helper function to create admin, moderator and user accounts if needed
_build/prod/rel/sportfest/bin/sportfest eval "Sportfest.Release.maybe_create_accounts"
# helper function to reset admin, moderator and user accounts
#_build/prod/rel/sportfest/bin/sportfest eval "Sportfest.Release.reset_accounts"
echo "Running app as daemon"
_build/prod/rel/sportfest/bin/sportfest daemon