From 8845f90f2f97e4d738d2479c685eaa792389b9a2 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Nov 25 2024 14:11:03 +0000 Subject: chore: render site using jekyll-theme-centos container image --- diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 68bee29..0000000 --- a/Gemfile +++ /dev/null @@ -1,34 +0,0 @@ -source "https://rubygems.org" -# Hello! This is where you manage which Jekyll version is used to run. -# When you want to use a different version, change it below, save the -# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: -# -# bundle exec jekyll serve -# -# This will help ensure the proper Jekyll version is running. -# Happy Jekylling! -gem "jekyll", "~> 4.3.0" - -# This is CentOS default website theme for new Jekyll based web sites. You may -# change this to anything you like. -gem "jekyll-theme-centos", "2.51.1.beta.56" - -# If you want to use GitHub Pages, remove the "gem "jekyll"" above and -# uncomment the line below. To upgrade, run `bundle update github-pages`. gem -# "github-pages", group: :jekyll_plugins -# -# If you have any plugins, put them here! -group :jekyll_plugins do - gem "jekyll-feed" - gem "jekyll-toc" -end - -# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem -# and associated library. -install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do - gem "tzinfo", "~> 1.2" - gem "tzinfo-data" -end - -# Performance-booster for watching directories on Windows -gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform? diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 7a9cd3f..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,206 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) - bigdecimal (3.1.8) - colorator (1.1.0) - concurrent-ruby (1.3.3) - em-websocket (0.5.3) - eventmachine (>= 0.12.9) - http_parser.rb (~> 0) - eventmachine (1.2.7) - ffi (1.17.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) - forwardable-extended (2.6.0) - google-protobuf (4.27.2) - bigdecimal - rake (>= 13) - google-protobuf (4.27.2-aarch64-linux) - bigdecimal - rake (>= 13) - google-protobuf (4.27.2-arm64-darwin) - bigdecimal - rake (>= 13) - google-protobuf (4.27.2-x86-linux) - bigdecimal - rake (>= 13) - google-protobuf (4.27.2-x86_64-darwin) - bigdecimal - rake (>= 13) - google-protobuf (4.27.2-x86_64-linux) - bigdecimal - rake (>= 13) - http_parser.rb (0.8.0) - i18n (1.14.5) - concurrent-ruby (~> 1.0) - jekyll (4.3.3) - addressable (~> 2.4) - colorator (~> 1.0) - em-websocket (~> 0.5) - i18n (~> 1.0) - jekyll-sass-converter (>= 2.0, < 4.0) - jekyll-watch (~> 2.0) - kramdown (~> 2.3, >= 2.3.1) - kramdown-parser-gfm (~> 1.0) - liquid (~> 4.0) - mercenary (>= 0.3.6, < 0.5) - pathutil (~> 0.9) - rouge (>= 3.0, < 5.0) - safe_yaml (~> 1.0) - terminal-table (>= 1.8, < 4.0) - webrick (~> 1.7) - jekyll-feed (0.17.0) - jekyll (>= 3.7, < 5.0) - jekyll-sass-converter (3.0.0) - sass-embedded (~> 1.54) - jekyll-theme-centos (2.51.1.beta.56) - jekyll (~> 4.3.0) - jekyll-toc (0.19.0) - jekyll (>= 3.9) - nokogiri (~> 1.12) - jekyll-watch (2.2.1) - listen (~> 3.0) - kramdown (2.4.0) - rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) - liquid (4.0.4) - listen (3.9.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) - mercenary (0.4.0) - mini_portile2 (2.8.7) - nokogiri (1.16.6) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - nokogiri (1.16.6-aarch64-linux) - racc (~> 1.4) - nokogiri (1.16.6-arm-linux) - racc (~> 1.4) - nokogiri (1.16.6-arm64-darwin) - racc (~> 1.4) - nokogiri (1.16.6-x86-linux) - racc (~> 1.4) - nokogiri (1.16.6-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.16.6-x86_64-linux) - racc (~> 1.4) - pathutil (0.16.2) - forwardable-extended (~> 2.6) - public_suffix (6.0.0) - racc (1.8.0) - rake (13.2.1) - rb-fsevent (0.11.2) - rb-inotify (0.11.1) - ffi (~> 1.0) - rexml (3.3.1) - strscan - rouge (4.3.0) - safe_yaml (1.0.5) - sass-embedded (1.77.5) - google-protobuf (>= 3.25, < 5.0) - rake (>= 13) - sass-embedded (1.77.5-aarch64-linux-android) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-aarch64-linux-gnu) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-aarch64-linux-musl) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-aarch64-mingw-ucrt) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-arm-linux-androideabi) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-arm-linux-gnueabihf) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-arm-linux-musleabihf) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-arm64-darwin) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-riscv64-linux-android) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-riscv64-linux-gnu) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-riscv64-linux-musl) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86-cygwin) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86-linux-android) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86-linux-gnu) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86-linux-musl) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86-mingw-ucrt) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86_64-cygwin) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86_64-darwin) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86_64-linux-android) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86_64-linux-gnu) - google-protobuf (>= 3.25, < 5.0) - sass-embedded (1.77.5-x86_64-linux-musl) - google-protobuf (>= 3.25, < 5.0) - strscan (3.1.0) - terminal-table (3.0.2) - unicode-display_width (>= 1.1.1, < 3) - thread_safe (0.3.6) - tzinfo (1.2.11) - thread_safe (~> 0.1) - tzinfo-data (1.2024.1) - tzinfo (>= 1.0.0) - unicode-display_width (2.5.0) - wdm (0.1.1) - webrick (1.8.1) - -PLATFORMS - aarch64-linux - aarch64-linux-android - aarch64-linux-gnu - aarch64-linux-musl - aarch64-mingw-ucrt - arm-linux - arm-linux-androideabi - arm-linux-gnu - arm-linux-gnueabihf - arm-linux-musl - arm-linux-musleabihf - arm64-darwin - riscv64-linux-android - riscv64-linux-gnu - riscv64-linux-musl - ruby - x86-cygwin - x86-linux - x86-linux-android - x86-linux-gnu - x86-linux-musl - x86-mingw-ucrt - x86_64-cygwin - x86_64-darwin - x86_64-linux-android - x86_64-linux-gnu - x86_64-linux-musl - -DEPENDENCIES - jekyll (~> 4.3.0) - jekyll-feed - jekyll-theme-centos (= 2.51.1.beta.56) - jekyll-toc - tzinfo (~> 1.2) - tzinfo-data - wdm (~> 0.1.1) - -BUNDLED WITH - 2.3.25 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d371e7a --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +all: + +site-l10n: + podman run --rm \ + --name $@ \ + -v $$PWD/:/site:z \ + --env JEKYLL_SOURCE_DIR=/site \ + --env JEKYLL__site_DIR=/site/_site \ + registry.gitlab.com/centos/artwork/centos-web/templates/jekyll-site-l10n:latest \ + /usr/local/bin/page-locale.sh + +.PHONY: site-server +site-server: clean + install -d _site + podman run --rm -d \ + --name jekyll-theme-centos-$@ \ + -v $$PWD/:/site:z \ + -p 0.0.0.0:4000:4000 \ + registry.gitlab.com/centos/artwork/centos-web/jekyll-theme-centos:latest \ + bundle exec jekyll serve -H 0.0.0.0 -p 4000 --config /site/_config.yml -s /site -d /site/_site + +.PHONY: site +site: clean + install -d _site + podman run --rm -d \ + --name jekyll-theme-centos-$@ \ + -v $$PWD/:/site:z \ + registry.gitlab.com/centos/artwork/centos-web/jekyll-theme-centos:latest \ + bundle exec jekyll build --config /site/_config.yml -s /site -d /site/_site + +site-html-prettier: site + podman run --rm \ + --name $@ \ + -v $$PWD/_site:/_site:z \ + registry.gitlab.com/centos/artwork/centos-web/pipelines/toolbox/npm-prettier:latest \ + npx prettier --ignore-path /srv/toolbox/npm-prettier/.prettierignore -w "/_site/**/*.html" + +site-html-validate: site-html-prettier + podman run --rm \ + --name $@ \ + -v $$PWD/_site:/_site:z \ + registry.gitlab.com/centos/artwork/centos-web/pipelines/toolbox/npm-htmlvalidate:latest \ + npx html-validate --config=/srv/toolbox/npm-htmlvalidate/.htmlvalidate.json /_site + +.PHONY: clean +clean: + $(RM) -r _site diff --git a/README.md b/README.md index 2a7d06b..49fb650 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ The CentOS.org website is using the following tools: - * [jekyll](https://jekyllrb.com/) 4 - * [bootstrap](https://getbootstrap.com/) 4. + * [jekyll](https://jekyllrb.com/) 4.3 + * [bootstrap](https://getbootstrap.com/) 5.3. * [podman](https://podman.io) (but should work with other know containers solutions too) ## Contributing to changes to this repo @@ -34,24 +34,6 @@ Let's first clone git repo and ensure that some files in container will be owned pushd ${git_directory} test -d centos.org || git clone ${git_upstream} - for i in .jekyll-cache vendor vendor/bundle _site ; do - podman unshare mkdir -p ${git_directory}/centos.org/${i} - podman unshare chown -R $(id -u):$(id -u) ${git_directory}/centos.org/${i} - done - podman unshare chown -R $(id -u):$(id -u) ${git_directory}/centos.org/Gemfile.lock - popd - -Let's now for the first time launch jekyll: - - podman images |grep -q jekyll || podman run --volume="${git_directory}/centos.org:/srv/jekyll:z" --volume="${git_directory}/centos.org/vendor/bundle:/usr/local/bundle:z" --rm -it jekyll/jekyll bundle update - -If that works, you'll have everything you need. You can then render/build the -website (under _site directory) like this: - - podman run --volume="${git_directory}/centos.org:/srv/jekyll:z" \ - --volume="${git_directory}/centos.org/vendor/bundle:/usr/local/bundle:z" \ - --rm -it jekyll/jekyll jekyll build - ## Running ### Development @@ -59,12 +41,17 @@ website (under _site directory) like this: The better way to work on local changes is to have jekyll to automatically "watch" for local changes, and rebuild automatically on the fly when it detects that files were added/modified. To do this, and then to be able to browse -"live" onhttp://localhost:4000, launch Jekyll like this: - - podman run --volume="${git_directory}/centos.org:/srv/jekyll:z" \ - --volume="${git_directory}/centos.org/vendor/bundle:/usr/local/bundle:z" \ - -p 4000:4000/tcp \ - --rm -it jekyll/jekyll jekyll serve +"live" on http://localhost:4000, launch Jekyll like this: + +``` +install -d public +podman run --rm -d \ + --name jekyll-theme-centos-site-server \ + -v $PWD/:/site:z \ + -p 0.0.0.0:4000:4000 \ + registry.gitlab.com/centos/artwork/centos-web/jekyll-theme-centos:latest \ + bundle exec jekyll serve -H 0.0.0.0 -p 4000 --config /site/_config.yml -s /site -d /site/public +``` ### Production @@ -76,37 +63,14 @@ using systemd. In this configuration the web server should be configured to expose the `${git_directory}/centos.org/_site/` directory as document root, the place where jekyll build command renders the final files. -1. Create a detached container running `jekyll build --watch` command: - - podman run -d --volume="${git_directory}/centos.org:/srv/jekyll:z" \ - --volume="${git_directory}/centos.org/vendor/bundle:/usr/local/bundle:z" \ - -it --name www.centos.org docker.io/jekyll/jekyll:latest jekyll build --watch - -2. Use podman-generate-systemd(1) command to create the systemd service unit - under the `~/.config/systemd/user/` directory. If this directory doesn't - exist, create it. - - cd ~/.config/systemd/user/ - podman generate systemd --files --name www.centos.org - -3. Stop the container previously created. Don't remove it. It will be - controlled by systemd. - - podman stop www.centos.org - -4. Enable and start the container using systemctl command. - - systemctl --user enable container-www.centos.org.service - systemctl --user start container-www.centos.org.service - -5. To start the service at system start and persist over user logouts, enter - (as root user): - - loginctl enable-linger - -Reference: - -* https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/building_running_and_managing_containers/porting-containers-to-systemd-using-podman_building-running-and-managing-containers +``` +install -d public +podman run --rm -d \ + --name jekyll-theme-centos-site \ + -v $PWD/:/site:z \ + registry.gitlab.com/centos/artwork/centos-web/jekyll-theme-centos:latest \ + bundle exec jekyll build --config /site/_config.yml -s /site -d /site/public +``` ### Opening a PR (Merge request) diff --git a/_config.yml b/_config.yml index b8baa85..49ad641 100644 --- a/_config.yml +++ b/_config.yml @@ -173,5 +173,6 @@ defaults: exclude: - _locales + - Makefile permalink: /:path/:basename/