Now using Ubuntu Artful server. Various improvements.

pull/1/head
Cédric Bonhomme 2018-01-26 08:30:08 +01:00
parent 2a7aa61cd4
commit 0691a00309
No known key found for this signature in database
GPG Key ID: A1CB94DE57B7A70D
3 changed files with 53 additions and 47 deletions

View File

@ -20,7 +20,7 @@ Installation of VirtualBox and Vagrant
Deployment of the back office Deployment of the back office
------------------------------ ------------------------------
MONARC will be automatically deployed in an Ubuntu Zesty Server. MONARC will be automatically deployed in an Ubuntu Artful Server.
.. code-block:: bash .. code-block:: bash

5
vagrant/Vagrantfile vendored
View File

@ -10,8 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# please see the online documentation at vagrantup.com. # please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of. # Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/zesty64" config.vm.box = "ubuntu/artful64"
#config.vm.box_url = "https://atlas.hashicorp.com/ubuntu/boxes/zesty64/versions/20170412.1.0"
config.vm.provision :shell, path: "bootstrap.sh", args: "#{ENV['GITHUB_AUTH_TOKEN']}" config.vm.provision :shell, path: "bootstrap.sh", args: "#{ENV['GITHUB_AUTH_TOKEN']}"
# Disable automatic box update checking. If you disable this, then # Disable automatic box update checking. If you disable this, then
@ -54,7 +53,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# #
# # Use VBoxManage to customize the VM. For example to change memory: # # Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"] vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--name", "MONARC BO - Ubuntu 17.04 - DEV"] vb.customize ["modifyvm", :id, "--name", "MONARC BO - Ubuntu 17.10 - DEV"]
end end
# #
# View the documentation for the provider you're using for more # View the documentation for the provider you're using for more

View File

@ -16,8 +16,8 @@ ENVIRONMENT='PRODUCTION'
DBHOST='localhost' DBHOST='localhost'
DBNAME_COMMON='monarc_common' DBNAME_COMMON='monarc_common'
DBNAME_MASTER='monarc_master' DBNAME_MASTER='monarc_master'
DBUSER_AMIN='root' DBUSER_ADMIN='root'
DBPASSWORD_AMIN="$(openssl rand -hex 32)" DBPASSWORD_ADMIN="$(openssl rand -hex 32)"
DBUSER_MONARC='sqlmonarcuser' DBUSER_MONARC='sqlmonarcuser'
DBPASSWORD_MONARC="$(openssl rand -hex 32)" DBPASSWORD_MONARC="$(openssl rand -hex 32)"
@ -26,24 +26,32 @@ post_max_size=50M
max_execution_time=100 max_execution_time=100
max_input_time=223 max_input_time=223
memory_limit=512M memory_limit=512M
PHP_INI=/etc/php/7.0/apache2/php.ini PHP_INI=/etc/php/7.1/apache2/php.ini
export DEBIAN_FRONTEND=noninteractive
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
echo -e "\n--- Installing now... ---\n" echo -e "\n--- Installing now ---\n"
echo -e "\n--- Updating packages list ---\n" echo -e "\n--- Updating packages list ---\n"
apt-get -qq update apt-get update
echo -e "\n--- Install base packages ---\n" echo -e "\n--- Install base packages ---\n"
apt-get -y install vim zip unzip git gettext > /dev/null 2>&1 apt-get -y install vim zip unzip git gettext > /dev/null
echo -e "\n--- Install MySQL specific packages and settings ---\n" echo -e "\n--- Install MySQL specific packages and settings… ---\n"
echo "mysql-server mysql-server/root_password password $DBPASSWORD_AMIN" | debconf-set-selections echo "mysql-server mysql-server/root_password password $DBPASSWORD_ADMIN" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $DBPASSWORD_AMIN" | debconf-set-selections echo "mysql-server mysql-server/root_password_again password $DBPASSWORD_ADMIN" | debconf-set-selections
apt-get -y install mysql-server > /dev/null 2>&1 apt-get -y install mysql-server > /dev/null
systemctl restart mariadb.service > /dev/null
sleep 5
echo -e "\n--- Installing PHP-specific packages ---\n" echo -e "\n--- Installing PHP-specific packages ---\n"
apt-get -y install php apache2 libapache2-mod-php php-curl php-gd php-mcrypt php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip > /dev/null 2>&1 apt-get -y install php apache2 libapache2-mod-php php-curl php-gd php-mcrypt php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip > /dev/null
echo -e "\n--- Configuring PHP ---\n" echo -e "\n--- Configuring PHP ---\n"
for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
@ -51,9 +59,9 @@ do
sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI
done done
echo -e "\n--- Enabling mod-rewrite and ssl ---\n" echo -e "\n--- Enabling mod-rewrite and ssl ---\n"
a2enmod rewrite > /dev/null 2>&1 a2enmod rewrite > /dev/null
a2enmod ssl > /dev/null 2>&1 a2enmod ssl > /dev/null
echo -e "\n--- Allowing Apache override to all ---\n" echo -e "\n--- Allowing Apache override to all ---\n"
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
@ -62,20 +70,20 @@ sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
#sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/apache2/php.ini #sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/apache2/php.ini
#sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/apache2/php.ini #sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/apache2/php.ini
echo -e "\n--- Setting up our MySQL user for MONARC ---\n" echo -e "\n--- Setting up our MySQL user for MONARC ---\n"
mysql -u root -p$DBPASSWORD_AMIN -e "CREATE USER '$DBUSER_MONARC'@'localhost' IDENTIFIED BY '$DBPASSWORD_MONARC';" mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'localhost' IDENTIFIED BY '$DBPASSWORD_MONARC';"
mysql -u root -p$DBPASSWORD_AMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'localhost';" mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'localhost';"
mysql -u root -p$DBPASSWORD_AMIN -e "FLUSH PRIVILEGES;" mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;"
echo -e "\n--- Installing composer... ---\n" echo -e "\n--- Installing composer ---\n"
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer > /dev/null 2>&1 curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "\nERROR: unable to install composer\n" echo "\nERROR: unable to install composer\n"
exit 1; exit 1;
fi fi
composer self-update composer self-update
echo -e "\n--- Installing MONARC... ---\n" echo -e "\n--- Installing MONARC ---\n"
cd $PATH_TO_MONARC cd $PATH_TO_MONARC
git config core.fileMode false git config core.fileMode false
if [ "$TAG" != '' ]; then if [ "$TAG" != '' ]; then
@ -84,7 +92,7 @@ if [ "$TAG" != '' ]; then
git checkout $TAG git checkout $TAG
fi fi
echo -e "\n--- Retrieving MONARC libraries... ---\n" echo -e "\n--- Retrieving MONARC libraries ---\n"
composer config -g github-oauth.github.com $GITHUB_AUTH_TOKEN composer config -g github-oauth.github.com $GITHUB_AUTH_TOKEN
composer install -o composer install -o
@ -98,12 +106,12 @@ cd ..
# Interfaces # Interfaces
mkdir node_modules mkdir node_modules
cd node_modules cd node_modules
git clone --config core.filemode=false https://github.com/monarc-project/ng-backoffice.git ng_backoffice > /dev/null 2>&1 git clone --config core.filemode=false https://github.com/monarc-project/ng-backoffice.git ng_backoffice > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "\nERROR: unable to clone the ng-backoffice repository\n" echo "\nERROR: unable to clone the ng-backoffice repository\n"
exit 1; exit 1;
fi fi
git clone --config core.filemode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null 2>&1 git clone --config core.filemode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "\nERROR: unable to clone the ng-anr repository\n" echo "\nERROR: unable to clone the ng-anr repository\n"
exit 1; exit 1;
@ -134,8 +142,8 @@ cat > /etc/apache2/sites-enabled/000-default.conf <<EOF
SetEnv DB_PASS $DBPASSWD SetEnv DB_PASS $DBPASSWD
</VirtualHost> </VirtualHost>
EOF EOF
echo -e "\n--- Restarting Apache ---\n" echo -e "\n--- Restarting Apache ---\n"
service apache2 restart > /dev/null 2>&1 systemctl restart apache2.service restart > /dev/null
echo -e "\n--- Configuration of MONARC data base connection ---\n" echo -e "\n--- Configuration of MONARC data base connection ---\n"
@ -163,7 +171,7 @@ return array(
), ),
), ),
/* Link with (ModuleCore) /* Link with (ModuleCore)
config['languages'] = [ config['languages'] = [
'fr' => array( 'fr' => array(
'index' => 1, 'index' => 1,
@ -189,22 +197,21 @@ return array(
EOF EOF
echo -e "\n--- Creation of the data bases---\n" echo -e "\n--- Creation of the data bases---\n"
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_master DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null 2>&1 mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_master DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_common DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null 2>&1 mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC -e "CREATE DATABASE monarc_common DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" > /dev/null
echo -e "\n--- Populating MONARC DB ---\n" echo -e "\n--- Populating MONARC DB ---\n"
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_structure.sql > /dev/null 2>&1 mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_structure.sql > /dev/null
mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_data.sql > /dev/null 2>&1 mysql -u $DBUSER_MONARC -p$DBPASSWORD_MONARC monarc_common < db-bootstrap/monarc_data.sql > /dev/null
echo -e "\n--- Installation of Grunt ---\n" echo -e "\n--- Installation of Grunt… ---\n"
apt-get -y install nodejs > /dev/null 2>&1 apt-get -y install nodejs > /dev/null
apt-get -y install npm > /dev/null 2>&1 apt-get -y install npm > /dev/null
npm install -g grunt-cli > /dev/null 2>&1 npm install -g grunt-cli > /dev/null
ln -s /usr/bin/nodejs /usr/bin/node
echo -e "\n--- Update the project ---\n" echo -e "\n--- Update the project ---\n"
/bin/bash ./scripts/update-all.sh > /dev/null /bin/bash ./scripts/update-all.sh > /dev/null
@ -212,8 +219,8 @@ echo -e "\n--- Create initial user and client ---\n"
php ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/MonarcBO/migrations/phinx.php > /dev/null php ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/MonarcBO/migrations/phinx.php > /dev/null
echo -e "\n--- Restarting Apache ---\n" echo -e "\n--- Restarting Apache ---\n"
service apache2 restart > /dev/null 2>&1 service apache2 restart > /dev/null
echo -e "\n--- MONARC is ready! Point your Web browser to http://127.0.0.1:5000 ---\n" echo -e "\n--- MONARC is ready! Point your Web browser to http://127.0.0.1:5000 ---\n"