-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
40 lines (31 loc) · 980 Bytes
/
deploy.sh
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
38
39
40
#!/bin/bash -e
if [ "$#" -gt 0 ]; then
stage="$1"
shift
apps="$@"
else
stage="$SSH_ORIGINAL_COMMAND"
apps=""
fi
(
if [ "$stage" == "" -o ! -d "/opt/beabee/$stage" ]; then
echo "Unrecognised stage: $stage"
exit 1
fi
echo "# Deploying stage $stage"
for app_path in $(find /opt/beabee/$stage -mindepth 2 -maxdepth 2 -name docker-compose.yml); do
app_dir=$(dirname $app_path)
app=${app_dir/\/opt\/beabee\/$stage\//}
if [[ $apps != "" && ! $apps =~ $app ]]; then
echo "## Ignoring $app"
continue
fi
echo "## Updating $app"
pushd $app_dir
date
/opt/beabee/update.sh
echo "## Finished updated $app"
popd
done
date
) 2>&1 | tee -a /var/log/deploy.log