From 84e9f442213bfef7d910259a9a6e71232d7a57a4 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Fri, 2 Oct 2015 11:36:24 +0000 Subject: [PATCH] Fixes on deployment --- orchestra/management/commands/setuppostgres.py | 2 +- scripts/containers/Dockerfile | 1 + scripts/containers/deploy.sh | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/orchestra/management/commands/setuppostgres.py b/orchestra/management/commands/setuppostgres.py index edb352cd..ec0d1dc7 100644 --- a/orchestra/management/commands/setuppostgres.py +++ b/orchestra/management/commands/setuppostgres.py @@ -48,7 +48,7 @@ class Command(BaseCommand): help = 'Setup PostgreSQL database.' def run_postgres(self, cmd, *args, **kwargs): - return run('su postgres -c "psql -c \\"%s\\""' % cmd, *args, display=True, **kwargs) + return run('su postgres -c "psql -c \\"%s\\""' % cmd, *args, **kwargs) @check_root def handle(self, *args, **options): diff --git a/scripts/containers/Dockerfile b/scripts/containers/Dockerfile index a2bc2a2d..39b0fef0 100644 --- a/scripts/containers/Dockerfile +++ b/scripts/containers/Dockerfile @@ -8,6 +8,7 @@ RUN apt-get -y update && apt-get install -y \ python3-pip \ wget \ curl \ + net-tools \ dnsutils \ rsyslog \ nano \ diff --git a/scripts/containers/deploy.sh b/scripts/containers/deploy.sh index 5bdda79a..5bfea82f 100644 --- a/scripts/containers/deploy.sh +++ b/scripts/containers/deploy.sh @@ -18,7 +18,10 @@ function main () { echo " ${bold}\$ ${@}${normal}" ${@} } - + + # Test sudo privileges + sudo true + while true; do read -p "Enter a project name [panel]: " project_name if [[ "$project_name" == "" ]]; then @@ -37,7 +40,6 @@ function main () { done # TODO detect if already installed and don't ask stupid question - # TODO setupceleryd shoudl change orchestra_start/stop/restart_services while true; do read -p "Do you want to use celery or cronbeat (orchestra.contrib.tasks) for task execution [cronbeat]? " task @@ -77,6 +79,17 @@ function main () { run sudo apt-get install nginx-full uwsgi uwsgi-plugin-python3 run sudo python3 -W ignore manage.py setupnginx --user $USER run sudo python3 -W ignore manage.py restartservices + run sudo python3 -W ignore manage.py startservices + + ip_addr=$(ip addr show eth0 | grep 'inet ' | sed -r "s/.*inet ([^\s]*).*/\1/" | cut -d'/' -f1) + if [[ $ip_addr == '' ]]; then + ip_addr=127.0.0.1 + fi + if curl https://$ip_addr/admin/ -I -k -s | grep 'HTTP/1.1 302 FOUND'; then + echo -e "${bold}Orchestra appears to be working at https://${ip_addr}/admin/${normal}\n" + else + echo -e "${bold}Err. Orchestra is not responding at https://${ip_addr}/admin/${normal}\n" >&2 + fi run python3 -W ignore manage.py check --deploy }