changelog: keep the _main folder (#441)

For the grav repo, I need to have the `_main` folder to exist so that I can then symlink it to changelog repo. It does exist on prod, but not in the repo itself as it is in .gitignore, so when I git clone, I don't have that `_main` folder. That is why I'm removing it from parent .gitignore and adding it. But as it is empty, git doesn't want to "save" it, so I created an useless .gitignore file in it...

Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #441
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
meaz 2023-08-12 18:04:29 +00:00
parent d91ff543fa
commit 7a5657f12e
7 changed files with 47 additions and 43 deletions

1
pages/.gitignore vendored
View file

@ -1,4 +1,3 @@
privacy_policy/_pp
tos/_tos
cryptocurrency/
changelog/_main

1
pages/changelog/_main/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
# nothing to ignore, but needed to have this _main empty folder :)

15
vagrant/Vagrantfile vendored
View file

@ -10,18 +10,19 @@ Vagrant.configure("2") do |config|
disroot_lan.vm.box="generic/debian10"
disroot_lan.vm.hostname = 'disroot.lan'
disroot_lan.vm.box_url = "generic/debian10"
disroot_lan.vm.synced_folder "provision/", "/vagrant/provision/"
disroot_lan.vm.synced_folder "provision/", "/vagrant/provision/"
disroot_lan.vm.network "forwarded_port", guest: 80, host: 8888, host_ip: "192.168.33.12"
disroot_lan.vm.network "forwarded_port", guest: 443, host: 4443, host_ip: "192.168.33.12"
disroot_lan.vm.network "private_network", ip: "192.168.33.12"
disroot_lan.vm.provision :shell, path: "bootstrap.sh"
disroot_lan.vm.synced_folder "../pages/", "/var/www/pages", owner: "www-data", group: "www-data"
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/privacy_policy/", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Changelog/", "/var/www/changelog/", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../pages/", "/var/www/disroot.lan/disroot.org-pages/pages", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-theme-disroot/", "/var/www/disroot.lan/disroot.org-theme", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-theme-disrootblog/", "/var/www/disroot.lan/disroot.org-blogtheme", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../grav-plugin-language-selector/", "/var/www/disroot.lan/grav-plugin-language-selector", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Privacy-Policy/", "/var/www/disroot.lan/disroot.org-pp", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-ToS/", "/var/www/disroot.lan/disroot.org-tos", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../../Disroot-Changelog/", "/var/www/disroot.lan/disroot.org-changelog", owner: "www-data", group: "www-data"
end
end

View file

@ -4,9 +4,10 @@
WEB_NAME="disroot.lan"
WEB_ROOT="/var/www/"
WWW_USER="www-data"
YAML_SYSTEM="/var/www/disroot.lan/user/config/system.yaml"
YAML_SITE="/var/www/disroot.lan/user/config/site.yaml"
GRAV_VERSION="1.7.24"
SITE_PATH="${WEB_ROOT}${WEB_NAME}/site"
YAML_SYSTEM="${SITE_PATH}/user/config/system.yaml"
YAML_SITE="${SITE_PATH}/user/config/site.yaml"
GRAV_VERSION="1.7.42"
# Provisioning actions
apt install dialog
@ -47,13 +48,13 @@ if [ -f /etc/nginx/sites-enabled/default ]; then
sudo rm /etc/nginx/sites-enabled/default
fi
sudo service nginx restart
# Install GRAV in webroot
echo "Installing GRAV..."
sudo chown -R ${WWW_USER}:${WWW_USER} "${WEB_ROOT}"
if [ ! -f "${WEB_ROOT}""${WEB_NAME}" ]; then
sudo -u "${WWW_USER}" mkdir "${WEB_ROOT}""${WEB_NAME}"
if [ ! -f "${SITE_PATH}" ]; then
sudo -u "${WWW_USER}" mkdir "${SITE_PATH}"
fi
## Specific version
@ -62,11 +63,11 @@ if [ ! -f "$FILE" ]; then
echo "Downloading grav-v"${GRAV_VERSION}".zip"
sudo -u "${WWW_USER}" wget https://github.com/getgrav/grav/releases/download/"${GRAV_VERSION}"/grav-v"${GRAV_VERSION}".zip -P "${WEB_ROOT}"
sudo -u "${WWW_USER}" unzip -o "${WEB_ROOT}"grav-v"${GRAV_VERSION}".zip -d "${WEB_ROOT}"
sudo -u "${WWW_USER}" cp -r "${WEB_ROOT}"grav/* "${WEB_ROOT}""${WEB_NAME}"
sudo -u "${WWW_USER}" cp -r "${WEB_ROOT}"grav/* "${SITE_PATH}"
else
echo "grav-v"${GRAV_VERSION}".zip already exists"
sudo -u "${WWW_USER}" unzip -o "${WEB_ROOT}"grav-v"${GRAV_VERSION}".zip -d "${WEB_ROOT}"
sudo -u "${WWW_USER}" cp -r "${WEB_ROOT}"grav/* "${WEB_ROOT}""${WEB_NAME}"
sudo -u "${WWW_USER}" cp -r "${WEB_ROOT}"grav/* "${SITE_PATH}"
fi
# Directly from Master
@ -87,8 +88,8 @@ fi
#sudo -u "${WWW_USER}" bin/gpm install disroot
#sudo -u "${WWW_USER}" bin/gpm install language-selector -> Disabled as we're using grav-plugin-language-selector Disroot repo
echo "Enter git"
cd "${WEB_ROOT}""${WEB_NAME}"
echo "Enter grav folder"
cd "${SITE_PATH}"
yes | sudo -u "${WWW_USER}" php8.0 bin/gpm install themer
# https://github.com/sommerregen/grav-plugin-themer
@ -102,58 +103,60 @@ yes | sudo -u "${WWW_USER}" php8.0 bin/gpm install form
# Add Grav config (the second extra false should be set to true, but it creates an error in Grav ("Trying to access array offset on value of type null")
# Create the Nginx config files and restart webserver
echo "Installing Grav config file config file..."
sudo rsync -cr "/vagrant/provision/${YAML_SYSTEM}" "${YAML_SYSTEM}"
sudo rsync -cr "/vagrant/provision/${YAML_SITE}" "${YAML_SITE}"
sudo rsync -cr "/vagrant/provision${YAML_SYSTEM}" "${YAML_SYSTEM}"
sudo rsync -cr "/vagrant/provision${YAML_SITE}" "${YAML_SITE}"
# 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
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
echo "Installing Disroot pages in GRAV..."
sudo mount -o bind /var/www/"${WEB_NAME}"/disroot.org-pages/pages "${SITE_PATH}"/user/pages
chown "${WWW_USER}":"${WWW_USER}" -R "${SITE_PATH}"/user/pages
# Add Disroot theme in GRAV
echo "Installing 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
if [ ! -d "${SITE_PATH}"/user/themes/disroot ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}""${WEB_NAME}"/disroot.org-theme "${SITE_PATH}"/user/themes/disroot
fi
# Add Disroot Blog theme in GRAV
echo "Installing 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
if [ ! -d "${SITE_PATH}"/user/themes/disrootblog ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}""${WEB_NAME}"/disroot.org-blogtheme "${SITE_PATH}"/user/themes/disrootblog
fi
# Add language-selector in GRAV
echo "Installing 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
if [ ! -d "${SITE_PATH}"/user/plugins/language-selector ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}""${WEB_NAME}"/grav-plugin-language-selector "${SITE_PATH}"/user/plugins/language-selector
fi
# Add Privacy pages in GRAV
echo "Installing Privacy 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 "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
if [ ! -d "${SITE_PATH}"/user/pages/privacy_policy/_pp ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}""${WEB_NAME}"/disroot.org-pp "${SITE_PATH}"/user/pages/privacy_policy/_pp
fi
# Add TOS pages in GRAV
echo "Installing TOS pages in GRAV..."
if [ ! -d "${SITE_PATH}"/user/pages/tos/_tos ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}""${WEB_NAME}"/disroot.org-tos "${SITE_PATH}"/user/pages/tos/_tos
fi
# Add Changelog pages in GRAV
echo "Installing Changelog pages in GRAV..."
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/pages/changelog/_main ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"changelog "${WEB_ROOT}""${WEB_NAME}"/user/pages/changelog/_main
fi
# Changelog pages name in GRAV
if [ -f "${WEB_ROOT}"changelog/CHANGELOG ]; then
sudo -u "${WWW_USER}" cp "${WEB_ROOT}"changelog/CHANGELOG "${WEB_ROOT}"changelog/fullbar.en.md
if [ ! -e "${SITE_PATH}"/user/pages/changelog/_main/fullbar.en.md ]; then
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}""${WEB_NAME}"/disroot.org-changelog/CHANGELOG "${SITE_PATH}"/user/pages/changelog/_main/fullbar.en.md
fi
# Remove the default grav files and folder from new installation
echo "Remove the default grav files and folder from new installation..."
if [ -d "${WEB_ROOT}""${WEB_NAME}"/user/pages/02.typography ]; then
rm -r "${WEB_ROOT}""${WEB_NAME}"/user/pages/02.typography
if [ -d "${SITE_PATH}"/user/pages/02.typography ]; then
rm -r "${SITE_PATH}"/user/pages/02.typography
fi
if [ -f "${WEB_ROOT}""${WEB_NAME}"/user/pages/01.home/default.md ]; then
rm "${WEB_ROOT}""${WEB_NAME}"/user/pages/01.home/default.md
if [ -f "${SITE_PATH}"/user/pages/01.home/default.md ]; then
rm "${SITE_PATH}"/user/pages/01.home/default.md
fi
exit 0

View file

@ -1,7 +1,7 @@
server {
listen 80 ;
root /var/www/disroot.lan;
root /var/www/disroot.lan/site;
index index.html index.php;
server_name grav.disroot.org;
server_tokens off;
@ -13,7 +13,7 @@ server {
}
location /favicon.ico {
alias /var/www/disroot.lan/favicon.png;
alias /var/www/disroot.lan/site/favicon.png;
}
# deny all direct access for these folders