- 2025-12-04: Added `scripts/build_site.rb` to read the JSON-based config, echo the `VERSION`, respect `LANGUAGES` overrides, emit `dynamic/selected-languages.yml`, log failures into `build_site.err.txt`, and run Jekyll through the generated config so Docker and development use the same workflow.
- 2025-12-04: Centralized install-mode metadata in `htdocs/_data/install_modes.yml`, normalized the string keys in `devices.html`, and let the template honor shared URLs/labels plus per-device overrides instead of duplicating the logic.
- 2025-12-04: Implemented the compatibility scoring table inside `htdocs/_i18n/en/pages/devices.html`, scoring each device on bootloader state, build type, certification status, Play Integrity, Rootbeer results, and channel weight, while FP6 and Sunfish now expose the input map.
- 2025-12-03: Noted that the public Docker image `jekyll/jekyll:4` is the supported tag that bundles the Jekyll 4.4.1 runtime required for this project.
- 2025-12-03: Documented the docker commands (`docker run --rm -v "$PWD/htdocs:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll:4 jekyll serve`) to regenerate the Gemfile.lock and to serve the site locally for validation after dependency bumps.
- 2025-12-03: Adopted `hadolint` (via `docker run --rm -i hadolint/hadolint < Dockerfile.jekyll`) as the targeted lint step for Dockerfile updates and combined related RUN commands to satisfy rule DL3059.
The current documentation uses [Jekyll](https://jekyllrb.com/docs) as the static site generator. [Docker](https://www.docker.com/) is required to run the project.
# e.foundation Documentation Site
# How to run
## Overview
The documentation site is a **multi-language Jekyll** project that publishes the /e/ community documentation with an ElasticSearch-backed search layer. A dedicated Docker image (see `Dockerfile`) now orchestrates builds through a helper script that prints the configured version and dynamically limits the languages that are compiled.
## Jekyll container only
## Prerequisites
- Docker (20.10+)
-`docker-compose` 1.29+ for the ElasticSearch + bridge stack
- When working locally without Docker, Ruby 3.x (comes preinstalled inside the `jekyll/jekyll:4` container) is required to run `scripts/build_site.rb` manually.
For faster development process, the following command is recommended:
## Installation & Initialization
1. Clone the repository and enter the directory.
2. Copy the development environment file and customize values:
5. The site is served through NGINX at the host configured in `.env` (default `edocs.local`).
## Configuration
All non-confidential constants live in `config/param.json`. Each entry has a matching environment variable of the same name and the schema is documented in `config/param.json.example`. Update the `VERSION` field in the example file (format `x.y.z`, bump `z`) whenever you make a user-facing change so debugging reflects the current build.
| `VERSION` | `0.0.1` | Version exposed every time the build script runs; used by the Docker build stage for transparency. | `x.y.z` string; bump `z` per request. |
| `LANGUAGES` | `["en","fr","it","es","de"]` | Languages that are compiled by default. Override with the `LANGUAGES` environment variable to restrict the build (e.g. `LANGUAGES=en`). | JSON array of ISO codes; the script falls back to this value when the env var is absent. |
| `BUILD_OUTPUT_DIR` | `/tmp/e_docs_website` | Directory where Jekyll writes the generated HTML. | String path; can be changed via the `BUILD_OUTPUT_DIR` env var for testing. |
| `JEKYLL_CONFIG` | `_config.yml` | Base Jekyll config file(s). The build script appends the generated language override file (see below). | Can be a comma-separated list; override via `JEKYLL_CONFIG` env var if you need extra config files. |
Secrets belong in `config/secret.json` (copy the `.example` version) and are never checked into production. Keep actual secrets local and, if needed, add their keys to the `secret.json.example` template before sharing the repository.
### Personalization files
Any artifact that is personalized per user or environment is stored under the `dynamic/` directory. The repository tracks only `dynamic/.gitkeep`; everything else under `dynamic/` is ignored. The build script writes `dynamic/selected-languages.yml` on every run to override the `languages` key for Jekyll (see next section).
## Build & Development Workflow
### Language-aware builds with the helper script
`Dockerfile` now relies on `scripts/build_site.rb` instead of calling `jekyll build` directly. This script:
- Parses `config/param.json` and respects the `LANGUAGES` env var when provided (comma-separated values).
- Prints the configured `VERSION` before the build begins.
- Generates `dynamic/selected-languages.yml` so the language filter is passed to Jekyll via `--config`.
- Logs fatal errors into `build_site.err.txt` (emptied at startup) with UTC timestamps.
To build only one language locally and save time during development, run:
```bash
docker run \
--rm\
LANGUAGES=en ruby scripts/build_site.rb
```
You can also set `BUILD_OUTPUT_DIR` and `JEKYLL_CONFIG` if you need custom targets:
docker run --rm--volume="$PWD/htdocs:/srv/jekyll"-p 4000:4000 -it jekyll/jekyll:4 jekyll serve
```
## Error Reporting
Every run of `scripts/build_site.rb` clears `build_site.err.txt` and appends only fatal log entries with timestamps. Inspect this file before making changes so you can resolve the most recent failure faster.
## Full compose stack (search)
## Compatibility scoring
The `/devices` page now computes an aggregated compatibility score instead of relying solely on Safetynet/Rootbeer flags. Each device entry in `htdocs/_data/devices` can supply the following `compatibility` map, and those values are rendered directly inside `htdocs/_i18n/en/pages/devices.html`:
Add `edocs.local` to your `/etc/hosts` or customize `NGINX_HOST` in .env as desired.
| Key | Points | Notes |
|---|---|---|
| `bootloader` | `locked_green`: 2, `locked_yellow`: 1, other: 0 | Human-friendly labels appear on the site; extra strings (e.g., `unlockable`) are supported. |
| `build_type` | `user`: 1, `userdebug`: 0 | Defaults to “Not declared” when missing. |
Example data for FP6 and Sunfish are already present inside their respective YAML files. Devices without the map still render a score (using the defaults above) so the column never breaks.
# Deployment
## File Layout
-`Dockerfile`: multi-stage container that builds the site and packages it behind the NGINX image.
-`docker-compose*.yml`: orchestrate NGINX, ElasticSearch, and the bridge server for search indexing.
-`scripts/build_site.rb`: orchestrates the Jekyll build, prints the version, filters languages, and logs errors.
-`config/param.json`, `config/param.json.example`: store configurable constants and documentation for defaults.
-`dynamic/`: personalization files (ignored by Git); `selected-languages.yml` lives here.
-`build_site.err.txt`: log of the last fatal error emitted by the helper script.
Since this project depends on [ElasticSearch](https://www.elastic.co/), the deployment should follow the recommended approach and configuration as detailed in [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html)
## Tips
- Update the version in `config/param.json` and the example file whenever you implement behavior the user should be aware of.
- Use `LANGUAGES=en,fr` to build a smaller subset when focusing on a few locales.
- The helper script ensures you always see the documented version number before the build begins, simplifying troubleshooting in CI.