From 6b1b083c2e39e5551f0010e7038e5da49f636720 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Fri, 2 Oct 2015 12:31:58 +0000 Subject: [PATCH] Fixes on deployment --- scripts/containers/deploy.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/scripts/containers/deploy.sh b/scripts/containers/deploy.sh index 6f9b0471..ebfea772 100644 --- a/scripts/containers/deploy.sh +++ b/scripts/containers/deploy.sh @@ -10,7 +10,6 @@ function main () { echo " ${bold}\$ ${@}${normal}" ${@} } - surun_ () { echo " ${bold}\$ su $user -c \"${@}\"${normal}" su $user -c "${@}" @@ -32,7 +31,6 @@ function main () { } noinput='--noinput' alias run=surun_ - alias sudorun=run_ user=$2 elif [[ $# -eq 1 ]]; then if [[ $1 != '--noinput' ]]; then @@ -47,7 +45,6 @@ function main () { exit 1 } alias run=run_ - alias sudorun="run_ sudo" # Test sudo privileges sudo true fi @@ -90,35 +87,35 @@ function main () { done fi - sudorun pip3 install django-orchestra==dev \ + run sudo pip3 install django-orchestra==dev \ --allow-external django-orchestra \ --allow-unverified django-orchestra - sudorun orchestra-admin install_requirements + run sudo orchestra-admin install_requirements run cd $(eval echo ~$USER) run orchestra-admin startproject $project_name run cd $project_name - sudorun service postgresql start - sudorun python3 -W ignore manage.py setuppostgres $noinput + run sudo service postgresql start + run sudo python3 -W ignore manage.py setuppostgres $noinput run python3 -W ignore manage.py migrate if [[ "$task" == "celery" ]]; then - sudorun apt-get install rabbitmq-server - sudorun python3 -W ignore manage.py setupcelery --username $USER + 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 fi - sudorun python3 -W ignore manage.py setuplog --noinput + run sudo python3 -W ignore manage.py setuplog --noinput run python3 -W ignore manage.py collectstatic --noinput - sudorun apt-get install nginx-full uwsgi uwsgi-plugin-python3 - sudorun python3 -W ignore manage.py setupnginx --user $user $noinput - sudorun python3 -W ignore manage.py restartservices - sudorun python3 -W ignore manage.py startservices + 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 ip_addr=$(ip addr show eth0 | grep 'inet ' | sed -r "s/.*inet ([^\s]*).*/\1/" | cut -d'/' -f1)