vagrant init
authormarc.nachin <you@example.commarc.nachin@auf.org>
Wed, 15 Jan 2014 10:50:55 +0000 (11:50 +0100)
committermarc.nachin <you@example.commarc.nachin@auf.org>
Wed, 15 Jan 2014 10:50:55 +0000 (11:50 +0100)
.gitignore [new file with mode: 0644]
vagrant/provision/databases.sh [new file with mode: 0644]
vagrant/provision/project.sh [new file with mode: 0644]
vagrant/provision/root.sh [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..e1a9a20
--- /dev/null
@@ -0,0 +1,34 @@
+.vagrant
+vagrant/db/*
+
+# binaires
+*.pyc
+*.pyo
+
+# Fichier temporaires:
+.*.swp
+*~
+\#*#
+src/*
+
+# DB de dev
+*.db
+
+# restants de merge
+*.orig
+*.rej
+
+# Configuration du projet - par environnement
+conf.py
+django.wsgi
+
+# buildout
+.installed.cfg
+bin
+develop-eggs
+downloads
+eggs
+log
+parts
+tmp
+sitestatic
diff --git a/vagrant/provision/databases.sh b/vagrant/provision/databases.sh
new file mode 100644 (file)
index 0000000..dfa546b
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+cd /vagrant
+
+EXT_SQL=".sql"
+MYSQL_USER="vagrant"
+MYSQL_PASS="vagrant"
+MYSQL_CMD="mysql --user=$MYSQL_USER --password=$MYSQL_PASS"
+
+# Importe les dumps SQL
+for FILE in $(find vagrant/db -name *$EXT_SQL -type f); do
+    DB_NAME=`basename $FILE $EXT_SQL`
+    $MYSQL_CMD -e "CREATE DATABASE IF NOT EXISTS $DB_NAME;"
+    $MYSQL_CMD --database=$DB_NAME < "$FILE"
+done
diff --git a/vagrant/provision/project.sh b/vagrant/provision/project.sh
new file mode 100644 (file)
index 0000000..5828d2e
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+cd /vagrant
+
+# Buildout
+python bootstrap.py
+bin/buildout -c devel.cfg
+
+# Préparation de l'application
+bin/django syncdb --noinput --migrate
diff --git a/vagrant/provision/root.sh b/vagrant/provision/root.sh
new file mode 100644 (file)
index 0000000..ef1ec8d
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+export DEBIAN_FRONTEND=noninteractive
+
+# Installation des paquets Debian
+apt-get install -qy mysql-client mysql-server
+apt-get install -qy apache2
+apt-get install -qy phpmyadmin
+
+apt-get install -qy python-virtualenv
+apt-get install -qy ipython
+
+apt-get install -qy python-mysqldb
+apt-get install -qy python-imaging
+apt-get install -qy python-lxml
+
+apt-get install -qy python-django
+apt-get install -qy python-django-south
+#apt-get install -qy python-django-filebrowser
+
+
+# Configuration de l'utilisateur Db vagrant
+mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'vagrant'@'localhost' IDENTIFIED BY 'vagrant' WITH GRANT OPTION;"
+
+# Configuration de phpmyadmin
+echo "<?php
+\$dbuser='vagrant';
+\$dbpass='vagrant';
+\$basepath='';
+\$dbname='phpmyadmin';
+\$dbserver='';
+\$dbport='';
+\$dbtype='mysql';" > /etc/phpmyadmin/config-db.php
+
+if [ ! -f /etc/apache2/conf.d/phpmyadmin.conf ];
+then
+    ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
+fi
+apache2ctl restart
+