forked from djbook-ru/djbookru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·58 lines (47 loc) · 1.36 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
source ./.production
export DBHOST DBNAME DBUSER DBPASS
BUILD=./build
SRC=${BUILD}/src
mkdir -p ${BUILD}
./po_compile.sh
cd src; django-admin.py compilemessages; cd -
cp -r ./addon ./lib ./reqs ./src ./manage.py ./logs ${BUILD}
rm -rf ${SRC}/{legacy,public,search/{whoosh,xapian}_index,local_settings.py,*sqlite}
rm -rf ${BUILD}/logs/*
mv ${SRC}/prod_settings.py ${SRC}/local_settings.py
find ${BUILD} -type f \
-name '*.py' \
-and ! -name 'wsgi.py' \
-and ! -wholename '*/migrations/*.py' \
-and ! -wholename '*/commands/*.py' \
-exec py_compilefiles {} \; \
-delete
find ${SRC} -type f -name '*.po' -delete
echo "Rsync project with ${USER}@${HOST}:${CODE_DIR}"
rsync --stats --archive --recursive --update ${BUILD}/* ${USER}@${HOST}:${CODE_DIR}/
FAB="fab production deploy_server"
DELIM=":"
for param in $@; do
if test 'migrate' = ${param}; then
FAB="${FAB}${DELIM}migrate=True"
DELIM=","
fi
if test 'static' = ${param}; then
FAB="${FAB}${DELIM}static=True"
DELIM=","
fi
if test 'i18n' = ${param}; then
FAB="${FAB}${DELIM}i18n=True"
DELIM=","
fi
if test 'haystack' = ${param}; then
FAB="${FAB}${DELIM}haystack=True"
DELIM=","
fi
if test 'noapply' = ${param}; then
FAB="${FAB}${DELIM}touch=False"
DELIM=","
fi
done
${FAB}
rm -rf ${BUILD}