From 31dd9e1a7a005445f734b9b845c40870f1033108 Mon Sep 17 00:00:00 2001 From: meaz Date: Thu, 30 Dec 2021 10:43:53 +0000 Subject: [PATCH] Update vagrant again! (#285) I added the default Disroot's yaml config files, added some info + delete the default vagrant files/folder we get with new installation. I destroyed vagrant and reinstalled several times, it worked perfectly each time. Co-authored-by: meaz Reviewed-on: https://git.disroot.org/Disroot/Website/pulls/285 Reviewed-by: Fede.- Reviewed-by: antilopa Co-authored-by: meaz Co-committed-by: meaz --- vagrant/README.md | 2 +- vagrant/bootstrap.sh | 55 +++--- .../var/www/disroot.lan/user/config/site.yaml | 56 ++++++ .../www/disroot.lan/user/config/system.yaml | 163 ++++++++++++++++++ 4 files changed, 240 insertions(+), 36 deletions(-) create mode 100644 vagrant/provision/var/www/disroot.lan/user/config/site.yaml create mode 100644 vagrant/provision/var/www/disroot.lan/user/config/system.yaml diff --git a/vagrant/README.md b/vagrant/README.md index 7438c5bb..8ba02281 100644 --- a/vagrant/README.md +++ b/vagrant/README.md @@ -44,7 +44,7 @@ If you prefer the easy way, just execute the vagrant.sh script provided. Make su ## Installation -1. Create a Disroot folder, in which you'll clone three repositories: +1. Create a Disroot folder, in which you'll clone six repositories: ``` mkdir ~/Disroot ``` diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index ecd88eca..ba9a4a7b 100755 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -4,7 +4,8 @@ WEB_NAME="disroot.lan" WEB_ROOT="/var/www/" 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" # Provisioning actions @@ -96,42 +97,12 @@ yes | sudo -u "${WWW_USER}" php8.0 bin/gpm install tagcloud # https://github.com/Perlkonig/grav-plugin-tagcloud 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") - -if ! grep -q auto_line_breaks "${YAML}" ; then - 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}" -fi - -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 +# 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}" # 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 @@ -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 # 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 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 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 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 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 @@ -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 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 diff --git a/vagrant/provision/var/www/disroot.lan/user/config/site.yaml b/vagrant/provision/var/www/disroot.lan/user/config/site.yaml new file mode 100644 index 00000000..f86c6953 --- /dev/null +++ b/vagrant/provision/var/www/disroot.lan/user/config/site.yaml @@ -0,0 +1,56 @@ +title: Disroot +default_lang: en +author: + name: Disroot + email: info@disroot.org +taxonomies: + - category + - tag +metadata: + description: 'Disroot is a platform providing online services based on principles of freedom, privacy, federation and decentralization.' +summary: + enabled: true + format: short + size: 300 + delimiter: '===' +blog: + route: /blog +header: + title: 'Dis`root´' + description: '1. To tear up the roots of, or by the roots; hence, to tear from a foundation; to uproot.' +copyright: + - + line: '' + - + line: '' +social: + - + url: '#' + icon: facebook + - + url: '#' + icon: twitter + - + url: '#' + icon: google-plus + - + url: '#' + icon: linkedin + - + url: '#' + icon: instagram + - + url: '#' + icon: dribbble + - + url: '#' + icon: skype +twitter: + id: '657554810648948736' + domId: tw-widget1 + maxTweets: 3 + enableLinks: 'true' + showInteraction: 'false' + showImages: 'false' + showUser: 'false' +acxtest: TEST diff --git a/vagrant/provision/var/www/disroot.lan/user/config/system.yaml b/vagrant/provision/var/www/disroot.lan/user/config/system.yaml new file mode 100644 index 00000000..af1ae15e --- /dev/null +++ b/vagrant/provision/var/www/disroot.lan/user/config/system.yaml @@ -0,0 +1,163 @@ +absolute_urls: false +param_sep: ':' +wrapped_site: false +reverse_proxy_setup: true +force_ssl: false +force_lowercase_urls: true +username_regex: '^[a-z0-9_-]{3,16}$' +pwd_regex: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}' +intl_enabled: true + +languages: + supported: + - en + - es + - fr + - it + - 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 + +home: + alias: '/home' + hide_in_urls: false + +pages: + theme: disroot + order: + by: default + dir: asc + list: + count: 20 + dateformat: + default: 'd-m-Y H:i' + short: 'jS M Y' + long: 'jS M Y' + publish_dates: true + process: + markdown: true + twig: false + twig_first: false + never_cache_twig: false + events: + page: true + twig: true + markdown: + extra: true + auto_line_breaks: true + auto_url_links: true + escape_markup: false + special_chars: + '>': gt + '<': lt + types: + - txt + - xml + - html + - htm + - json + - rss + - atom + expires: 604800 + last_modified: false + etag: false + vary_accept_encoding: false + redirect_default_route: false + redirect_default_code: '301' + redirect_trailing_slash: false + ignore_files: + - .DS_Store + ignore_folders: + - .git + - .idea + ignore_hidden: true + url_taxonomy_filters: true + frontmatter: + process_twig: false + ignore_fields: + - form + - forms + +cache: + enabled: true + check: + method: file + driver: auto + prefix: g + clear_images_by_default: true + cli_compatibility: false + lifetime: 604800 + gzip: false + allow_webserver_gzip: false + +twig: + cache: true + debug: true + auto_reload: true + autoescape: false + undefined_functions: true + undefined_filters: true + umask_fix: false + +assets: + css_pipeline: false + css_pipeline_include_externals: true + css_pipeline_before_excludes: true + css_minify: true + css_minify_windows: false + css_rewrite: true + js_pipeline: false + js_pipeline_include_externals: true + js_pipeline_before_excludes: true + js_minify: true + enable_asset_timestamp: false + collections: + jquery: 'system://assets/jquery/jquery-2.x.min.js' + +errors: + display: 0 + log: true + +debugger: + enabled: false + shutdown: + close_connection: true + twig: true + +images: + default_image_quality: 85 + cache_all: false + cache_perms: '0755' + debug: false + auto_fix_orientation: false + +media: + enable_media_timestamp: false + auto_metadata_exif: false + upload_limit: 8388608 + +session: + enabled: true + initialize: true + timeout: 1800 + name: grav-site + secure: false + httponly: true + split: true + +gpm: + releases: stable + method: auto + verify_peer: true + official_gpm_only: true + +strict_mode: + yaml_compat: true + twig_compat: true + blueprint_compat: true