-
Notifications
You must be signed in to change notification settings - Fork 14
/
container-startup
executable file
·73 lines (70 loc) · 1.67 KB
/
container-startup
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
#!/bin/sh
# Startup helper for pcw. This file makes the handling with pcw within containers easier
# See usage() for a usage summary
CMD=$1
shift
usage() {
echo "pcw startup helper"
echo "Usage: $0 COMMAND"
echo "COMMANDS:"
echo " help Print help message"
echo " check Run system health checks"
echo " run Standart publiccloud-watcher run procedure"
echo " migrate Run database migration"
echo " createuser USER PASS Create user"
echo " updaterun Do a regular instance scan and persist results to local DB"
echo " cleanup Cleanup old resources from providers"
echo " rmclusters Scan whole AWS account and delete ANY EKS clusters"
echo ""
echo "All other commands will be passed as arguments to 'manage.py'"
}
case "$CMD" in
"")
usage
exit 1
;;
"help")
usage
exit 0
;;
"-h")
usage
exit 0
;;
"--help")
usage
exit 0
;;
"run")
python3 manage.py migrate
uwsgi --enable-threads -L --http-socket 0.0.0.0:8000 --plugins python3 --module webui.wsgi --static-map /static=/pcw/ocw/static
;;
"check")
python3 manage.py check
;;
"migrate")
python3 manage.py migrate
;;
"createuser")
if [ "$#" -ne 2 ] ; then
usage
exit 1
fi
python3 manage.py shell -c "from django.contrib.auth.models import User; user = User.objects.create_user('$1', password='$2'); user.save()"
echo "$PASSWORD"
;;
"updaterun")
python3 manage.py updaterun
;;
"cleanup")
python3 manage.py cleanup
;;
"rmclusters")
python3 manage.py rmclusters
;;
"dumpstate")
python3 manage.py dumpstate
;;
*)
python3 manage.py "$@"
esac