-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·107 lines (93 loc) · 3.26 KB
/
setup.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
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
#!/bin/bash
DUMPFILE=deploy/dumpdata.json
BASEDIR=$(dirname "${0}")
DC="docker-compose -f docker-compose.yml -f docker-compose.build.yml -f docker-compose.development.yml"
DC_BUILD="docker-compose -f docker-compose.yml -f docker-compose.build.yml -f docker-compose.images.yml"
DC_PROD="docker-compose -f docker-compose.yml -f docker-compose.images.yml -f docker-compose.production.yml"
DC_EXEC="${DC} exec django"
DC_EXEC_NO_TTY="${DC} exec -T django"
# copy your id_rsa into django container to have access via ssh for PyCharm's remote python interpretier
if ! test -f "${BASEDIR}/deploy/id_rsa.pub"; then
cp ~/.ssh/id_rsa.pub ${BASEDIR}/deploy/django/
fi
if test -z "${1}" ; then
${DC} build && ${DC} up
# else
# case ${1} in
# shell)
# ${DC_EXEC} /bin/bash
# ;;
# exec)
# ${DC_EXEC} /bin/bash -c "${@:2}"
# ;;
# test)
# ${DC_EXEC} /bin/bash -c "cd /code && ./runtests.sh ${@:2}"
# ;;
# flake)
# ${DC_EXEC} /bin/bash -c "cd /code && flake8 . ${@:2}"
# ;;
# log)
# ${DC_EXEC} /bin/bash -c "tail -n 100 -f /var/log/django.error.log"
# ;;
# clean_all)
# docker stop $(docker ps -a -q)
# docker rm $(docker ps -a -q)
# docker volume rm $(docker volume ls -q)
# ;;
# es_low)
# curl -XPUT localhost:8020/_cluster/settings -d '{
# "transient" : {
# "cluster.routing.allocation.disk.threshold_enabled" : false
# }
# }'
# ;;
# dump)
# set -e
# echo Dumping database...
# if ! test -z "${2}"; then
# echo Dumping database into ${2}
# DUMPFILE=${2}
# fi
# if test -f "${DUMPFILE}"; then
# echo "File ${DUMPFILE} exists, making backup copy."
# NOW=$(date +"%Y%m%d")
# bakfile="${DUMPFILE}.bak-${NOW}"
# cp ${DUMPFILE} ${bakfile}
# fi
# ${DC_EXEC_NO_TTY} /bin/bash -c "DEBUG=0 django-admin dumpdata \
# --natural-foreign \
# --natural-primary \
# --indent 4 \
# auth.user \
# flatpages \
# sites \
# zzzzz \
# > dumpdata.json.new"
# if test -z "`cat src/dumpdata.json.new`"; then
# echo ERROR DUMPING DATA, ABORTING...
# rm src/dumpdata.json.new
# else
# mv src/dumpdata.json.new ${DUMPFILE}
# fi
# ls -al ${DUMPFILE}
# echo Done.
# ;;
# load)
# cp ${DUMPFILE} src/tmp.json
# ${DC_EXEC_NO_TTY} /bin/bash -c "DEBUG=0 django-admin loaddata tmp.json"
# rm src/tmp.json
# ;;
# build)
# ${DC_BUILD} -f docker-compose.images.yml build
# ;;
# prod)
# ${DC_PROD} ${@:2}
# ;;
# push)
# ${DC_BUILD} -f docker-compose.images.yml push
# ;;
# *)
# ${DC} $@
# ;;
# esac
fi