Compare commits

...

3 Commits

2 changed files with 30 additions and 16 deletions

2
vagrant/Vagrantfile vendored
View File

@ -21,7 +21,7 @@ Vagrant.configure("2") do |config|
disroot_lan.vm.synced_folder "../../grav-theme-disroot/", "/var/www/grav-theme-disroot", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-theme-disrootblog/", "/var/www/grav-theme-disrootblog", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-plugin-language-selector/", "/var/www/grav-plugin-language-selector", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Privacy-Policy/", "/var/www/pages/privacy_policy/_pp", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Privacy-Policy/", "/var/www/privacy_policy/_pp", owner: "www-data", group: "www-data"
end
end

View File

@ -7,7 +7,7 @@ WWW_USER="www-data"
YAML="/var/www/disroot.lan/user/config/system.yaml"
# Provisioning actions
apt install dialog
apt install dialog # shouldn't we remove this?
# Avoid Postfix installation interactive screens by preconfiguring this information
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type select No configuration"
@ -17,7 +17,8 @@ sudo debconf-set-selections <<< "postfix postfix/mailname string ${WEB_NAME}"
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install ca-certificates apt-transport-https
echo "deb https://packages.sury.org/php/ buster main" | sudo tee -a /etc/apt/sources.list.d/php.list
#echo "deb https://packages.sury.org/php/ buster main" | sudo tee -a /etc/apt/sources.list.d/php.list
sudo sh -c 'echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list'
# Sury Key for PHP7.4
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
@ -34,15 +35,21 @@ sudo apt-get install -y php7.4-zip php7.4-cli php7.4-curl php7.4-gd php7.4-mbstr
# Create the Nginx config files and restart webserver
sudo rsync -cr /vagrant/provision/etc/nginx/sites-available /etc/nginx/
sudo ln -s /etc/nginx/sites-available/"${WEB_NAME}".conf /etc/nginx/sites-enabled/"${WEB_NAME}".conf
sudo rm /etc/nginx/sites-enabled/default
if [ ! -f /etc/nginx/sites-enabled/"${WEB_NAME}".conf ]; then
sudo ln -s /etc/nginx/sites-available/"${WEB_NAME}".conf /etc/nginx/sites-enabled/"${WEB_NAME}".conf
fi
if [ -f /etc/nginx/sites-enabled/default ]; then
sudo rm /etc/nginx/sites-enabled/default
fi
sudo service nginx restart
# Install GRAV in webroot
sudo chown -R ${WWW_USER}:${WWW_USER} /var/www
sudo wget https://getcomposer.org/download/1.9.1/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
echo "Git"
git clone -b master https://github.com/getgrav/grav.git "${WEB_ROOT}""${WEB_NAME}"
if [ ! -d "${WEB_ROOT}""${WEB_NAME}" ]; then
git clone -b master https://github.com/getgrav/grav.git "${WEB_ROOT}""${WEB_NAME}"
fi
sudo chown -R ${WWW_USER}:${WWW_USER} "${WEB_ROOT}"
echo "enter git"
@ -103,21 +110,28 @@ sudo -u "${WWW_USER}" -i 's/false/true/g' "${YAML}"
# Add website domain to local /etc/hosts file
sudo sed -i "s/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost $WEB_NAME/" /etc/hosts
#Add website pages in GRAV
# Add website pages in GRAV
sudo mount -o bind /var/www/pages "${WEB_ROOT}""${WEB_NAME}"/user/pages
chown "${WWW_USER}":"${WWW_USER}" -R "${WEB_ROOT}""${WEB_NAME}"/user/pages
#Add Privacy Statement pages in GRAV
sudo mount -o bind /var/www/pages/privacy_policy/_pp "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
chown "${WWW_USER}":"${WWW_USER}" -R "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
# Add Privacy Statement pages in GRAV
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"privacy_policy/_pp "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
fi
#Add Disroot theme in GRAV
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"/grav-theme-disroot "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot
# Add Disroot theme in GRAV
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot/grav-theme-disroot ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-theme-disroot "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot
fi
#Add Disroot Blog theme in GRAV
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"/grav-theme-disrootblog "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog
# Add Disroot Blog theme in GRAV
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog/grav-theme-disrootblog ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-theme-disrootblog "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog
fi
#Add language-selector in GRAV
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"/grav-plugin-language-selector "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector
# Add language-selector in GRAV
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector/grav-plugin-language-selector ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-plugin-language-selector "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector
fi
exit 0