jack / centos / centos.org

Forked from centos/centos.org 2 years ago
Clone

Blame README.md

43807c
# CentOS.org website
e8ec7a
43807c
The CentOS.org website is using the following tools:
e94fa4
43807c
 * [jekyll](https://jekyllrb.com/) 4 
43807c
 * [bootstrap](https://getbootstrap.com/) 4.
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
43807c
```
43807c
sudo yum install slirp4netns podman git
43807c
```
43807c
43807c
### Cloning this repo, from your forked version
43807c
43807c
You should first login with your [ACO](https://accounts.centos.org) login on https://git.centos.org, and then fork this repo (if not already done)
43807c
43807c
Once done, you'll have to clone your fork locally, and submit changes.
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.
43807c
b70eff
Let's assume the following (so feel free to update):
e94fa4
43807c
 * git_upstream="ssh://git@git.centos.org/forks/<ACO_LOGIN>/centos/centos.org.git" # replace with your ACO username
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 : 
43807c
b70eff
```
43807c
podman run --volume="${git_directory}/centos.org:/srv/jekyll:z" \
43807c
  --volume="${git_directory}/centos.org/vendor/bundle:/usr/local/bundle:z" \
43807c
  --rm -it jekyll/jekyll jekyll build
b70eff
```
e8ec7a
43807c
The better way to work on changes is to have jekylly 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 :
7f616c
b70eff
```
43807c
podman run --volume="${git_directory}/centos.org:/srv/jekyll:z" \
43807c
  --volume="${git_directory}/centos.org/vendor/bundle:/usr/local/bundle:z" \
43807c
  -p 4000:4000/tcp \
43807c
  --rm -it jekyll/jekyll jekyll serve
b70eff
```
4f7719
43807c
### Opening a PR (Merge request)
43807c
Once you're satisfied with local changes, proceed as usual : 
43807c
 
43807c
 * `git commit` and `git push` to origin (your fork)
43807c
 * open PR on git.centos.org  
43807c
43807c
### Reviewing a PR (for admins)
43807c
When someone will open a PR, there is a way to pull locally the proposed changed and render locally.
43807c
We can apply the method above with "jekyll serve" but we can pull locally.
43807c
On each PR, there is a link at bottom named "Pull this pull-request locally" with a link to instructions.
43807c
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.
43807c
If it is, you can go back to git.centos.org, and then either comment (if you need some changes) or just `merge` it.
43807c
Merging it in main branch will automatically means that website will be rebuild and pushed in the next minute[s] to www.centos.org nodes.
43807c
4f7719
aa77f5