dcavalca / centos / centos.org

Forked from centos/centos.org a month ago
Clone
README.md

CentOS.org website

The CentOS.org website is using the following tools:

Contributing to changes to this repo

Needed tools

Just ensure that you have git, podman installed on your CentOS, Fedora workstation (or any other linux distro, just showing this as example):

sudo yum install slirp4netns podman git

Cloning this repo, from your forked version

You should first login with your ACO login on https://git.centos.org, and then fork this repo (if not already done)

Once done, you'll have to clone your fork locally, and submit changes. This section describes the steps you need to follow in order to render the final site using jekyll in Fedora 31/CentOS 8, with rootless container.

Let's assume the following (so feel free to update):

export git_upstream="ssh://git@git.centos.org/forks/<ACO_LOGIN>/centos/centos.org.git" # replace with your ACO username
export git_directory="${HOME}/git/" # where you'll git clone git repo

Let's first clone git repo and ensure that some files in container will be owned by jekyll:

test -d ${git_directory} || mkdir -p ${git_directory}
pushd ${git_directory}
test -d centos.org || git clone ${git_upstream}

Running

It's worth knowing that this git repository contains a container.specs that you should use (source it) to ensure you point to correct container path/tag (see below) Using that tag permits to also just test , based on branch, by updating that container.specs file, the container path but also version to use.

Development

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" on http://localhost:4000, launch Jekyll like this:

cd ${git_directory}/centos.org
source container.specs
podman images --format "{{.Repository}}:{{.Tag}}"|grep -q ${container_path}:${container_tag} || podman pull ${container_path}:${container_tag}
podman run --rm -d \
    --name jekyll-theme-centos-site-server \
    -v $PWD/:/site:z \
    -p 0.0.0.0:4000:4000 \
    ${container_path}:${container_tag} \
    bundle exec jekyll serve -H 0.0.0.0 -p 4000 --config /site/_config.yml -s /site -d /site/_site

Production

The jekyll serve command fits well on development environments, however when you want to use a more robust web server (e.g., Apache, Nginx) in production environments the jekyll serve command may be not appropriate. Instead, you may use the jekyll build --watch command inside a container and control it 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.

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/_site

Opening a PR (Merge request)

Once you're satisfied with local changes, proceed as usual:

  • git commit and git push to origin (your fork)
  • open PR on git.centos.org

Reviewing a PR (for admins)

When someone will open a PR, there is a way to pull locally the proposed changed and render locally. We can apply the method above with "jekyll serve" but we can pull locally. On each PR, there is a link at bottom named "Pull this pull-request locally" with a link to instructions. If you proceed, that will create a new temporary branch named pr<number>, so you can then git checkout pr<number>, render website automatically and see if that looks ok. If it is, you can go back to git.centos.org, and then either comment (if you need some changes) or just merge it. Merging it in main branch will automatically means that website will be rebuilt and pushed in the next minute[s] to www.centos.org nodes.