jack / centos / centos.org

Forked from centos/centos.org 2 years ago
Clone
Blob Blame History Raw
# centos-jekyll-sites

Community effort to redesign CentOS websites using
[jekyll](https://jekyllrb.com/) 4 and [bootstrap](https://getbootstrap.com/) 4.

## Installation

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):

 * git_upstream="https://git.stg.centos.org/centos/centos.org.git"
 * 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}

for i in .jekyll-cache vendor vendor/bundle _site ; do 
 podman unshare mkdir -p ${git_directory}/centos.org/${i}
 podman unshare chown -R 1000:1000 ${git_directory}/centos.org/${i}
done
podman unshare chown -R 1000:1000 ${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
```

If you want to also edit file and have jekyll automatically rebuild the site when files are added/updated, you can run with with --watch
```
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 --watch

```

Viewing website locally (so point browser to http://localhost:4000 : 
```
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

```