forked from spitfire-sidra/mazu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_mazu.sh
executable file
·55 lines (38 loc) · 1.3 KB
/
deploy_mazu.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
#!/bin/bash
set -e
#set -x
# color flag
RED='\e[0;31m'
YEL='\e[1;33m'
GRN='\e[1;32m'
NC='\e[0m'
#
ROOT_UID=0
E_ROOT=1
clear
echo -e "${RED}-= Mazu installation =-${NC}"
echo "==> Here we go..."
# check if whoami = root
if [ "$UID" == "$ROOT_UID" ]; then
echo "Must NOT be root ro run this script"
exit $E_ROOT
fi
# install PREREQUISITES
echo " > Installing PREREQUISITES..."
echo " > Updating package soruce..."
sudo apt-get update &> /dev/null
echo " > Installing python-dev libxml2-dev libxslt-dev..."
sudo apt-get -y install python-dev libxml2-dev libxslt-dev mongodb&> /dev/null
echo " > Installing packages in requirements..."
sudo pip install -r requirements.txt &> /dev/null
# rename to production.py
cp settings/production.example.py settings/production.py
echo " > Generating production key..."
PRO_GEN=$(/usr/bin/python -c 'import random; print "".join([random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyz0123456789\\#/$%@!&^*()<>?[]{}") for i in range(50)])')
# replace key in settings/production.py
sed -i "s|yoursecretkey|$PRO_GEN|g" settings/production.py
echo " > syncdb..."
./manage.py syncdb
#./manage.py createsuperuser
echo -e " > Your key is ${YEL}$PRO_GEN${NC}. And is now using in settings/production.py"
echo -e "${GRN}-= Great, now you're all set to go! =-${NC}"