Fixes on deployment

This commit is contained in:
Marc Aymerich 2015-10-02 12:35:37 +00:00
parent 6b1b083c2e
commit d05a74ca88
1 changed files with 10 additions and 8 deletions

View File

@ -30,7 +30,8 @@ function main () {
exit 1 exit 1
} }
noinput='--noinput' noinput='--noinput'
alias run=surun_ alias run=run_
alias surun=su_run
user=$2 user=$2
elif [[ $# -eq 1 ]]; then elif [[ $# -eq 1 ]]; then
if [[ $1 != '--noinput' ]]; then if [[ $1 != '--noinput' ]]; then
@ -45,6 +46,7 @@ function main () {
exit 1 exit 1
} }
alias run=run_ alias run=run_
alias surun=surun_
# Test sudo privileges # Test sudo privileges
sudo true sudo true
fi fi
@ -93,30 +95,30 @@ function main () {
run sudo orchestra-admin install_requirements run sudo orchestra-admin install_requirements
run cd $(eval echo ~$USER) run cd $(eval echo ~$USER)
run orchestra-admin startproject $project_name surun orchestra-admin startproject $project_name
run cd $project_name surun cd $project_name
run sudo service postgresql start run sudo service postgresql start
run sudo python3 -W ignore manage.py setuppostgres $noinput run sudo python3 -W ignore manage.py setuppostgres $noinput
run python3 -W ignore manage.py migrate surun python3 -W ignore manage.py migrate
if [[ "$task" == "celery" ]]; then if [[ "$task" == "celery" ]]; then
run sudo apt-get install rabbitmq-server run sudo apt-get install rabbitmq-server
run sudo python3 -W ignore manage.py setupcelery --username $USER run sudo python3 -W ignore manage.py setupcelery --username $USER
else else
run python3 -W ignore manage.py setupcronbeat surun python3 -W ignore manage.py setupcronbeat
run python3 -W ignore manage.py syncperiodictasks surun python3 -W ignore manage.py syncperiodictasks
fi fi
run sudo python3 -W ignore manage.py setuplog --noinput run sudo python3 -W ignore manage.py setuplog --noinput
run python3 -W ignore manage.py collectstatic --noinput surun python3 -W ignore manage.py collectstatic --noinput
run sudo apt-get install nginx-full uwsgi uwsgi-plugin-python3 run sudo apt-get install nginx-full uwsgi uwsgi-plugin-python3
run sudo python3 -W ignore manage.py setupnginx --user $user $noinput run sudo python3 -W ignore manage.py setupnginx --user $user $noinput
run sudo python3 -W ignore manage.py restartservices run sudo python3 -W ignore manage.py restartservices
run sudo python3 -W ignore manage.py startservices run sudo python3 -W ignore manage.py startservices
run python3 -W ignore manage.py check --deploy surun python3 -W ignore manage.py check --deploy
ip_addr=$(ip addr show eth0 | grep 'inet ' | sed -r "s/.*inet ([^\s]*).*/\1/" | cut -d'/' -f1) ip_addr=$(ip addr show eth0 | grep 'inet ' | sed -r "s/.*inet ([^\s]*).*/\1/" | cut -d'/' -f1)
if [[ $ip_addr == '' ]]; then if [[ $ip_addr == '' ]]; then