From d05a74ca88c30b429d96869cb5cef6fc4e9176a0 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Fri, 2 Oct 2015 12:35:37 +0000 Subject: [PATCH] Fixes on deployment --- scripts/containers/deploy.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/containers/deploy.sh b/scripts/containers/deploy.sh index ebfea772..9b5bd33c 100644 --- a/scripts/containers/deploy.sh +++ b/scripts/containers/deploy.sh @@ -30,7 +30,8 @@ function main () { exit 1 } noinput='--noinput' - alias run=surun_ + alias run=run_ + alias surun=su_run user=$2 elif [[ $# -eq 1 ]]; then if [[ $1 != '--noinput' ]]; then @@ -45,6 +46,7 @@ function main () { exit 1 } alias run=run_ + alias surun=surun_ # Test sudo privileges sudo true fi @@ -93,30 +95,30 @@ function main () { run sudo orchestra-admin install_requirements run cd $(eval echo ~$USER) - run orchestra-admin startproject $project_name - run cd $project_name + surun orchestra-admin startproject $project_name + surun cd $project_name run sudo service postgresql start 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 run sudo apt-get install rabbitmq-server run sudo python3 -W ignore manage.py setupcelery --username $USER else - run python3 -W ignore manage.py setupcronbeat - run python3 -W ignore manage.py syncperiodictasks + surun python3 -W ignore manage.py setupcronbeat + surun python3 -W ignore manage.py syncperiodictasks fi 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 python3 -W ignore manage.py setupnginx --user $user $noinput run sudo python3 -W ignore manage.py restartservices 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) if [[ $ip_addr == '' ]]; then