Skip to content

Commit

Permalink
Merge pull request #1 from jevillard/develop
Browse files Browse the repository at this point in the history
Finalisation v1.0.0
  • Loading branch information
jevillard committed Oct 7, 2015
2 parents 80e6752 + 4251bce commit 4eb9987
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea/
.vagrant/
ezplatform/
composer.phar
23 changes: 23 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Vagrant.configure("2") do |config|

config.vm.box = "debian/jessie64"
config.vm.box_url = "https://atlas.hashicorp.com/debian/boxes/jessie64/versions/8.2.0/providers/virtualbox.box"

config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus", "2"]
v.customize ["modifyvm", :id, "--memory", "2048"]
end

config.vm.hostname = "ezplatform"
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true

config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www/html", create: true,
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=664"]

config.vm.provision "shell", path: "bin/setup.sh"
config.vm.provision "shell", path: "bin/ezplatform.sh"

end
56 changes: 56 additions & 0 deletions bin/ezplatform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

echo "Installing eZPLatform on virtual machine..."

echo "Download ezplatform by composer..."
rm -rf /var/www/html/ezplatform && cd /var/www/html
curl -s http://getcomposer.org/installer | php
php -d memory_limit=-1 composer.phar create-project --no-dev ezsystems/ezplatform /var/www/html/ezplatform

echo "Create database for eZPlatform"
DB_NAME="ezplatform"
DB_PASSWD="ezplatform"
DB_RESULT=`mysqlshow -u root -p$DB_PASSWD $DB_NAME | grep -v Wildcard | grep -o $DB_NAME`
if [ "$DB_RESULT" == $DB_NAME ]
# if it's already installed, just indicate such
then
echo "Database $DB_NAME already installed."

# if it's not installed, install it using the daptive_dma profile
else
echo "Database $DB_NAME not yet installed... installing using mysql"
mysql -u root -p$DB_PASSWD -e "CREATE DATABASE IF NOT EXISTS $DB_NAME CHARACTER SET utf8;"
fi

echo "Update database settings for ezplatform..."
sed -i 's/database_password:/database_password: ezplatform/g' /var/www/html/ezplatform/ezpublish/config/parameters.yml.dist
sed -i 's/database_password: null/database_password: ezplatform/g' /var/www/html/ezplatform/ezpublish/config/parameters.yml

echo "Implementation of eZPlatform vhost..."
cp /var/www/html/ezplatform/doc/apache2/vhost.template /etc/apache2/sites-available/ezplatform.conf
sed -i 's/%IP_ADDRESS%/*/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/%PORT%/80/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/%HOST%/ezplatform.local/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/%HOST_ALIAS%/admin.ezplatform.local/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/%BASEDIR%/\/var\/www\/html\/ezplatform/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/%ENV%/dev/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/AllowOverride None/AllowOverride all/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/#SetEnv CUSTOM_CLASSLOADER_FILE/SetEnv CUSTOM_CLASSLOADER_FILE/g' /etc/apache2/sites-available/ezplatform.conf
sed -i 's/#SetEnv USE_HTTP_CACHE 1/SetEnv USE_HTTP_CACHE 1/g' /etc/apache2/sites-available/ezplatform.conf

echo "Update php.ini..."
sed -i 's/;date.timezone =/date.timezone = "Europe\/Paris"/g' /etc/php5/apache2/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 60/g' /etc/php5/apache2/php.ini
sed -i 's/max_input_time = 60/max_input_time = 120/g' /etc/php5/apache2/php.ini
sed -i 's/memory_limit = 128M/memory_limit = 2048M/g' /etc/php5/apache2/php.ini

echo "Run installation command..."
cd /var/www/html/ezplatform && rm -rf ezpublish/cache/*
cd /var/www/html/ezplatform && php -d memory_limit=-1 ezpublish/console ezplatform:install demo

echo "Restart Apache2..."
cd /etc/apache2/sites-available
a2ensite ezplatform.conf
service apache2 restart

echo "Finished installing eZPlatform."
51 changes: 51 additions & 0 deletions bin/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

echo "Provisioning virtual machine..."

echo "Installing common packages"
apt-get -y update
apt-get -y install vim curl unzip git debconf-utils

echo "Installing Apache + activate modules"
apt-get -y install apache2
a2enmod rewrite headers expires deflate

echo "Destroy default configuration Apache"
if [ -f /etc/apache2/sites-available/000-default.conf ]
then
rm -f /etc/apache2/sites-available/000-default.conf
rm -f /etc/apache2/sites-enabled/000-default.conf
fi
if [ -f /etc/apache2/sites-available/default-ssl.conf ]
then
rm -f /etc/apache2/sites-available/default-ssl.conf
fi
if [ -f /var/www/html/index.html ]
then
rm -f /var/www/html/index.html
fi

echo "Installing mysql"
debconf-set-selections <<< "mysql-server mysql-server/root_password password ezplatform"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ezplatform"
apt-get -y install mysql-server

echo "Installing php + modules"
apt-get -y install php5 php5-mysql php5-xsl php5-intl php5-curl php5-gd

echo "Installing APC"
apt-get -y install php-pear
pear upgrade pear
apt-get -y install php-apc
ln -s /usr/share/doc/php-apc/apc.php /var/www/apc.php

echo "Installing imagemagick"
apt-get -y install imagemagick

echo "Installing Java jre7 + utils packages for solr engine search"
apt-get -y install openjdk-7-jre poppler-utils wv

echo "Restart Apache for the config to take effect"
service apache2 restart

echo "Finished provisioning."

0 comments on commit 4eb9987

Please sign in to comment.