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
401d07
final site using jekyll in Fedora 31.
e94fa4
401d07
1. Clone this repository:
e94fa4
401d07
       ]$ git clone git@github.com:areguera/centos-jekyll-sites.git
e94fa4
401d07
1. Download jekyll container:
e94fa4
401d07
       ]$ podman pull jekyll/jekyll
e94fa4
401d07
2. Create an alias to run jekyll container by adding the following line to
401d07
`~/.bashrc`:
e94fa4
401d07
       ]$ alias jekyll='podman run --volume="$PWD:/srv/jekyll:z" --volume="$PWD/vendor/bundle:/usr/local/bundle:z" -p 4000:4000/tcp --rm -it jekyll/jekyll jekyll'
e8ec7a
401d07
3. Reload the `./bashrc` file:
7f616c
401d07
       ]$ source ~/.bashrc
fdc62c
401d07
4. Update directory permissions using the container user namespace uid (1000)
401d07
and gid (1000). This is necessary for jekyll inside the container to be able of
401d07
writing in the host filesystem through the specified volumes:
4f7719
401d07
       ]$ podman unshare chown 1000:1000 centos-jekyll-sites
4f7719
401d07
  The permissions must be applied to all the files and directories jekyll reads
401d07
  and writes to (e.g., `_site` for the final site, `vendor/bundle` for bundle
401d07
  cache, `.jekyll-cache`, etc.). Once the files permission have been changed
401d07
  this way you will see them using a high number (e.g., 100999). This number is
401d07
  the subordinate uid and gid the host uses to related to container user
401d07
  namespace uid and gid (e.g., 1000).
aa77f5
401d07
5. Create the `vendor/bundle` directory inside the `centos-jekyll-site`
401d07
directory:
fdc62c
401d07
       ]$ podman unshare mkdir -p vendor/bundle
7f616c
401d07
At this point you should be able to run the following:
401d07
401d07
    ]$ jekyll -v
401d07
    ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux-musl]
401d07
    jekyll 4.0.0
401d07
401d07
The first time you run jekyll it takes some time downloading all the gems and
401d07
dependencies it needs. After this first download, it behaves like a regular
401d07
command.
401d07
401d07
# Accessing the final site
401d07
401d07
To access the final site you need to be inside the repository directory
401d07
structure, where the `Gemfile` is, and run the following:
401d07
401d07
    ]$ jekyll serve
401d07
401d07
Then visit the site accessing to http://127.0.0.1:4000 in your host.
401d07
401d07
# Making changes
401d07
401d07
Operations like editing, copying, creating, moving and removing files owned by
401d07
by jekyll container user namespace uid and gid must be executed using `podman
401d07
unshare <command> [arg]`. Otherwise, you may have permission issues. For
401d07
example, to edit jekyll main configuration, run the following command:
401d07
401d07
    ]$ podman unshare nvim _config.yml
401d07
401d07
## Additional resources
401d07
401d07
* https://github.com/envygeeks/jekyll-docker/blob/master/README.md
401d07
* https://www.redhat.com/sysadmin/rootless-podman-makes-sense