yifengyou / centos / centos.org

Forked from centos/centos.org 3 years ago
Clone

Blame README.md

401d07
# centos-jekyll-sites
e8ec7a
401d07
Community effort to redesign CentOS websites using
401d07
[jekyll](https://jekyllrb.com/) 4 and [bootstrap](https://getbootstrap.com/) 4.
e94fa4
401d07
## Installation
e94fa4
401d07
This section describes the steps you need to follow in order to render the
b70eff
final site using jekyll in Fedora 31/CentOS 8, with rootless container.
b70eff
Let's assume the following (so feel free to update):
e94fa4
b70eff
 * git_upstream="https://git.stg.centos.org/centos/centos.org.git"
b70eff
 * git_directory="$HOME/git/" # where you'll git clone git repo
e94fa4
b70eff
Let's first clone git repo and ensure that some files in container will be owned by jekyll :
b70eff
```
b70eff
test -d ${git_directory} || mkdir -p ${git_directory}
b70eff
pushd ${git_directory}
b70eff
test -d centos.org || git clone ${git_upstream}
e94fa4
b70eff
for i in .jekyll-cache vendor vendor/bundle _site ; do 
b70eff
 podman unshare mkdir -p ${git_directory}/centos.org/${i}
b70eff
 podman unshare chown -R 1000:1000 ${git_directory}/centos.org/${i}
b70eff
done
b70eff
podman unshare chown -R 1000:1000 ${git_directory}/centos.org/Gemfile.lock
b70eff
popd
b70eff
```
e94fa4
b70eff
Let's now for the first time launch jekyll : 
e94fa4
b70eff
```
b70eff
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
b70eff
```
e94fa4
b70eff
If that works, you'll have everything you need. You can then render/build the website (under _site directory) like this : 
b70eff
```
b70eff
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
b70eff
```
e8ec7a
b70eff
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
b70eff
```
b70eff
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
7f616c
b70eff
```
fdc62c
b70eff
Viewing website locally (so point browser to http://localhost:4000 : 
b70eff
```
b70eff
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
4f7719
b70eff
```
4f7719
aa77f5