-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease
executable file
·32 lines (26 loc) · 865 Bytes
/
release
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
#!/bin/bash
set -ex
if [ -z "$1" ]; then
echo 'hostname required'
exit 1
fi
release=${2:-full}
hostname="$1"
host="root@${hostname}"
if [[ "${release}" =~ full ]]; then
ssh ${host} "mkdir -p /yagg"
scp mix.* ${host}:/yagg
ssh ${host} "cd /yagg && mix do local.hex --force, local.rebar --force, deps.get, deps.compile"
scp yagg.service ${host}:/etc/systemd/system/
ssh ${host} "systemctl enable yagg"
fi
if [[ "${release}" =~ back|full ]]; then
scp -r lib ${host}:/yagg
ssh ${host} "cd /yagg && systemctl stop yagg && rm -rf ./build_ && MIX_ENV=prod mix release yagg"
ssh ${host} "chcon -Rv -u system_u -t bin_t /yagg/_build/prod/rel/yagg/bin/yagg && systemctl start yagg"
fi
if [[ "${release}" =~ front|full ]]; then
./febuild
echo '#errbutton { display: none }' >> build/board.css
rsync -az -e ssh build/* ${host}:/yagg/frontend
fi