chg: set Vagrant privileged mode to false, adapt some permissions and execute mysql_secure_installation with sudo

pull/5/head
Cédric Bonhomme 2021-05-21 11:47:05 +02:00
parent 6cd81e4baa
commit aac3aaaa1c
No known key found for this signature in database
GPG Key ID: A1CB94DE57B7A70D
3 changed files with 7 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

4
vagrant/Vagrantfile vendored
View File

@ -12,7 +12,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# 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 = "bento/ubuntu-20.04" config.vm.box = "bento/ubuntu-20.04"
config.disksize.size = "50GB" config.disksize.size = "50GB"
config.vm.provision :shell, path: "bootstrap.sh" config.vm.provision "shell", privileged: false, path: "bootstrap.sh"
# Disable automatic box update checking. If you disable this, then # Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs # boxes will only be checked for updates when the user runs
@ -22,7 +22,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Create a forwarded port mapping which allows access to a specific port # Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below, # within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine. # accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network "forwarded_port", guest: 80, host: 5000 config.vm.network :forwarded_port, guest: 80, host: 5000
config.vm.network :forwarded_port, guest: 3306, host: 3309 config.vm.network :forwarded_port, guest: 3306, host: 3309
# Create a private network, which allows host-only access to the machine # Create a private network, which allows host-only access to the machine

View File

@ -50,10 +50,9 @@ sudo apt-get -y install mariadb-server mariadb-client > /dev/null
sudo systemctl restart mariadb.service > /dev/null sudo systemctl restart mariadb.service > /dev/null
sleep 5 sleep 5
sudo 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 expect -f - <<-EOF
set timeout 10 set timeout 10
spawn mysql_secure_installation spawn sudo mysql_secure_installation
expect "Enter current password for root (enter for none):" expect "Enter current password for root (enter for none):"
send -- "\r" send -- "\r"
expect "Set root password?" expect "Set root password?"
@ -73,7 +72,6 @@ expect -f - <<-EOF
expect eof expect eof
EOF EOF
sudo apt-get purge -y expect php-xdebug > /dev/null 2>&1 sudo apt-get purge -y expect php-xdebug > /dev/null 2>&1
echo -e "\n--- Configuring… ---\n" echo -e "\n--- Configuring… ---\n"
sudo sed -i "s/skip-external-locking/#skip-external-locking/g" $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 sudo sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" $MARIA_DB_CFG
@ -162,7 +160,7 @@ cd ..
echo -e "\n--- Add a VirtualHost for MONARC ---\n" echo -e "\n--- Add a VirtualHost for MONARC ---\n"
cat > /etc/apache2/sites-enabled/000-default.conf <<EOF sudo bash -c "cat << EOF > /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80> <VirtualHost *:80>
ServerName localhost ServerName localhost
DocumentRoot $PATH_TO_MONARC/public DocumentRoot $PATH_TO_MONARC/public
@ -181,7 +179,7 @@ cat > /etc/apache2/sites-enabled/000-default.conf <<EOF
SetEnv DB_USER $DBUSER SetEnv DB_USER $DBUSER
SetEnv DB_PASS $DBPASSWD SetEnv DB_PASS $DBPASSWD
</VirtualHost> </VirtualHost>
EOF EOF"
echo -e "\n--- Restarting Apache… ---\n" echo -e "\n--- Restarting Apache… ---\n"
sudo systemctl restart apache2.service > /dev/null sudo systemctl restart apache2.service > /dev/null
@ -240,9 +238,9 @@ sudo usermod -aG vagrant www-data
echo -e "\n--- Update the project… ---\n" echo -e "\n--- Update the project… ---\n"
sudo chown -R $USER:$(id -gn $USER) /home/vagrant/.config
sudo npm install -g grunt-cli sudo npm install -g grunt-cli
./scripts/update-all.sh > /dev/null sudo npm install -g node-gyp
./scripts/update-all.sh -d
echo -e "\n--- Create initial user and client ---\n" echo -e "\n--- Create initial user and client ---\n"
@ -253,5 +251,4 @@ echo -e "\n--- Restarting Apache… ---\n"
sudo systemctl restart apache2.service > /dev/null sudo systemctl restart apache2.service > /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"