-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
34 lines (25 loc) · 1.03 KB
/
init.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
#!/bin/sh
echo linking project directory...
sudo ln -sfn $(dirname $0)/web ~/web
# echo creating project structure...
# mkdir -p ~/web/{uploads,public}/
# mkdir -p ~/web/public/{img,js,css}/
echo linking configuration files...
sudo ln -sf ~/web/etc/nginx.conf /etc/nginx/sites-enabled/default
# sudo ln -sf ~/web/etc/hello.conf /etc/gunicorn.d/hello
sudo ln -sf ~/web/etc/ask.conf /etc/gunicorn.d/ask
echo updating django...
sudo pip uninstall django
sudo pip3 install django
echo restarting daemons...
sudo /etc/init.d/nginx restart
sudo /etc/init.d/gunicorn restart
sudo /etc/init.d/mysql restart
echo configuring mysql...
mysql -uroot -e "CREATE DATABASE IF NOT EXISTS ask_db;"
# mysql 5.7.6+
# mysql -uroot -e "CREATE USER IF NOT EXISTS 'ask_user'@'localhost' IDENTIFIED BY 'change_me';" #PASSWORD EXPIRE
# mysql -uroot -e "GRANT ALL ON ask_db.* TO 'ask_user'@'localhost';"
# mysql below 5.7.6
mysql -uroot -e "GRANT ALL ON ask_db.* TO 'ask_user'@'localhost' IDENTIFIED BY 'change_me';" #PASSWORD EXPIRE
mysql -uroot -e "FLUSH PRIVILEGES;"