Forgejo — Pedagogical Local Git¶
Role in the stack¶
Forgejo is a lightweight self-hosted Git server, integrated directly into the PerfShop stack. It replaces the external GitLab for test scripts — students work on a local repository, with no external network dependency.
perfshop-forgejo ← Git server (SQLite, Synology NAS compatible)
perfshop-forgejo-seed ← automatic init at every "docker compose up" (restart: no, idempotent)
Access¶
| Environment | URL | Login |
|---|---|---|
| NAS prod | https://perfshop-git.perfshop.io |
forgejo-admin / perfshop |
| Docker Desktop / local build | http://localhost:3009 |
forgejo-admin / perfshop |
Accounts¶
| Account | Role | Login | Password |
|---|---|---|---|
forgejo-admin |
Instance administrator | forgejo-admin |
perfshop |
perfshop-ci |
Technical CI/CD account | perfshop-ci |
perfshop |
The forgejo-admin account is created by perfshop-forgejo-seed: the Forgejo CLI is run inside the
perfshop-forgejo container through the Docker API, by way of the perfshop-docker-relay relay — which grants
the seed only commands in that container, as user git
(Docker socket: the relay). The GITEA_ADMIN_USERNAME /
GITEA_ADMIN_PASSWORD variables passed to perfshop-forgejo create no account (Forgejo 14,
measured on 2026-09-28 on a fresh instance).
The perfshop-ci account and the perfshop-tests repository are created by perfshop-forgejo-seed.
perfshop-tests repository¶
The main repository contains all the test scripts:
| Script | Type | Description |
|---|---|---|
smoke-test.robot |
Robot Framework | Checks that the API responds with HTTP 200 |
CT-002-prix-coherence.robot |
Robot Framework | Catalog-vs-cart price consistency (Selenium) |
run-pytest.robot |
Robot Framework | Generic wrapper for pytest scripts |
test_prix_panier.py |
pytest / Selenium | CT-003 — end-to-end cart price check |
Automatic script import
perfshop-forgejo-seed walks the .robot, .py and .json files of test-runner/scripts/
(subfolders included, hidden folders and __pycache__ excluded), mounted read-only, and pushes
them into Forgejo: new file → added, modified file → updated, identical file → nothing. A script
dropped in this folder is in Forgejo at the next docker compose up, without rebuilding any image.
Technical architecture¶
perfshop-forgejo:
image: codeberg.org/forgejo/forgejo:14
volumes:
- forgejo-data:/data ← SQLite + Git repositories
environment:
- FORGEJO__database__DB_TYPE=sqlite3
- FORGEJO__database__PATH=/data/gitea/forgejo.db
- FORGEJO__security__INSTALL_LOCK=true
- GITEA_ADMIN_USERNAME=forgejo-admin ← no effect on Forgejo 14: the admin is created by the seed
- GITEA_ADMIN_PASSWORD=perfshop
Critical SQLite path
The database path must be /data/gitea/forgejo.db (not /data/forgejo.db).
Forgejo creates the /data/gitea/ directory on startup — the DB at the /data/ root
triggers an unable to open database file: no such file or directory error.
Shared API token¶
The seed generates an API token for perfshop-ci and stores it in the forgejo-token-data volume.
This volume is shared read-only with perfshop-scripts-ui, which uses it to push
modified scripts to Forgejo.
forgejo-token-data volume
├── written by: perfshop-forgejo-seed (/token/forgejo_token)
└── read by : perfshop-scripts-ui (/token/forgejo_token — read-only)
Seed — idempotent behavior¶
The forgejo-seed/seed.py seed runs at every docker compose up without duplicating anything:
- If
forgejo-admin,perfshop-cior the repositories already exist → nothing is recreated or modified - If the token in the volume still opens the repository → it is reused (its validity is tested on the
repository: a repository-scoped token gets 403 on
/api/v1/user) - Otherwise (volume recreated, token revoked) → the old token with the same name is deleted, a new one is created
- Identical script in the repository → nothing (no empty commit); modified → updated; new → added
It only uses the Python standard library (python:3.11-slim image, nothing is downloaded or built at
startup). Exit code: 0 if everything is in place, 1 otherwise (docker compose ps -a →
Exited (1)); perfshop-squash-seed only starts after its success.
Integration with Squash TM¶
Squash TM connects to Forgejo to clone the scripts before every execution.
| Squash field | Value |
|---|---|
| SCM type | Git |
| URL | http://perfshop-forgejo:3000/perfshop-ci/ |
| Login | perfshop-ci |
| Password | perfshop |
| Repository | perfshop-tests (branch main) |
See Squash TM Configuration for the complete guide.
Useful commands¶
# Check the Forgejo status
docker compose logs perfshop-forgejo | tail -20
# Re-run the seed after modifying the scripts
docker compose rm -f perfshop-forgejo-seed
docker compose up -d perfshop-forgejo-seed
docker compose logs -f perfshop-forgejo-seed
# Create the admin manually (deployment where the seed does not have the Docker relay socket)
docker exec -it -u git perfshop-forgejo \
forgejo admin user create \
--username forgejo-admin \
--password 'perfshop' \
--email forgejo-admin@perfshop.fr \
--admin
# List the users
docker exec -it -u git perfshop-forgejo forgejo admin user list