Merge branch 'master' of gitlab.factory.insight.doubletrade.com:scores/envdev

This commit is contained in:
benoitpotier 2017-04-06 16:16:58 +02:00
commit 958f20553d
4 changed files with 53 additions and 50 deletions

View File

@ -19,8 +19,8 @@ fi
# --- Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]; then
sudo apt-get install libxrender1 libfontconfig1
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cp -R wkhtmltox/* /usr/local/
rm -rf wkhtmltox*
fi
@ -61,7 +61,8 @@ if [ ! -f /usr/bin/php5 ]; then
# Install
sudo apt-get update
sudo apt-get -y install htop unzip apache2 php5-fpm php5-cli php5-apcu php5-curl php5-xmlrpc php5-xsl php5-mysqlnd
sudo apt-get -y install htop unzip apache2 php5-cli php5-fpm php5-mcrypt php5-curl php5-xmlrpc \
php5-xsl php5-mysqlnd php5-gd php5-json php5-intl php5-imagick php5-apcu
if [ $VARGANTDEV -eq 1 ]; then
sudo apt-get -y install php5-xdebug
fi
@ -86,7 +87,7 @@ if [ ! -f /usr/bin/php5 ]; then
sudo sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php5/fpm/php.ini
sudo sed -i -e 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/g' /etc/php5/fpm/php.ini
sudo sed -i -e 's/;opcache.enable=0/opcache.enable=1/g' /etc/php5/fpm/php.ini
sudo cp -f $DIRDATA/PHP/xdebug.ini /etc/php5/mods-available/xdebug.ini
sudo cp -f $DIRDATA/PHP/xdebug.ini /etc/php5/mods-available/xdebug.ini
# Pool user
sudo sed -i -e 's/user = www-data/user = vagrant/g' /etc/php5/fpm/pool.d/www.conf
sudo sed -i -e 's/group = www-data/group = vagrant/g' /etc/php5/fpm/pool.d/www.conf

View File

@ -1,33 +1,34 @@
#!/usr/bin/env bash
VARGANTDEV=1
DIR=/vagrant
DIRDATA=$DIR/data
MYSQL_PASS=scores
MARIADB_VERSION="10.1"
PHPMYADMIN_VERSION="4.5.4.1"
MARIADB_VERSION="10.1"
PHPMYADMIN_VERSION="4.6.6"
# --- Add a file action.upgrade to perfom a system upgrade
if [ -f $DIR/action.upgrade ]
then
if [ -f $DIR/action.upgrade ]; then
sudo apt-get update
sudo apt-get -y upgrade
sudo rm -rf $DIR/action.upgrade
fi
# --- Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]
then
sudo dpkg -i $DIRDATA/Apps/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
sudo apt-get -f install -y
if [ ! -f /usr/local/bin/wkhtmltopdf ]; then
sudo apt-get install libxrender1 libfontconfig1
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cp -R wkhtmltox/* /usr/local/
rm -rf wkhtmltox*
fi
# --- Database
if [ $VARGANTDEV -eq 1 ]
then
if [ $VARGANTDEV -eq 1 ]; then
# --- Installation MariaDB
if [ ! -f /etc/mysql/vagrant ]
then
if [ ! -f /etc/mysql/vagrant ]; then
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386] http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.1/ubuntu trusty main'
@ -42,8 +43,7 @@ then
fi
else
# --- Installation MySQL Server
if [ ! -f /etc/mysql/vagrant ]
then
if [ ! -f /etc/mysql/vagrant ]; then
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_PASS"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_PASS"
sudo apt-get -y install mysql-server mysql-client
@ -55,28 +55,27 @@ else
fi
# --- PHP
if [ ! -f /usr/bin/php5 ]
then
if [ ! -f /usr/bin/php5 ]; then
# Install
sudo apt-get update
sudo apt-get -y install htop unzip apache2 php5 php5-apcu php5-curl php5-xmlrpc php5-xsl php5-mysqlnd
if [ $VARGANTDEV -eq 1 ]
then
sudo apt-get -y install htop unzip apache2 libapache2-mod-php5 php5-cli php5-mcrypt php5-curl php5-xmlrpc \
php5-xsl php5-mysqlnd php5-gd php5-json php5-intl php5-imagick php5-apcu
if [ $VARGANTDEV -eq 1 ]; then
sudo apt-get -y install php5-xdebug
fi
sudo a2enmod autoindex deflate expires headers rewrite
# --- Configuration PHP / CLI
if [ -f /etc/php5/cli/php.ini ]
then
if [ -f /etc/php5/cli/php.ini ]; then
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/cli/php.ini
fi
# --- Configuration PHP / APACHE2
if [ -f /etc/php5/apache2/php.ini ]
then
if [ -f /etc/php5/apache2/php.ini ]; then
sudo sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php5/apache2/php.ini
sudo sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php5/apache2/php.ini
@ -92,8 +91,7 @@ then
fi
# --- ChartDirector
if [ ! -f /usr/lib/php5/20121212/chartdir.lic ]
then
if [ ! -f /usr/lib/php5/20121212/chartdir.lic ]; then
sudo cp -R $DIRDATA/ChartDirector/lib/fonts /usr/lib/php5/20121212/
sudo cp $DIRDATA/ChartDirector/lib/libchartdir.so /usr/lib/php5/20121212/
sudo cp $DIRDATA/ChartDirector/lib/phpchartdir550.dll /usr/lib/php5/20121212/
@ -104,32 +102,39 @@ then
fi
# --- Installation mailcatcher
if [ ! -f /usr/local/bin/mailcatcher ]; then
sudo apt-get install -y build-essential software-properties-common
sudo apt-get install -y libsqlite3-dev ruby1.9.1-dev
sudo gem install mime-types --version "< 3"
sudo gem install --conservative mailcatcher
echo "@reboot root $(which mailcatcher) --http-ip=0.0.0.0" >> /etc/crontab
sudo sed -i -e 's/;sendmail_path =/sendmail_path = \/usr\/bin\/env catchmail -f local@sd.dev/g' /etc/php5/cli/php.ini
sudo sed -i -e 's/;sendmail_path =/sendmail_path = \/usr\/bin\/env catchmail -f local@sd.dev/g' /etc/php5/fpm/php.ini
fi
# --- Composer
if [ ! -f /usr/local/bin/composer ]
then
if [ ! -f /usr/local/bin/composer ]; then
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
fi
# --- Installation phpMyAdmin
PHPMYADMIN_DIR="phpMyAdmin-$PHPMYADMIN_VERSION-all-languages"
PHPMYADMIN_URL="https://files.phpmyadmin.net/phpMyAdmin"
if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ]
then
if [ ! -d "/home/vhosts/$PHPMYADMIN_DIR" ]; then
wget -q "$PHPMYADMIN_URL/$PHPMYADMIN_VERSION/$PHPMYADMIN_DIR.tar.xz" -O "/home/vagrant/$PHPMYADMIN_DIR.tar.xz"
if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ]
then
if [ -f "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" ]; then
tar xJvf "/home/vagrant/$PHPMYADMIN_DIR.tar.xz" --directory /home/vhosts/
mysql -hlocalhost -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql
mysql -hlocalhost -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql
mysql -uroot -p$MYSQL_PASS < /home/vhosts/$PHPMYADMIN_DIR/sql/create_tables.sql
mysql -uroot -p$MYSQL_PASS < $DIRDATA/Apps/phpmyadmin.sql
sudo service mysql restart
cp $DIRDATA/Apps/config.inc.php /home/vhosts/$PHPMYADMIN_DIR/
chmod 0444 /home/vhosts/$PHPMYADMIN_DIR/config.inc.php
chmod 0644 /home/vhosts/$PHPMYADMIN_DIR/config.inc.php
fi
fi
# --- Configuration Apache
if [ ! -f /etc/apache2/conf-available/httpd.conf ]
then
if [ ! -f /etc/apache2/conf-available/httpd.conf ]; then
sudo echo "ServerName 127.0.0.1" > /etc/apache2/conf-available/httpd.conf
sudo a2enconf httpd
fi
@ -148,13 +153,12 @@ for f in *.conf; do
done;
# --- phpmyadmin.sd.dev
cp -f $DIRDATA/Apache/phpmyadmin.conf $DIR/vhosts/phpmyadmin.conf
sed -i -e "s/VERSION/$PHPMYADMIN_VERSION/" $DIR/vhosts/phpmyadmin.conf
cp -f $DIRDATA/Apache/phpmyadmin.conf $DIR/vhosts/phpmyadmin.conf
sed -i -e "s/VERSION/$PHPMYADMIN_VERSION/" $DIR/vhosts/phpmyadmin.conf
# --- test.sd.dev
cp -f $DIRDATA/Apache/test.conf $DIR/vhosts/test.conf
if [ ! -d /home/vhosts/test ]
then
if [ ! -d /home/vhosts/test ]; then
sudo mkdir /home/vhosts/test
fi
@ -168,9 +172,8 @@ for f in *.conf; do
if [ $f = "default-ssl.conf" ]; then
continue
fi
if [ -f $f ]
then
sudo cp -vf $f /etc/apache2/sites-available/;
if [ -f $f ]; then
sudo cp -vf $f /etc/apache2/sites-available/
VHOSTS+=" $f"
fi
done;
@ -179,4 +182,3 @@ sudo a2ensite $VHOSTS
# --- Restart apache
sudo service apache2 restart

View File

@ -19,8 +19,8 @@ fi
# --- Installation Wkhtmltopdf
if [ ! -f /usr/local/bin/wkhtmltopdf ]; then
sudo apt-get install libxrender1 libfontconfig1
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
wget -q http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cp -R wkhtmltox/* /usr/local/
rm -rf wkhtmltox*
fi