Fixes on deploy.sh

This commit is contained in:
Marc Aymerich 2015-05-05 20:11:03 +00:00
parent 02df629476
commit ec8215424f
5 changed files with 18 additions and 14 deletions

View File

@ -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

View File

@ -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' ' ') \

View File

@ -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

View File

@ -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} || {
echo "Killing processes inside the container ..."
lsof | grep $CONTAINER | awk {'print $2'} | uniq | xargs kill
umount $CONTAINER/{dev,sys}
}
trap - INT TERM EXIT

View File

@ -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!