forked from dokku-alt/dokku-alt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands
More file actions
executable file
·119 lines (97 loc) · 2.58 KB
/
commands
File metadata and controls
executable file
·119 lines (97 loc) · 2.58 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
source "$(dirname $0)/../dokku_common"
case "$1" in
apps)
echo "=== My Apps"
find $DOKKU_ROOT -follow -maxdepth 1 -type d \( ! -iname ".*" \) -not -path $DOKKU_ROOT/tls | sed 's|^\./||g' | sed 's|'$DOKKU_ROOT'\/||' | tail -n +2 | sort
;;
apps:list|list)
verify_max_args 1 "$@"
for app in $(ls -d $DOKKU_ROOT/*/ 2>/dev/null); do
if [[ -f "$app/refs/heads/master" ]]; then
basename "$app"
fi
done
;;
apps:status|status)
verify_app_name "$2"
verify_max_args 2 "$@"
if [ $(docker inspect --format="{{ .State.Running }}" "$APP_NAME") = "true" ]; then
echo "$APP is running."
else
echo "$APP is stopped."
fi
;;
apps:start|start)
verify_app_name "$2"
verify_max_args 2 "$@"
docker start "$APP_NAME"
;;
apps:stop|stop)
verify_app_name "$2"
verify_max_args 2 "$@"
docker stop "$APP_NAME"
;;
apps:disable|disable)
verify_app_name "$2"
verify_max_args 2 "$@"
if [[ ! -f "$APP_DIR/DISABLED" ]]; then
touch "$APP_DIR/DISABLED"
deploy_app "$APP"
else
echo "$APP: Application is already disabled"
fi
;;
apps:enable|enable)
verify_app_name "$2"
verify_max_args 2 "$@"
if [[ -f "$APP_DIR/DISABLED" ]]; then
rm -f "$APP_DIR/DISABLED"
deploy_app "$APP"
else
echo "$APP: Application is already enabled"
fi
;;
apps:restart|restart)
verify_app_name "$2"
verify_max_args 2 "$@"
deploy_app "$APP"
;;
apps:top|top)
verify_app_name "$2"
verify_max_args 2 "$@"
shift 2
docker top "$APP_NAME"
;;
apps:destroy|delete)
verify_app_name "$2"
if [[ ! -d "$APP_DIR" ]]; then
echo "App does not exist"
exit 1
fi
[[ "$APP" == "tls" ]] && fail "Unable to destroy tls directory"
[[ "$APP" == "ssl" ]] && fail "Unable to destroy tls directory"
info "Deleting application $APP..."
pluginhook pre-delete $APP
stop_and_remove_app_containers
stop_and_remove_container $APP_PERSISTENT_NAMES
remove_image "$IMAGE"
pluginhook post-delete $APP
info "Application deleted: $APP"
;;
help)
cat && cat<<EOF
list List app
status <app> Status of specific app
start <app> Stop specific app
stop <app> Stop specific app
restart <app> Restart specific app (not-redeploy)
enable <app> Re-enable specific app
disable <app> Disable specific app
top <app> [args...] Show running processes
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac