deploy.sh: make sure git is installed
This commit is contained in:
parent
fde29e4ddd
commit
abe54be58b
|
@ -37,8 +37,7 @@ If you are planing to do some development or perhaps just checking out this proj
|
||||||
```bash
|
```bash
|
||||||
wget -O /tmp/create.sh \
|
wget -O /tmp/create.sh \
|
||||||
https://raw2.github.com/glic3rinu/django-orchestra/master/scripts/container/create.sh
|
https://raw2.github.com/glic3rinu/django-orchestra/master/scripts/container/create.sh
|
||||||
chmod +x /tmp/create.sh
|
sudo bash /tmp/create.sh
|
||||||
sudo /tmp/create.sh
|
|
||||||
sudo lxc-start -n orchestra
|
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
|
```bash
|
||||||
wget -O /tmp/deploy.sh \
|
wget -O /tmp/deploy.sh \
|
||||||
https://raw2.github.com/glic3rinu/django-orchestra/master/scripts/container/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
|
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`
|
Django-orchestra source code should be now under `~orchestra/django-orchestra` and an Orchestra instance called _panel_ under `~orchestra/panel`
|
||||||
|
|
||||||
|
|
2
TODO.md
2
TODO.md
|
@ -162,4 +162,4 @@ APPS app?
|
||||||
* interdependency user <-> account with the old usermodel
|
* interdependency user <-> account with the old usermodel
|
||||||
|
|
||||||
|
|
||||||
* replace running_syncdb() by db_ready()
|
* pip upgrade or install
|
||||||
|
|
|
@ -170,6 +170,9 @@ class SystemUserMixin(object):
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|
||||||
|
# TODO test resources
|
||||||
|
|
||||||
|
|
||||||
class RESTSystemUserMixin(SystemUserMixin):
|
class RESTSystemUserMixin(SystemUserMixin):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RESTSystemUserMixin, self).setUp()
|
super(RESTSystemUserMixin, self).setUp()
|
||||||
|
|
|
@ -144,7 +144,6 @@ function install_requirements () {
|
||||||
kombu==3.0.23 \
|
kombu==3.0.23 \
|
||||||
billiard==3.3.0.18 \
|
billiard==3.3.0.18 \
|
||||||
Markdown==2.4 \
|
Markdown==2.4 \
|
||||||
django-debug-toolbar==1.2.1 \
|
|
||||||
djangorestframework==2.3.14 \
|
djangorestframework==2.3.14 \
|
||||||
paramiko==1.15.1 \
|
paramiko==1.15.1 \
|
||||||
ecdsa==0.11 \
|
ecdsa==0.11 \
|
||||||
|
@ -153,7 +152,6 @@ function install_requirements () {
|
||||||
passlib==1.6.2 \
|
passlib==1.6.2 \
|
||||||
jsonfield==0.9.22 \
|
jsonfield==0.9.22 \
|
||||||
lxml==3.3.5 \
|
lxml==3.3.5 \
|
||||||
django-nose==1.2 \
|
|
||||||
python-dateutil==2.2 \
|
python-dateutil==2.2 \
|
||||||
django-iban==0.3.0"
|
django-iban==0.3.0"
|
||||||
|
|
||||||
|
@ -165,7 +163,10 @@ function install_requirements () {
|
||||||
xvfbwrapper \
|
xvfbwrapper \
|
||||||
freezegun \
|
freezegun \
|
||||||
coverage \
|
coverage \
|
||||||
orchestra-orm==dev"
|
orchestra-orm==dev \
|
||||||
|
django-debug-toolbar==1.2.1 \
|
||||||
|
django-nose==1.2 \
|
||||||
|
sqlparse"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure locales are in place before installing postgres
|
# Make sure locales are in place before installing postgres
|
||||||
|
|
|
@ -253,6 +253,3 @@ PASSLIB_CONFIG = (
|
||||||
"superuser__django_pbkdf2_sha256__default_rounds = 15000\n"
|
"superuser__django_pbkdf2_sha256__default_rounds = 15000\n"
|
||||||
"superuser__sha512_crypt__default_rounds = 120000\n"
|
"superuser__sha512_crypt__default_rounds = 120000\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
|
|
||||||
|
|
|
@ -18,3 +18,6 @@ if "celeryd" in sys.argv or 'celeryev' in sys.argv or 'celerybeat' in sys.argv:
|
||||||
INSTALLED_APPS += ('debug_toolbar', )
|
INSTALLED_APPS += ('debug_toolbar', )
|
||||||
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||||
INTERNAL_IPS = ('127.0.0.1', '10.0.3.1',) #10.0.3.1 is the lxcbr0 ip
|
INTERNAL_IPS = ('127.0.0.1', '10.0.3.1',) #10.0.3.1 is the lxcbr0 ip
|
||||||
|
|
||||||
|
|
||||||
|
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
|
||||||
|
|
|
@ -22,35 +22,40 @@ PROJECT_NAME='panel'
|
||||||
BASE_DIR="$HOME/$PROJECT_NAME"
|
BASE_DIR="$HOME/$PROJECT_NAME"
|
||||||
|
|
||||||
|
|
||||||
run () {
|
surun () {
|
||||||
echo " ${bold}\$ su $USER -c \"${@}\"${normal}"
|
echo " ${bold}\$ su $USER -c \"${@}\"${normal}"
|
||||||
su $USER -c "${@}"
|
su $USER -c "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run () {
|
||||||
|
echo " ${bold}\$ ${@}${normal}"
|
||||||
|
${@}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Create a system user for running Orchestra
|
# Create a system user for running Orchestra
|
||||||
useradd orchestra -s "/bin/bash"
|
useradd orchestra -s "/bin/bash"
|
||||||
echo "$USER:$PASSWORD" | chpasswd
|
echo "$USER:$PASSWORD" | chpasswd
|
||||||
mkdir $HOME
|
mkdir $HOME
|
||||||
chown $USER.$USER $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)
|
CURRENT_VERSION=$(python -c "from orchestra import get_version; print get_version();" 2> /dev/null || false)
|
||||||
|
|
||||||
if [[ ! $CURRENT_VERSION ]]; then
|
if [[ ! $CURRENT_VERSION ]]; then
|
||||||
# First Orchestra installation
|
# First Orchestra installation
|
||||||
sudo apt-get -y install git python-pip
|
run "apt-get -y install git python-pip"
|
||||||
run "git clone https://github.com/glic3rinu/django-orchestra.git ~/django-orchestra"
|
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
|
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
|
fi
|
||||||
|
|
||||||
sudo orchestra-admin install_requirements
|
sudo orchestra-admin install_requirements
|
||||||
|
|
||||||
if [[ ! -e $BASE_DIR ]]; then
|
if [[ ! -e $BASE_DIR ]]; then
|
||||||
cd $HOME
|
cd $HOME
|
||||||
run "orchestra-admin startproject $PROJECT_NAME"
|
surun "orchestra-admin startproject $PROJECT_NAME"
|
||||||
cd -
|
cd -
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -60,46 +65,43 @@ if [[ ! $(sudo su postgres -c "psql -lqt" | awk {'print $1'} | grep '^orchestra$
|
||||||
# orchestra database does not esists
|
# orchestra database does not esists
|
||||||
# Speeding up tests, don't do this in production!
|
# Speeding up tests, don't do this in production!
|
||||||
POSTGRES_VERSION=$(psql --version | head -n1 | awk {'print $3'} | sed -r "s/(^[0-9\.]*).*/\1/")
|
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
|
/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
|
/etc/postgresql/${POSTGRES_VERSION}/main/postgresql.conf
|
||||||
|
|
||||||
sudo service postgresql restart
|
run "service postgresql restart"
|
||||||
sudo python $MANAGE setuppostgres --db_name orchestra --db_user orchestra --db_password orchestra
|
run "python $MANAGE setuppostgres --db_name orchestra --db_user orchestra --db_password orchestra"
|
||||||
# Create database permissions are needed for running tests
|
# Create database permissions are needed for running tests
|
||||||
sudo su postgres -c 'psql -c "ALTER USER orchestra CREATEDB;"'
|
sudo su postgres -c 'psql -c "ALTER USER orchestra CREATEDB;"'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $CURRENT_VERSION ]]; then
|
if [[ $CURRENT_VERSION ]]; then
|
||||||
# Per version upgrade specific operations
|
# Per version upgrade specific operations
|
||||||
sudo python $MANAGE postupgradeorchestra --no-restart --from $CURRENT_VERSION
|
run "python $MANAGE postupgradeorchestra --no-restart --from $CURRENT_VERSION"
|
||||||
else
|
else
|
||||||
sudo python $MANAGE syncdb --noinput
|
run "python $MANAGE syncdb --noinput"
|
||||||
sudo python $MANAGE migrate --noinput
|
run "python $MANAGE migrate --noinput"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo python $MANAGE setupcelery --username $USER --processes 2
|
sudo python $MANAGE setupcelery --username $USER --processes 2
|
||||||
|
|
||||||
# Install and configure Nginx web server
|
# Install and configure Nginx web server
|
||||||
run "mkdir $BASE_DIR/static"
|
surun "mkdir $BASE_DIR/static"
|
||||||
run "python $MANAGE collectstatic --noinput"
|
surun "python $MANAGE collectstatic --noinput"
|
||||||
sudo apt-get install -y nginx uwsgi uwsgi-plugin-python
|
run "apt-get install -y nginx uwsgi uwsgi-plugin-python"
|
||||||
sudo python $MANAGE setupnginx
|
run "python $MANAGE setupnginx"
|
||||||
sudo service nginx start
|
run "service nginx start"
|
||||||
|
|
||||||
# Apply changes
|
# Apply changes
|
||||||
sudo python $MANAGE restartservices
|
run "python $MANAGE restartservices"
|
||||||
|
|
||||||
# Create a orchestra user
|
# Create a orchestra user
|
||||||
cat <<- EOF | python $MANAGE shell
|
cat <<- EOF | python $MANAGE shell
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from orchestra.apps.accounts.models import Account
|
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'
|
print 'Creating orchestra superuser'
|
||||||
user = User.objects.create_superuser($USER, "'$USER@localhost'", $PASSWORD)
|
Account.objects.create_superuser($USER, "'$USER@localhost'", $PASSWORD)
|
||||||
user.account = Account.objects.create(user=user)
|
|
||||||
user.save()
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue