deploy.sh: make sure git is installed

This commit is contained in:
Marc 2014-10-04 17:40:13 +00:00
parent fde29e4ddd
commit abe54be58b
7 changed files with 39 additions and 35 deletions

View file

@ -37,8 +37,7 @@ If you are planing to do some development or perhaps just checking out this proj
```bash
wget -O /tmp/create.sh \
https://raw2.github.com/glic3rinu/django-orchestra/master/scripts/container/create.sh
chmod +x /tmp/create.sh
sudo /tmp/create.sh
sudo bash /tmp/create.sh
sudo lxc-start -n orchestra
```
@ -46,9 +45,8 @@ If you are planing to do some development or perhaps just checking out this proj
```bash
wget -O /tmp/deploy.sh \
https://raw2.github.com/glic3rinu/django-orchestra/master/scripts/container/deploy.sh
chmod +x /tmp/deploy.sh
cd /tmp/ # Moving away from /root before running deploy.sh
/tmp/deploy.sh
bash /tmp/deploy.sh
```
Django-orchestra source code should be now under `~orchestra/django-orchestra` and an Orchestra instance called _panel_ under `~orchestra/panel`

View file

@ -162,4 +162,4 @@ APPS app?
* interdependency user <-> account with the old usermodel
* replace running_syncdb() by db_ready()
* pip upgrade or install

View file

@ -170,6 +170,9 @@ class SystemUserMixin(object):
# TODO
# TODO test resources
class RESTSystemUserMixin(SystemUserMixin):
def setUp(self):
super(RESTSystemUserMixin, self).setUp()

View file

@ -144,7 +144,6 @@ function install_requirements () {
kombu==3.0.23 \
billiard==3.3.0.18 \
Markdown==2.4 \
django-debug-toolbar==1.2.1 \
djangorestframework==2.3.14 \
paramiko==1.15.1 \
ecdsa==0.11 \
@ -153,7 +152,6 @@ function install_requirements () {
passlib==1.6.2 \
jsonfield==0.9.22 \
lxml==3.3.5 \
django-nose==1.2 \
python-dateutil==2.2 \
django-iban==0.3.0"
@ -165,7 +163,10 @@ function install_requirements () {
xvfbwrapper \
freezegun \
coverage \
orchestra-orm==dev"
orchestra-orm==dev \
django-debug-toolbar==1.2.1 \
django-nose==1.2 \
sqlparse"
fi
# Make sure locales are in place before installing postgres

View file

@ -253,6 +253,3 @@ PASSLIB_CONFIG = (
"superuser__django_pbkdf2_sha256__default_rounds = 15000\n"
"superuser__sha512_crypt__default_rounds = 120000\n"
)
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

View file

@ -18,3 +18,6 @@ if "celeryd" in sys.argv or 'celeryev' in sys.argv or 'celerybeat' in sys.argv:
INSTALLED_APPS += ('debug_toolbar', )
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
INTERNAL_IPS = ('127.0.0.1', '10.0.3.1',) #10.0.3.1 is the lxcbr0 ip
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

View file

@ -22,35 +22,40 @@ PROJECT_NAME='panel'
BASE_DIR="$HOME/$PROJECT_NAME"
run () {
surun () {
echo " ${bold}\$ su $USER -c \"${@}\"${normal}"
su $USER -c "${@}"
}
run () {
echo " ${bold}\$ ${@}${normal}"
${@}
}
# Create a system user for running Orchestra
useradd orchestra -s "/bin/bash"
echo "$USER:$PASSWORD" | chpasswd
mkdir $HOME
chown $USER.$USER $HOME
sudo adduser $USER sudo
run adduser $USER sudo
CURRENT_VERSION=$(python -c "from orchestra import get_version; print get_version();" 2> /dev/null || false)
if [[ ! $CURRENT_VERSION ]]; then
# First Orchestra installation
sudo apt-get -y install git python-pip
run "git clone https://github.com/glic3rinu/django-orchestra.git ~/django-orchestra"
run "apt-get -y install git python-pip"
surun "git clone https://github.com/glic3rinu/django-orchestra.git ~/django-orchestra"
echo $HOME/django-orchestra/ | sudo tee /usr/local/lib/python2.7/dist-packages/orchestra.pth
sudo cp $HOME/django-orchestra/orchestra/bin/orchestra-admin /usr/local/bin/
run "cp $HOME/django-orchestra/orchestra/bin/orchestra-admin /usr/local/bin/"
fi
sudo orchestra-admin install_requirements
if [[ ! -e $BASE_DIR ]]; then
cd $HOME
run "orchestra-admin startproject $PROJECT_NAME"
surun "orchestra-admin startproject $PROJECT_NAME"
cd -
fi
@ -60,46 +65,43 @@ if [[ ! $(sudo su postgres -c "psql -lqt" | awk {'print $1'} | grep '^orchestra$
# orchestra database does not esists
# Speeding up tests, don't do this in production!
POSTGRES_VERSION=$(psql --version | head -n1 | awk {'print $3'} | sed -r "s/(^[0-9\.]*).*/\1/")
sudo sed -i "s/^#fsync =\s*.*/fsync = off/" \
sed -i "s/^#fsync =\s*.*/fsync = off/" \
/etc/postgresql/${POSTGRES_VERSION}/main/postgresql.conf
sudo sed -i "s/^#full_page_writes =\s*.*/full_page_writes = off/" \
sed -i "s/^#full_page_writes =\s*.*/full_page_writes = off/" \
/etc/postgresql/${POSTGRES_VERSION}/main/postgresql.conf
sudo service postgresql restart
sudo python $MANAGE setuppostgres --db_name orchestra --db_user orchestra --db_password orchestra
run "service postgresql restart"
run "python $MANAGE setuppostgres --db_name orchestra --db_user orchestra --db_password orchestra"
# Create database permissions are needed for running tests
sudo su postgres -c 'psql -c "ALTER USER orchestra CREATEDB;"'
fi
if [[ $CURRENT_VERSION ]]; then
# Per version upgrade specific operations
sudo python $MANAGE postupgradeorchestra --no-restart --from $CURRENT_VERSION
run "python $MANAGE postupgradeorchestra --no-restart --from $CURRENT_VERSION"
else
sudo python $MANAGE syncdb --noinput
sudo python $MANAGE migrate --noinput
run "python $MANAGE syncdb --noinput"
run "python $MANAGE migrate --noinput"
fi
sudo python $MANAGE setupcelery --username $USER --processes 2
# Install and configure Nginx web server
run "mkdir $BASE_DIR/static"
run "python $MANAGE collectstatic --noinput"
sudo apt-get install -y nginx uwsgi uwsgi-plugin-python
sudo python $MANAGE setupnginx
sudo service nginx start
surun "mkdir $BASE_DIR/static"
surun "python $MANAGE collectstatic --noinput"
run "apt-get install -y nginx uwsgi uwsgi-plugin-python"
run "python $MANAGE setupnginx"
run "service nginx start"
# Apply changes
sudo python $MANAGE restartservices
run "python $MANAGE restartservices"
# Create a orchestra user
cat <<- EOF | python $MANAGE shell
from django.contrib.auth.models import User
from orchestra.apps.accounts.models import Account
if not User.objects.filter(username=$USER).exists():
if not Account.objects.filter(username=$USER).exists():
print 'Creating orchestra superuser'
user = User.objects.create_superuser($USER, "'$USER@localhost'", $PASSWORD)
user.account = Account.objects.create(user=user)
user.save()
Account.objects.create_superuser($USER, "'$USER@localhost'", $PASSWORD)
EOF