diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index 600f607..30cdb8e 100644 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -32,6 +32,9 @@ 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--- Updating packages list… ---\n" @@ -40,6 +43,9 @@ apt-get update echo -e "\n--- Install base packages… ---\n" apt-get -y install vim zip unzip git gettext curl gsfonts > /dev/null + + + echo -e "\n--- Install MariaDB specific packages and settings… ---\n" # echo "mysql-server mysql-server/root_password password $DBPASSWORD_ADMIN" | debconf-set-selections # echo "mysql-server mysql-server/root_password_again password $DBPASSWORD_ADMIN" | debconf-set-selections @@ -72,10 +78,18 @@ expect -f - <<-EOF EOF sudo apt-get purge -y expect > /dev/null 2>&1 -echo -e "\n--- Configuring … ---\n" +echo -e "\n--- Configuring… ---\n" sed -i "s/skip-external-locking/#skip-external-locking/g" $MARIA_DB_CFG sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" $MARIA_DB_CFG +echo -e "\n--- Setting up our MariaDB user for MONARC… ---\n" +mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'%' IDENTIFIED BY '$DBPASSWORD_MONARC';" +mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'%';" +mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;" + + + + echo -e "\n--- Installing PHP-specific packages… ---\n" apt-get -y install php apache2 libapache2-mod-php php-curl php-gd php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip php-xdebug > /dev/null @@ -85,14 +99,13 @@ do sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI done -echo -e "\n--- Configuring Description Xdebug ---\n" +echo -e "\n--- Configuring Xdebug for development ---\n" cat > $X_DEBUG_CFG < /dev/null 2>&1 a2enmod ssl > /dev/null 2>&1 @@ -102,13 +115,11 @@ echo -e "\n--- Allowing Apache override to all ---\n" sudo sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf echo -e "\n--- We want to see the PHP errors, turning them on ---\n" -sed -i "s/error_reporting = .*/error_reporting = E_ALL/" $PHP_INI -sed -i "s/display_errors = .*/display_errors = On/" $PHP_INI +sed -i "s/.*error_reporting.*/error_reporting = E_ALL/g" $PHP_INI +sed -i "s/.*display_errors.*/display_errors = On/g" $PHP_INI + + -echo -e "\n--- Setting up our MariaDB user for MONARC… ---\n" -mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'%' IDENTIFIED BY '$DBPASSWORD_MONARC';" -mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'%';" -mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;" 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 @@ -118,6 +129,9 @@ if [ $? -ne 0 ]; then fi composer self-update + + + echo -e "\n--- Installing MONARC… ---\n" cd $PATH_TO_MONARC git config core.fileMode false @@ -131,7 +145,7 @@ echo -e "\n--- Retrieving MONARC libraries… ---\n" composer config -g github-oauth.github.com $GITHUB_AUTH_TOKEN composer install -o -# Modules +# Back-end mkdir module cd module ln -s ./../vendor/monarc/core MonarcCore @@ -144,7 +158,7 @@ cd module/MonarcCore/ git config core.fileMode false cd $PATH_TO_MONARC -# Interfaces +# Front-end mkdir node_modules cd node_modules git clone --config core.filemode=false https://github.com/monarc-project/ng-client.git ng_client > /dev/null 2>&1 @@ -159,12 +173,13 @@ if [ $? -ne 0 ]; then fi cd .. - chown -R www-data $PATH_TO_MONARC chgrp -R www-data $PATH_TO_MONARC chmod -R 700 $PATH_TO_MONARC + + echo -e "\n--- Add a VirtualHost for MONARC ---\n" cat > /etc/apache2/sites-enabled/000-default.conf < @@ -192,6 +207,8 @@ echo -e "\n--- Restarting Apache… ---\n" systemctl restart apache2.service > /dev/null + + echo -e "\n--- Configuration of MONARC data base connection ---\n" cat > config/autoload/local.php < /dev/null + + echo -e "\n--- Installation of Grunt… ---\n" sudo apt-get -y install npm > /dev/null npm install -g grunt-cli > /dev/null + + echo -e "\n--- Update the project… ---\n" /bin/bash ./scripts/update-all.sh > /dev/null + + echo -e "\n--- Create initial user and client ---\n" php ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/MonarcFO/migrations/phinx.php + + echo -e "\n--- Restarting Apache… ---\n" systemctl restart apache2.service > /dev/null + + echo -e "\n--- MONARC is ready! Point your Web browser to http://127.0.0.1:5001 ---\n"