Commit 2c54bb8f authored by chris's avatar chris

Add Vagrantfile

parent 8f1736e4
config/connect.php
tmp
test
junk
stats
IMG/cache*
IMG/distant
IMG/pdf
IMG/ps
local/cache*
stats
junk
guide-admin
2014
NAVPICS
dpsite2
squelettes-old
domainepublic.sql
.vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.provision :shell, path: "bin/bootstrap_vagrant"
config.vm.network "forwarded_port", guest: 80, host: 8000
end
#! /usr/bin/env bash
# Variables
DBHOST=localhost
DBNAME=domainepublic
DBUSER=user
DBPASSWD=password
apt-get -qq update
apt-get -y install vim
echo "--- Install MySQL specific packages and settings ---"
debconf-set-selections <<< "mysql-server mysql-server/root_password password $DBPASSWD"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $DBPASSWD"
#debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
#debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $DBPASSWD"
#debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $DBPASSWD"
#debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $DBPASSWD"
#debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none"
apt-get -y install mysql-server #phpmyadmin
echo "--- Setup our MySQL user and db ---"
mysql -uroot -p$DBPASSWD -e "CREATE DATABASE $DBNAME"
mysql -uroot -p$DBPASSWD -e "grant all privileges on $DBNAME.* to '$DBUSER'@'localhost' identified by '$DBPASSWD'"
echo "--- Install PHP packages ---"
apt-get -y install apache2 php5 libapache2-mod-php5
echo "--- Install spip dependencies ---"
apt-get -y install php5-mysql php5-imagick php5-gd netpbm
echo "--- Enable mod-rewrite ---"
a2enmod rewrite
echo "--- Allow Apache override to all ---"
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
echo "--- Set document root to public directory ---"
rm -rf /var/www/html
ln -fs /vagrant /var/www/html
echo "--- Display PHP errors ---"
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
echo "--- Create Spip connect.php and folders---"
[ -f /vagrant/config/connect.php ] || cp /vagrant/config/connect-example.php /vagrant/config/connect.php
[ -d /vagrant/tmp/cache/xml ] || mkdir -p /vagrant/tmp/cache/xml/
echo "--- Import Spip database ---"
[ -f /vagrant/domainepublic.sql ] || scp ginger.domainepublic.net:/srv/domainepublic.sql /vagrant/
mysql -uroot -p$DBPASSWD $DBNAME < /vagrant/domainepublic.sql
echo "--- Restart Apache ---"
service apache2 restart
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment