deploy prod yaml config + add some info + remove default grav files
This commit is contained in:
parent
004b90df27
commit
411fd57031
|
@ -4,7 +4,8 @@
|
||||||
WEB_NAME="disroot.lan"
|
WEB_NAME="disroot.lan"
|
||||||
WEB_ROOT="/var/www/"
|
WEB_ROOT="/var/www/"
|
||||||
WWW_USER="www-data"
|
WWW_USER="www-data"
|
||||||
YAML="/var/www/disroot.lan/user/config/system.yaml"
|
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"
|
GRAV_VERSION="1.7.24"
|
||||||
|
|
||||||
# Provisioning actions
|
# Provisioning actions
|
||||||
|
@ -96,42 +97,12 @@ yes | sudo -u "${WWW_USER}" php8.0 bin/gpm install tagcloud
|
||||||
# https://github.com/Perlkonig/grav-plugin-tagcloud
|
# https://github.com/Perlkonig/grav-plugin-tagcloud
|
||||||
|
|
||||||
yes | sudo -u "${WWW_USER}" php8.0 bin/gpm install form
|
yes | sudo -u "${WWW_USER}" php8.0 bin/gpm install form
|
||||||
sudo -u "${WWW_USER}" sed -i 's/quark/disroot/g' "${YAML}"
|
|
||||||
|
|
||||||
# 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")
|
# 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
|
||||||
if ! grep -q auto_line_breaks "${YAML}" ; then
|
echo "Installing Grav config file config file..."
|
||||||
sudo -u "${WWW_USER}" sed -i "s/extra:\ false/\extra:\ false\n\ auto_line_breaks:\ true\n\ auto_url_links:\ true\n\ escape_markup:\ false\n\ special_chars:\n\ \'\>\':\ \'gt\'\n\ \'\<\':\ \'lt\'/" "${YAML}"
|
sudo rsync -cr "/vagrant/provision/${YAML_SYSTEM}" "${YAML_SYSTEM}"
|
||||||
fi
|
sudo rsync -cr "/vagrant/provision/${YAML_SITE}" "${YAML_SITE}"
|
||||||
|
|
||||||
if ! grep -q languages "${YAML}" ; then
|
|
||||||
sudo -u "${WWW_USER}" echo "
|
|
||||||
languages:
|
|
||||||
supported:
|
|
||||||
- en
|
|
||||||
- es
|
|
||||||
- fr
|
|
||||||
- it
|
|
||||||
- pt
|
|
||||||
- de
|
|
||||||
- ru
|
|
||||||
include_default_lang: true
|
|
||||||
pages_fallback_only: false
|
|
||||||
translations: true
|
|
||||||
translations_fallback: true
|
|
||||||
session_store_active: true
|
|
||||||
http_accept_language: true
|
|
||||||
override_locale: false" >> "${YAML}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo -u "${WWW_USER}" ex -s -c "4i| alias: '/home'" -c x "${YAML}"
|
|
||||||
sudo -u "${WWW_USER}" sed -i '4d' "${YAML}"
|
|
||||||
|
|
||||||
if ! grep -q redirect_default_route "${YAML}" ; then
|
|
||||||
sudo -u "${WWW_USER}" ex -s -c '16i| redirect_default_route: true' -c x "${YAML}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo -u "${WWW_USER}" -i 's/false/true/g' "${YAML}" # sed is missing, but creates an error anyway as "markdown: extra: true" gives an error
|
|
||||||
|
|
||||||
# Add website domain to local /etc/hosts file
|
# 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
|
sudo sed -i "s/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost $WEB_NAME/" /etc/hosts
|
||||||
|
@ -141,26 +112,31 @@ 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
|
chown "${WWW_USER}":"${WWW_USER}" -R "${WEB_ROOT}""${WEB_NAME}"/user/pages
|
||||||
|
|
||||||
# Add Disroot theme in GRAV
|
# Add Disroot theme in GRAV
|
||||||
|
echo "Installing Disroot theme in GRAV..."
|
||||||
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot/grav-theme-disroot ]; then
|
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
|
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-theme-disroot "${WEB_ROOT}""${WEB_NAME}"/user/themes/disroot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add Disroot Blog theme in GRAV
|
# 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
|
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
|
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-theme-disrootblog "${WEB_ROOT}""${WEB_NAME}"/user/themes/disrootblog
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add language-selector in GRAV
|
# 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
|
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
|
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"grav-plugin-language-selector "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add Privacy pages in GRAV
|
# Add Privacy pages in GRAV
|
||||||
|
echo "Installing Privacy pages in GRAV..."
|
||||||
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp ]; then
|
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
|
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"privacy_policy "${WEB_ROOT}""${WEB_NAME}"/user/pages/privacy_policy/_pp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add Changelog pages in GRAV
|
# Add Changelog pages in GRAV
|
||||||
|
echo "Installing Changelog pages in GRAV..."
|
||||||
if [ ! -d "${WEB_ROOT}""${WEB_NAME}"/user/pages/changelog/_main ]; then
|
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
|
sudo -u "${WWW_USER}" ln -s "${WEB_ROOT}"changelog "${WEB_ROOT}""${WEB_NAME}"/user/pages/changelog/_main
|
||||||
fi
|
fi
|
||||||
|
@ -170,4 +146,13 @@ if [ -f "${WEB_ROOT}"changelog/CHANGELOG ]; then
|
||||||
sudo -u "${WWW_USER}" cp "${WEB_ROOT}"changelog/CHANGELOG "${WEB_ROOT}"changelog/fullbar.en.md
|
sudo -u "${WWW_USER}" cp "${WEB_ROOT}"changelog/CHANGELOG "${WEB_ROOT}"changelog/fullbar.en.md
|
||||||
fi
|
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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue