shaunm / centos / centos.org

Forked from centos/centos.org 2 years ago
Clone
43807c
# CentOS.org website
e8ec7a
43807c
The CentOS.org website is using the following tools:
e94fa4
8845f9
 * [jekyll](https://jekyllrb.com/) 4.3
8845f9
 * [bootstrap](https://getbootstrap.com/) 5.3.
43807c
 * [podman](https://podman.io) (but should work with other know containers solutions too)
e94fa4
43807c
## Contributing to changes to this repo
43807c
43807c
### Needed tools
43807c
43807c
Just ensure that you have git, podman installed on your CentOS, Fedora workstation (or any other linux distro, just showing this as example):
43807c
6b4efb
    sudo yum install slirp4netns podman git
43807c
43807c
### Cloning this repo, from your forked version
43807c
6b4efb
You should first login with your [ACO](https://accounts.centos.org) login on
6b4efb
https://git.centos.org, and then fork this repo (if not already done)
43807c
6b4efb
Once done, you'll have to clone your fork locally, and submit changes.  This
6b4efb
section describes the steps you need to follow in order to render the final
6b4efb
site using jekyll in Fedora 31/CentOS 8, with rootless container.
43807c
b70eff
Let's assume the following (so feel free to update):
e94fa4
6b4efb
    export git_upstream="ssh://git@git.centos.org/forks/<ACO_LOGIN>/centos/centos.org.git" # replace with your ACO username
6b4efb
    export git_directory="${HOME}/git/" # where you'll git clone git repo
e94fa4
6b4efb
Let's first clone git repo and ensure that some files in container will be owned by jekyll:
e94fa4
6b4efb
    test -d ${git_directory} || mkdir -p ${git_directory}
6b4efb
    pushd ${git_directory}
6b4efb
    test -d centos.org || git clone ${git_upstream}
e94fa4
6b4efb
## Running
6b4efb
9c4a9e
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)
9c4a9e
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.
9c4a9e
6b4efb
### Development
6b4efb
6b4efb
The better way to work on local changes is to have jekyll to automatically
6b4efb
"watch" for local changes, and rebuild automatically on the fly when it detects
6b4efb
that files were added/modified. To do this, and then to be able to browse
8845f9
"live" on http://localhost:4000, launch Jekyll like this:
8845f9
8845f9
```
9c4a9e
cd ${git_directory}/centos.org
9c4a9e
source container.specs
9c4a9e
podman images --format "{{.Repository}}:{{.Tag}}"|grep -q ${container_path}:${container_tag} || podman pull ${container_path}:${container_tag}
8845f9
podman run --rm -d \
8845f9
    --name jekyll-theme-centos-site-server \
8845f9
    -v $PWD/:/site:z \
8845f9
    -p 0.0.0.0:4000:4000 \
9c4a9e
    ${container_path}:${container_tag} \
ea3ab8
    bundle exec jekyll serve -H 0.0.0.0 -p 4000 --config /site/_config.yml -s /site -d /site/_site
8845f9
```
6b4efb
6b4efb
### Production
6b4efb
6b4efb
The `jekyll serve` command fits well on development environments, however when
6b4efb
you want to use a more robust web server (e.g., Apache, Nginx) in production
6b4efb
environments the `jekyll serve` command may be not appropriate.  Instead, you
6b4efb
may use the `jekyll build --watch` command inside a container and control it
6b4efb
using systemd.  In this configuration the web server should be configured to
6b4efb
expose the `${git_directory}/centos.org/_site/` directory as document root, the
6b4efb
place where jekyll build command renders the final files.
6b4efb
8845f9
```
8845f9
podman run --rm -d \
8845f9
    --name jekyll-theme-centos-site \
8845f9
    -v $PWD/:/site:z \
8845f9
    registry.gitlab.com/centos/artwork/centos-web/jekyll-theme-centos:latest \
ea3ab8
    bundle exec jekyll build --config /site/_config.yml -s /site -d /site/_site
8845f9
```
4f7719
43807c
### Opening a PR (Merge request)
43807c
6b4efb
Once you're satisfied with local changes, proceed as usual:
43807c
6b4efb
 * `git commit` and `git push` to origin (your fork)
6b4efb
 * open PR on git.centos.org
4f7719
6b4efb
### Reviewing a PR (for admins)
aa77f5
6b4efb
When someone will open a PR, there is a way to pull locally the proposed
6b4efb
changed and render locally.  We can apply the method above with "jekyll serve"
6b4efb
but we can pull locally.  On each PR, there is a link at bottom named "Pull
6b4efb
this pull-request locally" with a link to instructions.  If you proceed, that
6b4efb
will create a new temporary branch named pr<number>, so you can then `git
6b4efb
checkout pr<number>`, render website automatically and see if that looks ok.
6b4efb
If it is, you can go back to git.centos.org, and then either comment (if you
6b4efb
need some changes) or just `merge` it.  Merging it in main branch will
6b4efb
automatically means that website will be rebuilt and pushed in the next
6b4efb
minute[s] to www.centos.org nodes.