Update the vagrant with ubuntu 20.04 and some permissions fixes.

pull/5/head
Ruslan Baidan 2021-05-10 18:23:56 +02:00
parent dc88640d91
commit f22b0d27d6
2 changed files with 53 additions and 63 deletions

5
vagrant/Vagrantfile vendored
View File

@ -10,7 +10,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/bionic64"
config.vm.box = "bento/ubuntu-20.04"
config.disksize.size = "50GB"
config.vm.provision :shell, path: "bootstrap.sh"
# Disable automatic box update checking. If you disable this, then
@ -54,7 +55,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#
# # Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--name", "MONARC BO - Ubuntu 18.04 - DEV"]
vb.customize ["modifyvm", :id, "--name", "MONARC BO - Ubuntu 20.04 - DEV"]
end
#
# View the documentation for the provider you're using for more

View File

@ -18,33 +18,33 @@ post_max_size=50M
max_execution_time=100
max_input_time=223
memory_limit=512M
PHP_INI=/etc/php/7.2/apache2/php.ini
X_DEBUG_CFG=/etc/php/7.2/apache2/conf.d/20-xdebug.ini
PHP_INI=/etc/php/7.4/apache2/php.ini
XDEBUG_CFG=/etc/php/7.4/apache2/conf.d/20-xdebug.ini
MARIA_DB_CFG=/etc/mysql/mariadb.conf.d/50-server.cnf
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
sudo -E locale-gen en_US.UTF-8
sudo -E dpkg-reconfigure locales
echo -e "\n--- Installing now… ---\n"
echo -e "\n--- Updating packages list ---\n"
apt-get update && apt-get -y upgrade
sudo apt-get update && sudo apt-get upgrade -y
echo -e "\n--- Install base packages… ---\n"
apt-get -y install vim zip unzip git gettext > /dev/null
sudo apt-get -y install vim zip unzip git gettext curl gsfonts > /dev/null
echo -e "\n--- Install MariaDB specific packages and settings… ---\n"
apt-get -y install mariadb-server mariadb-client > /dev/null
sudo apt-get -y install mariadb-server mariadb-client > /dev/null
# Secure the MariaDB installation (especially by setting a strong root password)
systemctl restart mariadb.service > /dev/null
sudo systemctl restart mariadb.service > /dev/null
sleep 5
apt-get -y install expect > /dev/null
sudo apt-get -y install expect > /dev/null
## do we need to spawn mysql_secure_install with sudo in future?
expect -f - <<-EOF
set timeout 10
@ -70,38 +70,39 @@ EOF
sudo apt-get purge -y expect php-xdebug > /dev/null 2>&1
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
sudo sed -i "s/skip-external-locking/#skip-external-locking/g" $MARIA_DB_CFG
sudo 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;"
systemctl restart mariadb.service > /dev/null
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'%' IDENTIFIED BY '$DBPASSWORD_MONARC';"
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'%';"
sudo mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;"
sudo systemctl restart mariadb.service > /dev/null
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
sudo 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
echo -e "\n--- Configuring PHP… ---\n"
for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
do
sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI
sudo sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI
done
echo -e "\n--- Configuring Xdebug for development ---\n"
cat > $X_DEBUG_CFG <<EOF
sudo bash -c cat "<< EOF > $XDEBUG_CFG
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.idekey=IDEKEY
EOF
EOF"
echo -e "\n--- Enabling mod-rewrite and ssl… ---\n"
a2enmod rewrite > /dev/null
a2enmod ssl > /dev/null
sudo a2enmod rewrite > /dev/null 2>&1
sudo a2enmod ssl > /dev/null 2>&1
sudo a2enmod headers > /dev/null 2>&1
echo -e "\n--- Allowing Apache override to all ---\n"
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
sudo sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
echo -e "\n--- Installing composer… ---\n"
@ -136,14 +137,18 @@ chmod -R 777 data
# Front-end
mkdir node_modules
mkdir -p node_modules
cd node_modules
git clone --config core.filemode=false https://github.com/monarc-project/ng-backoffice.git ng_backoffice > /dev/null
if [ ! -d "ng_backoffice" ]; then
git clone --config core.filemode=false https://github.com/monarc-project/ng-backoffice.git ng_backoffice > /dev/null
fi
if [ $? -ne 0 ]; then
echo "\nERROR: unable to clone the ng-backoffice repository\n"
exit 1;
fi
git clone --config core.filemode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null
if [ ! -d "ng_anr" ]; then
git clone --config core.filemode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null
fi
if [ $? -ne 0 ]; then
echo "\nERROR: unable to clone the ng-anr repository\n"
exit 1;
@ -178,56 +183,40 @@ cat > /etc/apache2/sites-enabled/000-default.conf <<EOF
</VirtualHost>
EOF
echo -e "\n--- Restarting Apache… ---\n"
systemctl restart apache2.service > /dev/null
sudo systemctl restart apache2.service > /dev/null
echo -e "\n--- Configuration of MONARC database connection ---\n"
cat > config/autoload/local.php <<EOF
<?php
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'params' => array(
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'host' => '$DBHOST',
'user' => '$DBUSER_MONARC',
'password' => '$DBPASSWORD_MONARC',
'dbname' => '$DBNAME_COMMON',
),
),
'orm_cli' => array(
'params' => array(
],
],
'orm_cli' => [
'params' => [
'host' => '$DBHOST',
'user' => '$DBUSER_MONARC',
'password' => '$DBPASSWORD_MONARC',
'dbname' => '$DBNAME_MASTER',
),
),
),
),
],
],
],
],
/* Link with (ModuleCore)
config['languages'] = [
'fr' => array(
'index' => 1,
'label' => 'Français'
),
'en' => array(
'index' => 2,
'label' => 'English'
),
'de' => array(
'index' => 3,
'label' => 'Deutsch'
),
]
*/
'activeLanguages' => array('fr','en','de','nl'),
'activeLanguages' => ['fr','en','de','nl'],
'monarc' => array(
'ttl' => 60, // timeout
'salt' => '', // salt privé pour chiffrement pwd
),
'monarc' => [
'ttl' => 60,
'salt' => '',
],
);
EOF
@ -247,7 +236,7 @@ sudo npm install -g grunt-cli
echo -e "\n--- Update the project… ---\n"
/bin/bash ./scripts/update-all.sh > /dev/null
./scripts/update-all.sh > /dev/null
echo -e "\n--- Create initial user and client ---\n"
@ -255,7 +244,7 @@ php ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/Monarc/BackOffice/mi
echo -e "\n--- Restarting Apache… ---\n"
systemctl restart apache2.service > /dev/null
sudo systemctl restart apache2.service > /dev/null