Ubuntu 16
On passe à ubuntu 16 ce qui permet d'utiliser python3.5 et le paquet python3-venv. Fichier `provisioning/prepare_django.sh` plus propre
This commit is contained in:
parent
41b54cec9e
commit
d1c6c2151a
4 changed files with 17 additions and 17 deletions
2
Vagrantfile
vendored
2
Vagrantfile
vendored
|
@ -10,7 +10,7 @@ Vagrant.configure(2) do |config|
|
|||
# For a complete reference, please see the online documentation at
|
||||
# https://docs.vagrantup.com.
|
||||
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.box = "ubuntu/xenial64"
|
||||
|
||||
# On associe le port 80 dans la machine virtuelle avec le port 8080 de notre
|
||||
# ordinateur, et le port 8000 avec le port 8000.
|
||||
|
|
|
@ -8,7 +8,7 @@ DBNAME="cof_gestion"
|
|||
DBPASSWD="4KZt3nGPLVeWSvtBZPSM3fSzXpzEU4"
|
||||
|
||||
# Installation de paquets utiles
|
||||
apt-get update && apt-get install -y mercurial python3-pip python3-dev \
|
||||
apt-get update && apt-get install -y python3-pip python3-dev python3-venv \
|
||||
libmysqlclient-dev libjpeg-dev git redis-server
|
||||
|
||||
# Configuration et installation de mysql. Le mot de passe root est le même que
|
||||
|
@ -29,10 +29,10 @@ a2ensite gestiocof
|
|||
a2dissite 000-default
|
||||
service apache2 restart
|
||||
mkdir /var/www/static
|
||||
chown -R vagrant:www-data /var/www/static
|
||||
chown -R ubuntu:www-data /var/www/static
|
||||
|
||||
# Mise en place du .bash_profile pour tout configurer lors du `vagrant ssh`
|
||||
cat > ~vagrant/.bash_profile <<EOF
|
||||
cat >> ~ubuntu/.bashrc <<EOF
|
||||
# On utilise la version de développement de GestioCOF
|
||||
export DJANGO_SETTINGS_MODULE='cof.settings_dev'
|
||||
|
||||
|
@ -50,25 +50,23 @@ source ~/venv/bin/activate
|
|||
# On va dans /vagrant où se trouve le code de gestioCOF
|
||||
cd /vagrant
|
||||
EOF
|
||||
chown vagrant: ~vagrant/.bash_profile
|
||||
|
||||
# On va dans /vagrant où se trouve gestioCOF
|
||||
cd /vagrant
|
||||
|
||||
# Installation du virtualenv, on utilise désormais python3
|
||||
pip3 install -U pip
|
||||
pip3 install virtualenv
|
||||
sudo -H -u vagrant virtualenv ~vagrant/venv -p /usr/bin/python3
|
||||
sudo -H -u vagrant ~vagrant/venv/bin/pip install -r requirements.txt -r requirements-devel.txt
|
||||
sudo -H -u ubuntu python3 -m venv ~ubuntu/venv
|
||||
sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -U pip
|
||||
sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -r requirements.txt -r requirements-devel.txt
|
||||
|
||||
# Préparation de Django
|
||||
sudo -H -u vagrant DJANGO_SETTINGS_MODULE='cof.settings_dev' DBUSER=$DBUSER DBNAME=$DBNAME DBPASSWD=$DBPASSWD sh provisioning/prepare_django.sh
|
||||
sudo -H -u ubuntu DJANGO_SETTINGS_MODULE='cof.settings_dev' DBUSER=$DBUSER DBNAME=$DBNAME DBPASSWD=$DBPASSWD bash provisioning/prepare_django.sh
|
||||
|
||||
# Installation du cron pour les mails de rappels
|
||||
sudo -H -u vagrant crontab provisioning/cron.dev
|
||||
sudo -H -u ubuntu crontab provisioning/cron.dev
|
||||
|
||||
# On installe Daphne et on demande à supervisor de le lancer
|
||||
~vagrant/venv/bin/pip install daphne
|
||||
~ubuntu/venv/bin/pip install daphne
|
||||
apt-get install -y supervisor
|
||||
cp /vagrant/provisioning/supervisor.conf /etc/supervisor/conf.d/gestiocof.conf
|
||||
sed "s/{DBUSER}/$DBUSER/" -i /etc/supervisor/conf.d/gestiocof.conf
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Doit être lancé par bootstrap.sh
|
||||
|
||||
~/venv/bin/python manage.py migrate
|
||||
~/venv/bin/python manage.py loaddata users root bda gestion sites
|
||||
~/venv/bin/python manage.py collectstatic --noinput
|
||||
source ~/venv/bin/activate
|
||||
python manage.py migrate
|
||||
python manage.py loaddata users root bda gestion sites
|
||||
python manage.py collectstatic --noinput
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[program:worker]
|
||||
command=/home/vagrant/venv/bin/python /vagrant/manage.py runworker
|
||||
directory=/vagrant/
|
||||
user=vagrant
|
||||
user=ubuntu
|
||||
environment=DBUSER={DBUSER},DBNAME={DBNAME},DBPASSWD={DBPASSWD},DJANGO_SETTINGS_MODULE="cof.settings_dev"
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
@ -17,4 +17,4 @@ redirect_stderr=true
|
|||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
user=vagrant
|
||||
user=ubuntu
|
||||
|
|
Loading…
Reference in a new issue