3 Commits

Author SHA1 Message Date
Fabien Basmaison 633267e470 Merge pull request 'Update scripts with latest Spip' (#2) from develop into master 3 months ago
Fabien Basmaison a552295631 Add a provision script to upgrade OS. 3 months ago
Fabien Basmaison ef0226a51d Update scripts: 3 months ago
  1. 39
      Vagrantfile
  2. 3
      vagrant/apt-packages.cfg
  3. 22
      vagrant/root-os.sh
  4. 5
      vagrant/root-upgrade-os.sh
  5. 28
      vagrant/user-spip.sh

39
Vagrantfile

@ -10,12 +10,37 @@ Vagrant.configure("2") do |config|
config.ssh.forward_agent = true
config.vm.network "private_network", ip: "192.168.50.4"
config.vm.synced_folder "./", "/vagrant",
config.vm.synced_folder "./spip", "/vagrant/spip",
id: "vagrant-root",
owner: "vagrant",
group: "www-data",
create: true,
mount_options: ["dmode=755", "fmode=644"],
nfs: false
config.vm.synced_folder "./spip/config", "/vagrant/spip/config",
id: "vagrant-config",
create: true,
mount_options: ["dmode=777", "fmode=777"]
config.vm.synced_folder "./spip/IMG", "/vagrant/spip/IMG",
id: "vagrant-IMG",
create: true,
mount_options: ["dmode=777", "fmode=777"]
config.vm.synced_folder "./spip/lib", "/vagrant/spip/lib",
id: "vagrant-lib",
create: true,
mount_options: ["dmode=777", "fmode=777"]
config.vm.synced_folder "./spip/local", "/vagrant/spip/local",
id: "vagrant-local",
create: true,
mount_options: ["dmode=777", "fmode=777"]
config.vm.synced_folder "./spip/plugins/auto", "/vagrant/spip/plugins/auto",
id: "vagrant-plugins-auto",
create: true,
mount_options: ["dmode=777", "fmode=777"]
config.vm.synced_folder "./spip/tmp", "/vagrant/spip/tmp",
id: "vagrant-tmp",
create: true,
mount_options: ["dmode=777", "fmode=777"]
config.vm.provider :virtualbox do |vb|
vb.name = "spip-testing"
@ -28,6 +53,13 @@ Vagrant.configure("2") do |config|
type: :shell,
path: "vagrant/root-os.sh"
# Upgrade box with root user.
# ===========================================================================
config.vm.provision 'upgrade-os',
type: :shell,
run: "never",
path: "vagrant/root-upgrade-os.sh"
# Provision with vagrant user.
# ===========================================================================
config.vm.provision 'spip',
@ -60,9 +92,8 @@ Vagrant.configure("2") do |config|
`date '+%H:%M'`: Done! \a
You can access the box with http://192.168.50.4/.
NB: From time to time, it wouldn’t hurt to do a \\\`vagrant ssh\\\`,
then \\\`sudo apt upgrade\\\` to upgrade all
packages.
NB: It wouldn’t hurt to run \\\`vagrant provision --provision-with upgrade-os\\\`
to upgrade all packages.
=========================================================================="
SHELL
end

3
vagrant/apt-packages.cfg

@ -4,4 +4,5 @@ php
php-gd
php-sqlite3
php-xml
sqlite
sqlite
unzip

22
vagrant/root-os.sh

@ -40,8 +40,26 @@ apt-get install -y $(cat /vagrant/vagrant/apt-packages.cfg)
echo "
`date '+%H:%M'`: Updating Apache configuration…
=============================================================================="
sed -i s#/var/www/html#/vagrant/spip#g $APACHE_SITES_PATH/000-default.conf
sed -i s#/var/www#/vagrant/spip#g $APACHE_CONFIGS/apache2.conf
cat <<EOF > /etc/apache2/sites-available/spip.conf
<VirtualHost *:80>
ServerName spip.local
ServerAlias spip.local
DocumentRoot /vagrant/spip
<Directory "/vagrant/spip">
Require all granted
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/spip-error.log
CustomLog /var/log/apache2/spip-access.log combined
</VirtualHost>
EOF
# Let Apache disable default host and serve this website.
a2dissite 000-default.conf
a2ensite spip.conf
echo "
`date '+%H:%M'`: Enabling Apache modules…

5
vagrant/root-upgrade-os.sh

@ -0,0 +1,5 @@
#! /bin/bash
#
# This file is about upgrading the OS with the root user.
apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean;

28
vagrant/user-spip.sh

@ -1,19 +1,23 @@
#! /bin/bash
cd /vagrant
ROOT_PUBLIC=/vagrant/spip;
echo "
`date '+%H:%M'`: Downloading spip from https://git.spip.net/SPIP/spip…
=============================================================================="
SPIP_ZIP_URL=https://git.spip.net/SPIP/spip/archive/spip-3.2.tar.gz;
cd "$ROOT_PUBLIC";
curl --silent --show-error "$SPIP_ZIP_URL" \
| tar --extract --gzip --no-same-owner --overwrite;
if [[ -d "$ROOT_PUBLIC" ]]; then
echo "$ROOT_PUBLIC exists."
cd "$ROOT_PUBLIC"
else
echo "$ROOT_PUBLIC does not exist. Exiting…"
exit
fi
echo "
`date '+%H:%M'`: Creating and giving rights to mandatory folders…
`date '+%H:%M'`: Downloading spip from files.spip.net
=============================================================================="
cd spip
mkdir -p IMG lib local plugins/auto tmp;
chmod -R 777 IMG lib local plugins/auto tmp;
cd -
SPIP_ZIP_URL=https://files.spip.net/spip/stable/spip-3.2.zip?1613419963;
curl --silent --show-error --output spip.zip "$SPIP_ZIP_URL"
unzip -o spip;
rm spip.zip;
Loading…
Cancel
Save