-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build website locally with rootless podman #207
base: master
Are you sure you want to change the base?
Build website locally with rootless podman #207
Conversation
Thank you for your contribution. If anyone else reading this is able to test the new instructions and confirm they work (for the purpose of independent verification), then we can probably consider this as having passed review and merge it. |
This currently fails for me with this error:
|
b66c99b
to
65edd7a
Compare
Jekyll will attempt to compile native extensions for certain dependencies. These will fail without the necessary packages installed. The jekyll/jekyll container can install additional packages located in a '.apk' file. The 'bigdecimal' Ruby dependency requires 'gcc' and 'musl-dev' be available. The 'json' Ruby dependency requires 'make' be available. The 'unf_ext' Ruby dependency requires 'g++' be available. The 'ffi' Ruby dependency requires 'linux-headers' be available.
Creates a new Make target 'rootless' that seeks to avoid the need for routine use of elevated privileges. Initial installation of podman, git, and other tools into the template as root is necessary. Running the development loop as an unprivileged user in the app qube avoids unneeded access. An additional benefit is seen with standard app qubes. Running the process with 'sudo' will write files such as the container images to the volatile parts of storage. The user would need to re-download the container images after each qube restart.
SELinux may deny permissions to the Jekyll container preventing it from reading the website files. The 'Z' option instructs podman to apply a private unshared label to the files on the host allowing the container access.
The '--rm' flag removes the container when it exits. If the intention of using containers is to create a more consistent development environment, explicitly removing the container between runs will help prevent inconsistencies due to a container's internal state. The image upon which the container is based is untouched by this flag.
Webrick used to be part of the Ruby standard library in version 2. It was removed in Ruby version 3. Jekyll lists webrick as a dependency. It does not install it by default, however. Jekyll can be used to simply build a website and then a different program can serve it. Webrick is only needed if Jekyll will need to serve files. The command run in the podman container is 'jekyll serve' and will require webrick. As webrick is not needed if Jekyll is only building the website, the gem statement is conditional upon an environment variable set by the podman command.
65edd7a
to
1bf9eed
Compare
I see a workflow without using containers was approved in #237. I would rather avoid the extra complexity of containers if there is not a significant benefit from it. Irregardless, here is the solution to getting the podman workflow functioning on Fedora 38 XFCE. Permission denied problems were resolved by having podman label the website repository with a SELinux label. Webrick was added as a conditional dependency. The bigdecimal error (among others) was resolved by installing additional build tools with a '.apk' file. This was tested in a disposableVM based on the fedora-38-xfce template with only updates applied. One shortcoming of this current patch vs the 'bare-metal' Ruby approach is this patch requires network access each time the container is started. The ephemeral container needs to download packages from the Alpine repositories and then the Ruby gems as these are not in the base image. If there is strong interest in maintaining the container-based workflow, these steps could be baked into the image to allow offline use. |
This change is a minor optimization for local builds.
The end result is similar to the current podman-compose instructions for the user.
Tested in a qube based on the default fedora-36.
Creates make target 'rootless' based on docker-compose.yml
The 'rootless' target:
sudo
to build the website locally.You may still need to add
gem 'webrick'
to the Gemfile for the website to build based on this pull request.