Skip to content

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 on first startup (restart: no)

Access

Environment URL Login
NAS prod https://perfshop-git.perfshop.io forgejo-admin / PerfShop2026!
Docker Desktop / local build http://localhost:3009 forgejo-admin / PerfShop2026!

Accounts

Account Role Login Password
forgejo-admin Instance administrator forgejo-admin PerfShop2026!
perfshop-ci Technical CI/CD account perfshop-ci perfshop

The forgejo-admin account is created automatically on first startup via the GITEA_ADMIN_USERNAME / GITEA_ADMIN_PASSWORD environment variables in the compose file.

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 scans all .robot and .py files present in test-runner/scripts/ and pushes them automatically into Forgejo. Any new script dropped in this folder will be present in Forgejo on the next seed restart.


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   ← admin creation on 1st boot
    - GITEA_ADMIN_PASSWORD=PerfShop2026!

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 is designed to run multiple times without errors:

  • If perfshop-ci already exists → no recreation
  • If the token exists in the volume → reused without recreation
  • If a token with the same name exists in Forgejo → deleted and recreated (avoids the 409)
  • If the scripts already exist in the repository → updated via SHA (PUT instead of POST)

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 Squash2026/*
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 (if GITEA_ADMIN_* not working)
docker exec -it -u git perfshop-forgejo \
  forgejo admin user create \
  --username forgejo-admin \
  --password 'PerfShop2026!' \
  --email forgejo-admin@perfshop.fr \
  --admin

# List the users
docker exec -it -u git perfshop-forgejo forgejo admin user list