From ec8215424f13db9f535433ca3def24490add662b Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Tue, 5 May 2015 20:11:03 +0000 Subject: [PATCH] Fixes on deploy.sh --- TODO.md | 3 +++ orchestra/bin/orchestra-admin | 7 +++++-- orchestra/management/commands/setupnginx.py | 2 +- scripts/container/create.sh | 7 +++++-- scripts/container/deploy.sh | 13 ++++--------- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/TODO.md b/TODO.md index dc021233..e36e427b 100644 --- a/TODO.md +++ b/TODO.md @@ -377,3 +377,6 @@ try: import uwsgi to know its running uwsgi # rename virtual_maps to virtual_alias_maps and remove virtual_alias_domains ? # Message last_retry auto_now doesn't work! + + +# LOCK beat lockfile diff --git a/orchestra/bin/orchestra-admin b/orchestra/bin/orchestra-admin index 448b2718..a55e78a4 100755 --- a/orchestra/bin/orchestra-admin +++ b/orchestra/bin/orchestra-admin @@ -122,16 +122,19 @@ function install_requirements () { check_root || true ORCHESTRA_PATH=$(get_orchestra_dir) || true + # lxml: libxml2-dev, libxslt1-dev, zlib1g-dev APT="python3 \ python3-pip \ python3-dev \ libxml2-dev \ - bind9utils \ libxslt1-dev \ + zlib1g-dev \ + bind9utils \ wkhtmltopdf \ xvfb \ ca-certificates \ - gettext" + gettext \ + libcrack2-dev" # cracklib and lxml are excluded on the requirements because they are hard to build PIP="$(wget https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt -q -O - | tr '\n' ' ') \ diff --git a/orchestra/management/commands/setupnginx.py b/orchestra/management/commands/setupnginx.py index 1d3fb75c..7f4b39f3 100644 --- a/orchestra/management/commands/setupnginx.py +++ b/orchestra/management/commands/setupnginx.py @@ -4,7 +4,7 @@ from optparse import make_option from os.path import expanduser from django.conf import settings -from django.core.management.base import BaseCommand +from django.core.management.base import BaseCommand, CommandError from orchestra.utils import paths from orchestra.utils.sys import run, check_root, get_default_celeryd_username diff --git a/scripts/container/create.sh b/scripts/container/create.sh index 2fb1c7f6..ab366b0e 100755 --- a/scripts/container/create.sh +++ b/scripts/container/create.sh @@ -36,7 +36,6 @@ mount --bind /dev $CONTAINER/dev mount -t sysfs none $CONTAINER/sys - sed -i "s/\tlocalhost$/\tlocalhost $NAME/" $CONTAINER/etc/hosts sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" $CONTAINER/etc/locale.gen chroot $CONTAINER locale-gen @@ -49,5 +48,9 @@ chroot $CONTAINER apt-get clean sleep 0.1 -umount $CONTAINER/{dev,sys} +umount $CONTAINER/{dev,sys} || { + echo "Killing processes inside the container ..." + lsof | grep $CONTAINER | awk {'print $2'} | uniq | xargs kill + umount $CONTAINER/{dev,sys} +} trap - INT TERM EXIT diff --git a/scripts/container/deploy.sh b/scripts/container/deploy.sh index 1fb8c601..6cb59a1a 100755 --- a/scripts/container/deploy.sh +++ b/scripts/container/deploy.sh @@ -20,6 +20,7 @@ PASSWORD='orchestra' HOME="/home/$USER" PROJECT_NAME='panel' BASE_DIR="$HOME/$PROJECT_NAME" +MANAGE="$BASE_DIR/manage.py" PYTHON_BIN="python3" CELERY=false @@ -54,13 +55,6 @@ if [[ ! $CURRENT_VERSION ]]; then PYTHON_PATH=$($PYTHON_BIN -c "import sys; print([path for path in sys.path if path.startswith('/usr/local/lib/python')][0]);") echo $HOME/django-orchestra/ | sudo tee "$PYTHON_PATH/orchestra.pth" run "cp $HOME/django-orchestra/orchestra/bin/orchestra-admin /usr/local/bin/" -else - # Upgrade and relay on postguprade for finishing up the installation - surun "export GIT_DIR=~/django-orchestra/.git && git checkout master && git pull origin" - # TODO pass testing to postupgrade instead of running his here - sudo orchestra-admin install_requirements --testing - $PYTHON_BIN $MANAGE migrate postupgradeorchestra --from $CURRENT_VERSION - exit fi sudo orchestra-admin install_requirements --testing @@ -70,11 +64,12 @@ if [[ ! -e $BASE_DIR ]]; then surun "orchestra-admin startproject $PROJECT_NAME" cd - else - echo "$BASE_DIT already existis, doing nothing." + echo "$BASE_DIT already existis, doing postupgrade." + $PYTHON_BIN $MANAGE migrate postupgradeorchestra --from $CURRENT_VERSION fi -MANAGE="$BASE_DIR/manage.py" +run apt-get install postgres if [[ ! $(sudo su postgres -c "psql -lqt" | awk {'print $1'} | grep '^orchestra$') ]]; then # orchestra database does not esists # Speeding up tests, don't do this in production!