forked from voidfiles/dokku-forego
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommands
More file actions
executable file
·69 lines (58 loc) · 1.69 KB
/
commands
File metadata and controls
executable file
·69 lines (58 loc) · 1.69 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
PLUGIN_DIR=$(dirname $0)
. "$PLUGIN_DIR/lib/helpers"
DOKKU_ROOT=${DOKKU_ROOT:-/home/dokku}
CACHE_DIR="$DOKKU_ROOT/.cache"
case "$1" in
scale)
if [[ -z $2 ]]; then
echo "Please specify an app to scale"
exit 1
fi
APP="$2"
IMAGE="dokku/$APP"
REPO="$DOKKU_ROOT/$APP"
if [ ! -d "$REPO" ]; then
echo "No matching app: $APP"
exit 1
fi
shift 2
SCALEFILE="$REPO/SCALE"
for line in "$@"
do
echo "$line"
done > "$SCALEFILE"
# kill the app when running
echo "Checking for existing running application"
if [[ -f "$DOKKU_ROOT/$APP/CONTAINER" ]]; then
echo "Existing running application found. Will kill it."
oldid=$(< "$DOKKU_ROOT/$APP/CONTAINER")
docker kill $oldid > /dev/null 2>&1 || true
echo "Killed running application."
fi
echo "Scaling app $APP:"
cat -n "$REPO/SCALE"
copy_to_container "$SCALEFILE" /SCALE
dokku deploy "$APP"
;;
forego:update)
update_forego $CACHE_DIR/forego
;;
forego:version)
echo -n "forego version: "
if [ -e $CACHE_DIR/forego ]; then
$CACHE_DIR/forego version
else
echo "forego binary not found in $CACHE_DIR/"
echo "You can run forego:update or re-release any container to install the latest forego binary."
fi
;;
help)
cat && cat<<EOF
scale <app> TYPE1=NUM1 [TYPE2=NUM2 ...] Scale an app
forego:update Update the forego binary. Changes take effect in containers on the next release.
forego:version Show the forego binary version
EOF
;;
esac