From 925190109f6db09999f92198aa9191ebe2cddcb4 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sun, 23 Aug 2026 20:10:07 +0200 Subject: [PATCH] Umzug nach GitLab: CI/CD fuer Tests, Images, APK, Pages und Releases gitea.com hat keinen Actions-Runner, also gab es dort seit dem Umzug weder Container-Images noch einen gebauten APK noch gruene Tests auf Merge Requests. GitLab kann alles vier, also zieht das Projekt dorthin um. .gitlab-ci.yml deckt die komplette Kette ab: - test: Frontend-Suite (346 Tests), Locale-Checks, Fatigue-Probe, MCP-Suite - build: api- und web-Image nach registry.gitlab.com/duartesantos8/opengym/*, auf v*-Tags amd64+arm64 mit latest/X.Y/X.Y.Z, sonst amd64 als edge - package: signierter APK (zipalign + apksigner) plus Upload in die Generic Package Registry; der Key liegt in geschuetzten CI-Variablen und existiert damit nur auf main und v*-Tags - deploy: der Browser-Demo-Build auf GitLab Pages - release: GitLab-Release mit dem passenden CHANGELOG-Abschnitt und Links auf APK und Images GitHub konnte "Tag gepusht" von "Release veroeffentlicht" unterscheiden und hat Images nur aus letzterem gebaut (Issue #87). GitLab kann das nicht - dort ist die Tag-Pipeline das, was das Release anlegt. Die Regel steht deshalb als Kommentar im CI-File, und v*-Tags sind geschuetzt. Ausserdem: Issue-/MR-Vorlagen unter .gitlab/, und saemtliche Repo-Links in README, Docs, App, Dockerfile-Labels, docker-compose und Website zeigen auf GitLab. site.js liest Sterne und Releases jetzt aus der GitLab-API (andere Feldnamen, deshalb neue sessionStorage-Keys). SECURITY.md hat wieder einen privaten Meldeweg: ein vertrauliches Issue. .github/ und .gitea/ bleiben liegen - Spiegel bzw. fuer den Tag, an dem das GitHub-Konto zurueckkommt. --- .gitlab-ci.yml | 316 +++++++++++++++++++++ .gitlab/issue_templates/Bug.md | 42 +++ .gitlab/issue_templates/Feature.md | 16 ++ .gitlab/issue_templates/Question.md | 17 ++ .gitlab/merge_request_templates/Default.md | 16 ++ CHANGELOG.md | 26 ++ CONTRIBUTING.md | 12 +- README.md | 29 +- SECURITY.md | 23 +- api/Dockerfile | 8 +- docker-compose.yml | 4 +- docs/MOBILE.md | 17 +- docs/SELF_HOSTING.md | 4 +- frontend/src/lib/demo.js | 2 +- frontend/src/views/Settings.jsx | 2 +- web/Dockerfile | 8 +- website/README.md | 4 +- website/about.html | 20 +- website/docs.html | 28 +- website/index.html | 28 +- website/site.js | 36 ++- website/styles.css | 2 +- 22 files changed, 562 insertions(+), 98 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 .gitlab/issue_templates/Bug.md create mode 100644 .gitlab/issue_templates/Feature.md create mode 100644 .gitlab/issue_templates/Question.md create mode 100644 .gitlab/merge_request_templates/Default.md diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c9bc278 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,316 @@ +# openGym — GitLab CI/CD +# +# This is the pipeline that actually gates and ships the project. It replaces the +# GitHub Actions workflows (.github/, dormant since the account suspension) and the +# gitea.com ones (.gitea/, kept only so the mirror stays buildable). +# +# What it does, in order: +# test — frontend + MCP suites, on every branch, MR and tag +# build — the two container images → registry.gitlab.com/duartesantos8/opengym/{api,web} +# package — the signed Android APK → job artifact + generic package registry +# deploy — the browser-only demo → GitLab Pages +# release — a GitLab Release with the changelog section and links to APK + images +# +# One deliberate difference from the GitHub copy: GitHub could distinguish a bare tag +# push from a *published* release, and only shipped images from the latter (issue #87 — +# a tag that is later consolidated away must not leave orphan image tags behind). +# GitLab has no such split: the tag pipeline is what creates the Release. So here the +# rule is enforced by hand — **only push a tag when you actually mean to release it.** +# Everything version-tagged (latest images, signed APK, Release) hangs off `v*` tags, +# which are protected, so nobody else can trigger a release either. + +stages: + - test + - build + - package + - deploy + - release + +variables: + # node:22-alpine in web/Dockerfile and api/Dockerfile — CI must match production. + NODE_IMAGE: "node:22-alpine" + # The demo build has no backend and no local media: the exercise images/GIFs (~140 MB) + # are never committed, so it points at the upstream dataset on jsDelivr, pinned to a + # commit so the CDN can cache it forever. + DATASET: "https://cdn.jsdelivr.net/gh/hasaneyldrm/exercises-dataset@7455efae41b330c265e7cd4b78dfa848e7ce5ebd" + GIT_DEPTH: "50" + +# Branch pipeline *or* MR pipeline, never both for the same commit. +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS + when: never + - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH + +# ---------------------------------------------------------------------------- test + +.node: + image: $NODE_IMAGE + interruptible: true + +test:frontend: + extends: .node + stage: test + cache: + key: + files: + - frontend/package-lock.json + paths: + - frontend/.npm + script: + - cd frontend + - npm ci --cache .npm --prefer-offline + - npm test + # A broken import or bad JSX fails the build long before any test covers it. + - npm run build + - node scripts/check-locales.mjs + # check-locales compares the packs to each other, so a key missing from ALL of them is + # invisible to it. This walks src/ instead. Report-only for now: there is a known + # backlog of untranslated demo-view strings to clear before it can fail the build. + - node scripts/check-source-strings.mjs + # The fatigue model must never read higher after a rest day than before it. + # Property probe over ~108k comparisons; too slow for the unit suite, cheap here. + - npm run test:fatigue-probe + +test:mcp: + extends: .node + stage: test + cache: + key: + files: + - mcp/package-lock.json + paths: + - mcp/.npm + script: + - cd mcp + - npm ci --cache .npm --prefer-offline + - npm test + # The one check the vitest suite structurally cannot make. The MCP server is a bare node + # process, but vitest runs its tests through Vite — import.meta.glob, .jsx imports and + # ?raw all resolve happily there. That is how a Vite-only import reached a shared lib + # module with 33 green tests standing over a server that died on startup. + - npm run check:node-loadable + +# --------------------------------------------------------------------------- images + +# Images land at registry.gitlab.com/duartesantos8/opengym/{api,web} and are what +# `docker compose pull` fetches. +# +# On a v* tag: linux/amd64 + linux/arm64, tagged X.Y.Z, X.Y and latest. +# On any other branch: amd64 only, tagged `edge` and `main-`. arm64 is emulated +# through QEMU on the shared runners and costs several times the minutes — a self-hoster +# on a Pi pulls `latest`, which always comes from a release and is always multi-arch. +build:images: + stage: build + image: docker:28-cli + services: + - docker:28-dind + variables: + DOCKER_HOST: tcp://docker:2376 + DOCKER_TLS_CERTDIR: "/certs" + DOCKER_TLS_VERIFY: "1" + DOCKER_CERT_PATH: "/certs/client" + needs: ["test:frontend", "test:mcp"] + parallel: + matrix: + - IMAGE: api + CONTEXT: "./api" + DOCKERFILE: "./api/Dockerfile" + - IMAGE: web + CONTEXT: "." + DOCKERFILE: "./web/Dockerfile" + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" + script: + - | + set -eu + BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" + REPO="$CI_REGISTRY_IMAGE/$IMAGE" + if [ -n "${CI_COMMIT_TAG:-}" ]; then + VERSION="$CI_COMMIT_TAG" + SEMVER="${CI_COMMIT_TAG#v}" + PLATFORMS="linux/amd64,linux/arm64" + TAGS="-t $REPO:$SEMVER -t $REPO:${SEMVER%.*} -t $REPO:latest" + # Only the arm64 leg needs emulation, and only for the api image (web's build + # stage is pinned to $BUILDPLATFORM on purpose — see web/Dockerfile). + docker run --privileged --rm tonistiigi/binfmt --install arm64 + else + VERSION="main-$CI_COMMIT_SHORT_SHA" + PLATFORMS="linux/amd64" + TAGS="-t $REPO:edge -t $REPO:$VERSION" + fi + docker buildx create --use --name opengym --driver docker-container + # shellcheck disable=SC2086 + docker buildx build \ + --platform "$PLATFORMS" \ + --file "$DOCKERFILE" \ + --build-arg "VERSION=$VERSION" \ + --build-arg "VCS_REF=$CI_COMMIT_SHA" \ + --build-arg "BUILD_DATE=$BUILD_DATE" \ + --cache-from "type=registry,ref=$CI_REGISTRY_IMAGE/buildcache:$IMAGE" \ + --cache-to "type=registry,ref=$CI_REGISTRY_IMAGE/buildcache:$IMAGE,mode=max" \ + --provenance=false \ + $TAGS \ + --push \ + "$CONTEXT" + rules: + - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/ + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: manual + allow_failure: true + +# ------------------------------------------------------------------------------ apk + +# The official signed APK. Signing keys live in protected CI variables, so they only +# exist on protected refs (main and v* tags) — a fork's MR builds an unsigned APK and +# cannot get at the key. Sideload-only by design: openGym is on no app store. +# +# Needs three CI/CD variables (Settings → CI/CD → Variables), all *protected*: +# ANDROID_KEYSTORE_B64 file base64 of opengym-release.keystore +# ANDROID_KEYSTORE_PASSWORD masked the keystore password +# ANDROID_KEY_ALIAS plain opengym +# KEEP THAT KEYSTORE: updates must be signed with the same key or Android refuses to +# install them over an existing copy. +build:apk: + stage: package + image: cimg/android:2026.08-node + needs: ["test:frontend"] + variables: + GRADLE_USER_HOME: "$CI_PROJECT_DIR/.gradle" + GRADLE_OPTS: "-Dorg.gradle.daemon=false" + cache: + key: "gradle-$CI_COMMIT_REF_SLUG" + paths: + - .gradle/wrapper + - .gradle/caches + script: + - | + set -eu + cd frontend + npm ci + # VITE_MOBILE build + `cap sync` into android/. The mobile flavor talks to no + # backend at all: no sign-in, no sync, media straight from the CDN. + npm run build:mobile + VER="$(node -p "require('./package.json').version")" + cd android + ./gradlew --no-daemon assembleRelease + UNSIGNED=app/build/outputs/apk/release/app-release-unsigned.apk + BT="$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)" + if [ -n "${ANDROID_KEYSTORE_B64:-}" ]; then + base64 -d "$ANDROID_KEYSTORE_B64" > "$CI_PROJECT_DIR/.ks.jks" + "$BT/zipalign" -f -p 4 "$UNSIGNED" aligned.apk + "$BT/apksigner" sign \ + --ks "$CI_PROJECT_DIR/.ks.jks" \ + --ks-pass "env:ANDROID_KEYSTORE_PASSWORD" \ + --ks-key-alias "$ANDROID_KEY_ALIAS" \ + --key-pass "env:ANDROID_KEYSTORE_PASSWORD" \ + --out "$CI_PROJECT_DIR/openGym-$VER.apk" aligned.apk + rm -f "$CI_PROJECT_DIR/.ks.jks" + "$BT/apksigner" verify --print-certs "$CI_PROJECT_DIR/openGym-$VER.apk" + else + echo "No signing key on this ref — producing an UNSIGNED apk (cannot be installed)." + "$BT/zipalign" -f -p 4 "$UNSIGNED" "$CI_PROJECT_DIR/openGym-$VER-unsigned.apk" + fi + echo "APK_VERSION=$VER" >> "$CI_PROJECT_DIR/apk.env" + # On a release tag the APK also goes into the generic package registry, which is + # what the Release links to (job artifacts expire; packages do not). + - | + set -eu + cd "$CI_PROJECT_DIR" + . ./apk.env + if [ -n "${CI_COMMIT_TAG:-}" ] && [ -f "openGym-$APK_VERSION.apk" ]; then + curl --fail --silent --show-error \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file "openGym-$APK_VERSION.apk" \ + "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/opengym-android/$APK_VERSION/openGym-$APK_VERSION.apk" + echo "uploaded openGym-$APK_VERSION.apk to the generic package registry" + fi + artifacts: + name: "openGym-apk-$CI_COMMIT_REF_SLUG" + paths: + - "openGym-*.apk" + reports: + dotenv: apk.env + expire_in: 30 days + rules: + - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/ + # An APK build is ~8 minutes of shared-runner time; on main and MRs it is one click + # away rather than automatic. Flip `when: manual` off to have every push build one. + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + when: manual + allow_failure: true + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: manual + allow_failure: true + +# ---------------------------------------------------------------------------- pages + +# The browser-only demo: https://duartesantos8.gitlab.io/opengym/ +# Pages serves static files only, so this build has no backend — VITE_DEMO=1 makes the +# app boot straight into guest mode with a seeded example history (frontend/src/lib/demo.js). +# Vite's base is './', so the bundle drops into a subdirectory unchanged. +pages: + extends: .node + stage: deploy + needs: ["test:frontend"] + variables: + VITE_DEMO: "1" + script: + - cd frontend + - npm ci + - VITE_IMG_BASE="$DATASET/images/" VITE_GIF_BASE="$DATASET/videos/" npm run build + - cd .. + - rm -rf public && mv frontend/dist public + artifacts: + paths: + - public + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + changes: + paths: + - "frontend/**/*" + - ".gitlab-ci.yml" + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + when: manual + allow_failure: true + +# -------------------------------------------------------------------------- release + +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: build:images + - job: build:apk + artifacts: true + rules: + - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/ + script: + # The release notes are the matching section of CHANGELOG.md, verbatim — headings + # there are "## v1.2.9 — 2026-08-23", so take everything up to the next "## ". + - | + set -eu + awk -v tag="$CI_COMMIT_TAG" ' + $0 ~ "^## " tag "([^0-9.]|$)" { inside = 1; next } + inside && /^## / { exit } + inside { print } + ' CHANGELOG.md > release-notes.md + if [ ! -s release-notes.md ]; then + echo "openGym $CI_COMMIT_TAG" > release-notes.md + fi + head -40 release-notes.md + release: + tag_name: $CI_COMMIT_TAG + name: "openGym $CI_COMMIT_TAG" + description: release-notes.md + assets: + links: + - name: "openGym-$APK_VERSION.apk (Android, sideload)" + url: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/opengym-android/$APK_VERSION/openGym-$APK_VERSION.apk" + link_type: package + - name: "Container images (api + web)" + url: "$CI_PROJECT_URL/container_registry" + link_type: image diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md new file mode 100644 index 0000000..36cd4a6 --- /dev/null +++ b/.gitlab/issue_templates/Bug.md @@ -0,0 +1,42 @@ + + +/label ~bug + +### What did you do? + +*Steps to reproduce, as precisely as you can.* + +1. +2. +3. + +### What did you expect to happen? + +### What happened instead? + +*Error messages, console output or screenshots if you have them.* + +### How are you running openGym? + +*Pick one: self-hosted (docker compose) · frontend dev server (`npm run dev`) · Android APK · +other / not sure* + +### Version & environment + +- openGym version or commit: +- Browser & OS: *e.g. Safari 17 on iOS 18, Chrome 126 on Android* + +### Is this about login / passkeys? + +Most login issues are an `RP_ID`/`ORIGIN` mismatch — check your `.env` against the domain you +reach openGym on before reporting. See the [self-hosting guide](../../docs/SELF_HOSTING.md). + +- [ ] Yes, and I have already checked `RP_ID`/`ORIGIN` +- `RP_ID` = +- `ORIGIN` = +- What sits in front of the app (reverse proxy, tunnel, none): + + diff --git a/.gitlab/issue_templates/Feature.md b/.gitlab/issue_templates/Feature.md new file mode 100644 index 0000000..d80cf4f --- /dev/null +++ b/.gitlab/issue_templates/Feature.md @@ -0,0 +1,16 @@ +/label ~enhancement + +### What problem does this solve? + +*What are you trying to do that openGym doesn't support today?* + +### Proposed approach + +*How would you like it to work? Rough ideas are fine.* + +### Dependencies + +openGym is intentionally dependency-light — new packages, front or back, are a hard sell. +See [CONTRIBUTING.md](../../CONTRIBUTING.md). + +- [ ] This doesn't require adding a new dependency diff --git a/.gitlab/issue_templates/Question.md b/.gitlab/issue_templates/Question.md new file mode 100644 index 0000000..8e651cd --- /dev/null +++ b/.gitlab/issue_templates/Question.md @@ -0,0 +1,17 @@ + + +/label ~question + +### What are you trying to do? + +### What have you tried? + +### Setup + +- openGym version or commit: +- How you run it (docker compose / dev server / APK): +- If it is about login or passkeys — `RP_ID`, `ORIGIN`, and what sits in front of the app: + +*Login trouble is an `RP_ID`/`ORIGIN` mismatch far more often than not:* +[docs/SELF_HOSTING.md](../../docs/SELF_HOSTING.md). diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md new file mode 100644 index 0000000..eaec2da --- /dev/null +++ b/.gitlab/merge_request_templates/Default.md @@ -0,0 +1,16 @@ +### What this changes + +### Why + +*Link the issue if there is one: `Closes #123`.* + +### Checklist + +- [ ] `npm test` passes in `frontend/` (and in `mcp/` if you touched it) +- [ ] `npm run build` succeeds +- [ ] User-facing strings are in every locale pack — `node scripts/check-locales.mjs` +- [ ] No new runtime dependency, or the MR explains why one is unavoidable +- [ ] CHANGELOG.md is left alone — release notes are written at release time + + diff --git a/CHANGELOG.md b/CHANGELOG.md index e7e69ed..d2cf9b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ If you run openGym for other people, you have had no way to answer "who signed i the server kept no record of anything. It does now: an **activity log** in the admin dashboard, covering sign-ins, sign-outs, the attempts that failed, and every admin action. The other half of this release is that **the live demo is back**, self-hosted this time, after two months offline. +And the project has a working home again: openGym now lives on **GitLab**, where CI builds the +container images and the signed Android APK for every release — the thing that has been missing +since the GitHub account went. ### Activity log @@ -41,10 +44,33 @@ this release is that **the live demo is back**, self-hosted this time, after two build as before: no backend, no account, seeded example history, and a reset button in its settings. The embedded demo on the landing page works again too. +### openGym moved to GitLab + +- 🏠 **** is the home of the project. Same history, + same tags, same AGPL. gitea.com was the stopgap after the GitHub suspension and stays as a + mirror; it never had a CI runner, which is why releases there had no images. +- 🐳 **Prebuilt images are back.** `docker compose pull` now fetches + `registry.gitlab.com/duartesantos8/opengym/api` and `/web`, built for **amd64 and arm64** on + every release. Pulling is anonymous — the project is public, no login, no token. +- 🤖 **The APK is built by CI now, not by hand.** Every `vX.Y.Z` tag produces a `zipalign`ed, + signed APK, attached to the GitLab release and mirrored onto the download page. The signing + key sits in protected CI variables, so it exists only on `main` and on version tags — a + merge request from a fork builds an unsigned APK and never touches the key. +- ✅ **Every merge request is tested again.** The frontend suite (346 tests), the locale checks, + the fatigue probe and the MCP suite all run on GitLab CI. The GitHub Actions workflows stay + in `.github/` for the day that account comes back. +- 🌐 The in-browser demo also builds to GitLab Pages + (); + remains the copy the landing page embeds. +- 📄 Security reports have a private channel again: a **confidential issue** on GitLab. See + `SECURITY.md`. + ### Housekeeping - The self-hosting docs, `SECURITY.md` and `.env.example` cover the activity log, and the `api/server.js` line references in `SECURITY.md` are accurate again. +- Every repository link in the README, the docs, the app and the website points at GitLab, and + the website's live star/release numbers come from GitLab's API. ## v1.2.8 — 2026-08-22 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7826a98..5fce207 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ cd frontend && npm test State lives in the Zustand store (`src/store`); pure helpers in `src/lib`. - **Don't commit** the exercise media (`media/`) or `data/` — they're gitignored. - **Test the flow** you touched — click through the affected screens (and the workout flow) in a - browser before opening a PR. + browser before opening a merge request. - **Training logic gets a unit test.** Anything deciding what you lift next, or reading a logged session back, belongs in a pure helper in `src/lib` with tests beside it (`npm test`). These rules are easy to get subtly wrong and nearly impossible to verify by clicking — the @@ -55,12 +55,12 @@ cd frontend && npm test | You have | Goes to | | --- | --- | -| A question, or self-hosting that won't behave | [An issue labelled `question`](https://gitea.com/DuarteSantos/openGym/issues) | -| An idea you're not sure about yet | [An issue labelled `idea`](https://gitea.com/DuarteSantos/openGym/issues) | -| A reproducible bug | [Issues](https://gitea.com/DuarteSantos/openGym/issues) | -| A change you've already built | A pull request | +| A question, or self-hosting that won't behave | [An issue labelled `question`](https://gitlab.com/DuarteSantos8/opengym/-/issues) | +| An idea you're not sure about yet | [An issue labelled `idea`](https://gitlab.com/DuarteSantos8/opengym/-/issues) | +| A reproducible bug | [Issues](https://gitlab.com/DuarteSantos8/opengym/-/issues) | +| A change you've already built | A merge request | -gitea.com has no Discussions, so questions and ideas are issues too — just labelled, so nobody +GitLab has no Discussions, so questions and ideas are issues too — just labelled, so nobody mistakes a question for agreed-on work. An answered question is worth more than the same answer in a chat log: the next person searching "passkey login fails behind my reverse proxy" finds it. diff --git a/README.md b/README.md index 55ff062..96056c8 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ No account on someone else's server, no subscription, no ads. Just `docker compo ![Docker](https://img.shields.io/badge/Docker-compose-2496ED?style=flat-square&logo=docker&logoColor=white) ![No tracking](https://img.shields.io/badge/telemetry-none-f472b6?style=flat-square)
-![Last commit](https://img.shields.io/gitea/last-commit/DuarteSantos/openGym?gitea_url=https%3A%2F%2Fgitea.com&style=flat-square) -[![Stars](https://img.shields.io/gitea/stars/DuarteSantos/openGym?gitea_url=https%3A%2F%2Fgitea.com&style=flat-square)](https://gitea.com/DuarteSantos/openGym/stars) -[![Issues](https://img.shields.io/gitea/issues/open/DuarteSantos/openGym?gitea_url=https%3A%2F%2Fgitea.com&style=flat-square)](https://gitea.com/DuarteSantos/openGym/issues) +[![Pipeline](https://gitlab.com/DuarteSantos8/opengym/badges/main/pipeline.svg?style=flat-square)](https://gitlab.com/DuarteSantos8/opengym/-/pipelines) +![Last commit](https://img.shields.io/gitlab/last-commit/DuarteSantos8%2Fopengym?style=flat-square) +[![Stars](https://img.shields.io/gitlab/stars/DuarteSantos8%2Fopengym?style=flat-square)](https://gitlab.com/DuarteSantos8/opengym/-/starrers) +[![Issues](https://img.shields.io/gitlab/issues/open/DuarteSantos8%2Fopengym?style=flat-square)](https://gitlab.com/DuarteSantos8/opengym/-/issues) @@ -39,7 +40,7 @@ No account on someone else's server, no subscription, no ads. Just `docker compo
-### [🌐 opengym.duarte-santos.ch](https://opengym.duarte-santos.ch) · [📦 Source on gitea.com](https://gitea.com/DuarteSantos/openGym) +### [🌐 opengym.duarte-santos.ch](https://opengym.duarte-santos.ch) · [📦 Source on GitLab](https://gitlab.com/DuarteSantos8/opengym) Screenshots, docs and the APK download live on the site.
Want to poke at it first? The in-browser @@ -92,7 +93,7 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a You need [Docker](https://docs.docker.com/get-docker/) with Compose. ```bash -git clone https://gitea.com/DuarteSantos/openGym +git clone https://gitlab.com/DuarteSantos8/opengym cd openGym cp .env.example .env docker compose pull # grab prebuilt images (amd64 + arm64) — skip to build from source instead @@ -110,7 +111,7 @@ the exercise media (~140 MB) once. > yourself, commercially or not, needs your own licence from Gym visual — see > [NOTICE.md](NOTICE.md). Prefer building the images yourself instead of pulling from -`gitea.com`? Drop the `pull` step and run `docker compose up -d --build` — you don't need Node or +GitLab's registry? Drop the `pull` step and run `docker compose up -d --build` — you don't need Node or a build step locally either way. > Want it reachable from your phone over the internet with passkeys? You'll need an HTTPS @@ -217,18 +218,20 @@ in the Docker build. ## Community -- **[Issues](https://gitea.com/DuarteSantos/openGym/issues)** — bugs, questions, self-hosting - help and ideas. gitea.com has no Discussions, so it all lives in one tracker: label a question +- **[Issues](https://gitlab.com/DuarteSantos8/opengym/-/issues)** — bugs, questions, self-hosting + help and ideas. There are no Discussions here, so it all lives in one tracker: label a question `question` and an idea `idea`, and it gets treated as one rather than as agreed-on work. - **Login trouble?** Most of it is an `RP_ID`/`ORIGIN` mismatch — check [docs/SELF_HOSTING.md](docs/SELF_HOSTING.md) before opening an issue. -- **Pull requests** — [open one on gitea.com](https://gitea.com/DuarteSantos/openGym/pulls); see +- **Merge requests** — [open one on GitLab](https://gitlab.com/DuarteSantos8/opengym/-/merge_requests); see [CONTRIBUTING.md](CONTRIBUTING.md). > **On the GitHub repo:** `github.com/DuarteSantos8/openGym` is offline because the account was -> suspended. gitea.com is the home of the project until that is resolved — same history, same -> tags, same releases. Old GitHub issue and PR numbers in [CHANGELOG.md](CHANGELOG.md) are kept -> as plain references; they don't map onto gitea's numbering. +> suspended. **GitLab is the home of the project** — same history, same tags, same releases, and +> the CI that builds the images and the APK runs there. (gitea.com/DuarteSantos/openGym was the +> first stopgap and is now only a mirror.) Old GitHub issue and PR numbers in +> [CHANGELOG.md](CHANGELOG.md) are kept as plain references; they don't map onto GitLab's +> numbering. ## Contributing @@ -237,7 +240,7 @@ plans, exercise-data languages, import from other trackers. **A ⭐ helps more p openGym is free and stays free: AGPL, no subscription, no paid tier, nothing held back for sponsors. If it replaced a paid tracker for you and you want to chip in, the Sponsor button at the -top of the page is there — a star, a bug report or a PR is worth just as much. +top of the page is there — a star, a bug report or a merge request is worth just as much. saying only *"I need a private channel for a -security report"* — no details, no repro, no version — and you'll get an address to send it to -within a couple of days. +The project lives on GitLab. It has no security-advisory workflow on the free tier, but it does +have **confidential issues**, and that is the private channel: open an issue at + and tick **"This issue is confidential"** +*before* you submit. A confidential issue is readable only by project members — you'll see it, +I'll see it, nobody else will, and it stays that way if it is later closed. + +If you'd rather not put the details in GitLab at all, open a confidential issue saying only +*"I need an address for a security report"* — no details, no repro, no version — and you'll get +one back within a couple of days. > The GitHub repo and its private vulnerability reporting are gone with the suspended account; > `github.com/DuarteSantos8/openGym/security/advisories/new` no longer resolves. -Please don't put a working exploit in a public issue if it can be used against other people's -instances. Everything else (a crash you can only trigger on your own box, a scanner warning) +Please don't put a working exploit in a *non-confidential* issue if it can be used against other +people's instances. Everything else (a crash you can only trigger on your own box, a scanner warning) is fine as a normal issue. Useful in a report: the version or commit, whether you're running the prebuilt images or a @@ -49,7 +54,7 @@ in the thread; there's no objection, and no request to sit on it indefinitely. change a signed-in user's data. - **Shipped deployment config** — `docker-compose.yml`, `web/nginx.conf`, the two Dockerfiles: a default that exposes something a self-hoster wouldn't expect to be exposed. -- **The published images** `gitea.com/duartesantos/opengym-api` and `-web`. +- **The published images** `registry.gitlab.com/duartesantos8/opengym/api` and `/web`. ## Out of scope @@ -67,7 +72,7 @@ in the thread; there's no objection, and no request to sit on it indefinitely. the session cookie isn't marked `Secure`. - Scanner output with no working exploit, and `npm audit` findings in build-time devDependencies (Vite, Vitest, Capacitor CLI) that never reach a running instance. -- The GitHub Pages demo build — it has no backend at all, everything stays in that browser. +- The GitLab Pages demo build — it has no backend at all, everything stays in that browser. - Third-party content: the exercise image/GIF dataset and the CDN it's fetched from. ## Security model diff --git a/api/Dockerfile b/api/Dockerfile index c0d4065..ed246d4 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -4,12 +4,12 @@ ARG VERSION=dev ARG VCS_REF=dev ARG BUILD_DATE=unknown -LABEL maintainer="Duarte Santos https://gitea.com/DuarteSantos" \ +LABEL maintainer="Duarte Santos https://gitlab.com/DuarteSantos8" \ org.opencontainers.image.title="opengym-api" \ org.opencontainers.image.description="Backend for Self-hosted gym & body-weight tracker — plan routines, log workouts (supersets & cardio too), track your weight and progress, passkey login. Your data, your server." \ - org.opencontainers.image.source="https://gitea.com/DuarteSantos/openGym" \ - org.opencontainers.image.url="https://gitea.com/DuarteSantos/-/packages/container/opengym-api" \ - org.opencontainers.image.documentation="https://gitea.com/DuarteSantos/openGym#readme" \ + org.opencontainers.image.source="https://gitlab.com/DuarteSantos8/opengym" \ + org.opencontainers.image.url="https://gitlab.com/DuarteSantos8/opengym/container_registry" \ + org.opencontainers.image.documentation="https://gitlab.com/DuarteSantos8/opengym#readme" \ org.opencontainers.image.licenses="AGPL-3.0-or-later" \ org.opencontainers.image.version=$VERSION \ org.opencontainers.image.revision=$VCS_REF \ diff --git a/docker-compose.yml b/docker-compose.yml index bf63ca8..93c9142 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: # Passkey auth + per-user data (Node, no framework). # image: prebuilt (docker compose pull). build: from source (docker compose up --build). api: - image: gitea.com/duartesantos/opengym-api:latest + image: registry.gitlab.com/duartesantos8/opengym/api:latest build: ./api restart: unless-stopped env_file: .env @@ -50,7 +50,7 @@ services: # Builds the React frontend (multi-stage) and serves it, proxying /api → api # and the exercise media from the shared volume. Single origin for passkeys. web: - image: gitea.com/duartesantos/opengym-web:latest + image: registry.gitlab.com/duartesantos8/opengym/web:latest build: context: . dockerfile: web/Dockerfile diff --git a/docs/MOBILE.md b/docs/MOBILE.md index 56beae2..fcf4173 100644 --- a/docs/MOBILE.md +++ b/docs/MOBILE.md @@ -61,10 +61,20 @@ accounts, no store rules, no yearly fees between you and an open-source app. ### Android — sideload the APK -The official signed APK is at **[opengym.duarte-santos.ch](https://opengym.duarte-santos.ch)**. +The official signed APK is at **[opengym.duarte-santos.ch](https://opengym.duarte-santos.ch)** +and, for every release, on the +**[GitLab releases page](https://gitlab.com/DuarteSantos8/opengym/-/releases)**. Android asks you to allow installs from the browser the first time — that's standard for any app outside the Play Store. +Both come out of CI: the `build:apk` job in [`.gitlab-ci.yml`](../.gitlab-ci.yml) runs +`npm run build:mobile` and `./gradlew assembleRelease`, then `zipalign`s and signs the result +with the release key. The key lives in *protected* CI variables (`ANDROID_KEYSTORE_B64`, +`ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS`), so it only exists on `main` and on `v*` +tags — a merge request from a fork can build an APK, but gets an unsigned one and never sees +the key. On a `v*` tag the signed APK is also pushed to the generic package registry, which is +what the release links to. + To build and sign your own: ```sh @@ -95,7 +105,10 @@ that would simply install. Your free options: - Bump `versionName`/`versionCode` in `android/app/build.gradle` per release; keep them in step with `frontend/package.json`. `versionCode` must strictly increase or updates won't - install over an existing APK. + install over an existing APK. The APK is *named* from `frontend/package.json` (the CI job + reads `version` out of it), so the two drifting apart shows up as a misnamed file. +- Tagging `vX.Y.Z` is what ships everything: images, APK, release notes. Don't push a version + tag you don't mean to release — `v*` tags are protected for that reason. - **License:** openGym is AGPL-3.0, which by itself sits badly with app-store terms of service. `NOTICE.md` carries an app-store exception (an additional permission under AGPL §7) granted by the copyright holder — relevant only if store distribution ever happens. diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.md index 91d7f7a..4ae67d7 100644 --- a/docs/SELF_HOSTING.md +++ b/docs/SELF_HOSTING.md @@ -8,10 +8,10 @@ This guide takes you from "just cloned it" to "using it from my phone over the i Requirements: [Docker](https://docs.docker.com/get-docker/) with the Compose plugin. ```bash -git clone https://gitea.com/DuarteSantos/openGym +git clone https://gitlab.com/DuarteSantos8/opengym cd openGym cp .env.example .env -docker compose pull # prebuilt images from gitea.com (amd64 + arm64) — or skip and build from source +docker compose pull # prebuilt images from GitLab (amd64 + arm64) — or skip and build from source docker compose up -d ``` diff --git a/frontend/src/lib/demo.js b/frontend/src/lib/demo.js index 3fe28ce..eee8e81 100644 --- a/frontend/src/lib/demo.js +++ b/frontend/src/lib/demo.js @@ -11,4 +11,4 @@ // lands in a self-hosted bundle. export const DEMO = import.meta.env.VITE_DEMO === '1' export const DEMO_SEEDED = 'gym_demo_seeded_v1' -export const REPO = 'https://gitea.com/DuarteSantos/openGym' +export const REPO = 'https://gitlab.com/DuarteSantos8/opengym' diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx index c1a28bb..d6d071b 100644 --- a/frontend/src/views/Settings.jsx +++ b/frontend/src/views/Settings.jsx @@ -196,7 +196,7 @@ export default function Settings() {
openGym · {t('free & open source (AGPL v3)')}
-
source code · exercise data: hasaneyldrm/exercises-dataset (MIT)
+ source code · exercise data: hasaneyldrm/exercises-dataset (MIT)
exercise images and animations © Gym visual
diff --git a/web/Dockerfile b/web/Dockerfile index 56d4014..601917c 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -19,12 +19,12 @@ ARG VERSION=dev ARG VCS_REF=dev ARG BUILD_DATE=unknown -LABEL maintainer="Duarte Santos https://gitea.com/DuarteSantos" \ +LABEL maintainer="Duarte Santos https://gitlab.com/DuarteSantos8" \ org.opencontainers.image.title="opengym-web" \ org.opencontainers.image.description="Frontend for Self-hosted gym & body-weight tracker — plan routines, log workouts (supersets & cardio too), track your weight and progress, passkey login. Your data, your server." \ - org.opencontainers.image.source="https://gitea.com/DuarteSantos/openGym" \ - org.opencontainers.image.url="https://gitea.com/DuarteSantos/-/packages/container/opengym-web" \ - org.opencontainers.image.documentation="https://gitea.com/DuarteSantos/openGym#readme" \ + org.opencontainers.image.source="https://gitlab.com/DuarteSantos8/opengym" \ + org.opencontainers.image.url="https://gitlab.com/DuarteSantos8/opengym/container_registry" \ + org.opencontainers.image.documentation="https://gitlab.com/DuarteSantos8/opengym#readme" \ org.opencontainers.image.licenses="AGPL-3.0-or-later" \ org.opencontainers.image.version=$VERSION \ org.opencontainers.image.revision=$VCS_REF \ diff --git a/website/README.md b/website/README.md index b5655e4..5913590 100644 --- a/website/README.md +++ b/website/README.md @@ -11,11 +11,11 @@ Not in this folder (added at deploy time): - `openGym.apk` — the signed release build (see `../docs/MOBILE.md`) - `demo/` — the browser-only demo build of the app, embedded in the `#demo` section and reachable on its own at `/demo/`. Built from `../frontend` with `VITE_DEMO=1` and the - jsDelivr media bases (see the recipe in `../.github/workflows/pages.yml`), so the ~140 MB + jsDelivr media bases (see the `pages` job in `../.gitlab-ci.yml`), so the ~140 MB of exercise media stays out of it. It has to live on this host: the site frames it, and `X-Frame-Options: SAMEORIGIN` would block it from anywhere else. `site.js` fetches the star/issue counts and the release timeline from the public -gitea.com API at view time. It pointed at api.github.com until that account was +gitlab.com API at view time. It pointed at api.github.com until that account was suspended; the two URLs go back once it is restored, together with the notice block at the top of `index.html` and the demo iframe. diff --git a/website/about.html b/website/about.html index f54f6a8..b767419 100644 --- a/website/about.html +++ b/website/about.html @@ -26,13 +26,13 @@ Demo Docs About - Gitea + GitLab Discord Download - @@ -96,7 +96,7 @@

Docker-Compose self-hosting, passkey profiles, guided workouts, 1,324-exercise library. AGPL from day one.

  • Every release sinceongoing -

    See the full list on Gitea → Releases.

  • +

    See the full list on GitLab → Releases.

    Principles

    @@ -113,7 +113,7 @@ @@ -122,7 +122,7 @@ diff --git a/website/docs.html b/website/docs.html index f850f4e..3a89a7b 100644 --- a/website/docs.html +++ b/website/docs.html @@ -26,13 +26,13 @@ Demo Docs About - Gitea + GitLab Discord Download - @@ -55,7 +55,7 @@

    Docs

    Everything you need to get openGym running — on a phone, or on your own server. The deeper, maintainer-level docs live - in the repository.

    + in the repository.

    Android @@ -92,7 +92,7 @@
  • Build it onto your own iPhone: with a Mac and Xcode, the native app runs on your device with a free Apple ID (Apple expires the signature after 7 days; re-run from Xcode to renew). See - docs/MOBILE.md.
  • + docs/MOBILE.md.
  • Just looking? Try the in-browser demo — the real app with example data, no account and nothing to install. The Android app above needs no account either.
  • @@ -101,7 +101,7 @@

    The self-hosted flavor adds passkey profiles, sync across devices, and (optionally) an admin dashboard. You need Docker with Compose:

    -
    git clone https://gitea.com/DuarteSantos/openGym
    +  
    git clone https://gitlab.com/DuarteSantos8/opengym
     cd openGym
     cp .env.example .env
     docker compose pull    # prebuilt images (amd64 + arm64) — skip to build from source
    @@ -111,7 +111,7 @@ docker compose up -d
    Want it reachable from your phone with passkeys? You'll need an HTTPS domain — a two-line change in .env. The full guide, including reverse-proxy examples and the invite-only/admin options, is in - docs/SELF_HOSTING.md.
    + docs/SELF_HOSTING.md.

    Settings worth knowing about

    All of these live in .env; the defaults are what you get if you touch nothing.

    @@ -133,7 +133,7 @@ docker compose up -d

    It runs on your machine, is spawned by the client, and reads your exported data directly. Nothing is sent anywhere, and it is not part of the Docker build — if you don't use an AI assistant, it simply isn't there. Setup is a few lines of client config: - mcp/README.md.

    + mcp/README.md.

    Import your training history

    Coming from another tracker? Settings → Data → Import from another app reads:

    @@ -163,7 +163,7 @@ docker compose up -d inside the container — no local Node needed.
  • Android APK / iOS app: the Capacitor projects live in frontend/android and frontend/ios — build, signing and distribution notes are in - docs/MOBILE.md.
  • + docs/MOBILE.md.

    FAQ

    @@ -199,7 +199,7 @@ docker compose up -d diff --git a/website/index.html b/website/index.html index 289902c..7193376 100644 --- a/website/index.html +++ b/website/index.html @@ -40,13 +40,13 @@ Demo Docs About - Gitea + GitLab Discord Download - @@ -76,7 +76,7 @@ @@ -197,21 +197,21 @@

    AGPL-licensed, forever

    The code is public, the license keeps every fork open, and there is no commercial version waiting behind a curtain. If openGym is useful to you, - a ⭐ on Gitea helps more people find it.

    + a ⭐ on GitLab helps more people find it.

    There is a Discord for release announcements, self-hosting help and bug reports. It is the fastest way to hear about a new version — and the fastest way to get unstuck if a reverse proxy or a passkey is fighting you.

    -
    –Gitea stars
    +
    –GitLab stars
    –forks
    –open issues
    1,324exercises
    12languages
    @@ -221,7 +221,7 @@ diff --git a/website/site.js b/website/site.js index bc32af8..3fc55ea 100644 --- a/website/site.js +++ b/website/site.js @@ -1,17 +1,23 @@ // Live repo numbers in the nav + open-source strip. Fails silently — the site works -// fine without them. Points at the gitea.com mirror while the GitHub account is -// suspended; switch the two API URLs back to api.github.com once it is restored. -(async () => { +// fine without them. Points at gitlab.com while the GitHub account is suspended; +// switch the two API URLs back to api.github.com once it is restored. +// +// The cache keys carry a _gl suffix: a visitor with a still-warm sessionStorage entry +// from the gitea era would otherwise be read with the old field names and show NaN. +const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym' + +;(async () => { const set = (id, v) => document.querySelectorAll('[data-gh="' + id + '"]').forEach(el => { el.textContent = v }) try { let d = null - const cached = sessionStorage.getItem('repo_meta') + const cached = sessionStorage.getItem('repo_meta_gl') if (cached) d = JSON.parse(cached) else { - const r = await fetch('https://gitea.com/api/v1/repos/DuarteSantos/openGym') + const r = await fetch(GL_PROJECT) if (!r.ok) return - d = await r.json() - sessionStorage.setItem('repo_meta', JSON.stringify({ stars_count: d.stars_count, forks_count: d.forks_count, open_issues_count: d.open_issues_count })) + const j = await r.json() + d = { stars_count: j.star_count, forks_count: j.forks_count, open_issues_count: j.open_issues_count } + sessionStorage.setItem('repo_meta_gl', JSON.stringify(d)) } set('stars', '★ ' + d.stars_count) set('stars-n', d.stars_count) @@ -20,22 +26,26 @@ } catch (e) { /* offline / rate-limited — leave placeholders */ } })() -// About page: build the milestones timeline from the published Gitea releases, so the +// About page: build the milestones timeline from the published GitLab releases, so the // page updates itself with every release. The static entries marked data-fallback stay // in place when the API is unreachable; the hand-written first entry is always kept. +// +// GitLab's release objects differ from Gitea's: the notes are `description` (not `body`), +// the date is `released_at` (not `published_at`), the web link sits in `_links.self`, and +// there is no draft/prerelease pair — a not-yet-released one is `upcoming_release`. ;(async () => { const tl = document.getElementById('milestones') if (!tl) return try { let rel = null - const cached = sessionStorage.getItem('repo_releases') + const cached = sessionStorage.getItem('repo_releases_gl') if (cached) rel = JSON.parse(cached) else { - const r = await fetch('https://gitea.com/api/v1/repos/DuarteSantos/openGym/releases?limit=100') + const r = await fetch(GL_PROJECT + '/releases?per_page=100') if (!r.ok) return - rel = (await r.json()).filter(x => !x.draft && !x.prerelease) - .map(x => ({ tag: x.tag_name, name: x.name, at: x.published_at, body: x.body || '', url: x.html_url })) - sessionStorage.setItem('repo_releases', JSON.stringify(rel)) + rel = (await r.json()).filter(x => !x.upcoming_release) + .map(x => ({ tag: x.tag_name, name: x.name, at: x.released_at, body: x.description || '', url: (x._links && x._links.self) || ('https://gitlab.com/DuarteSantos8/opengym/-/releases/' + x.tag_name) })) + sessionStorage.setItem('repo_releases_gl', JSON.stringify(rel)) } if (!rel.length) return const fmt = d => new Date(d).toLocaleDateString('en-GB', { year: 'numeric', month: 'long', day: 'numeric' }) diff --git a/website/styles.css b/website/styles.css index f291885..5fc0fe5 100644 --- a/website/styles.css +++ b/website/styles.css @@ -179,7 +179,7 @@ table.cfg td:first-child { white-space: nowrap; width: 1%; padding-right: 1.2rem table.cfg tr:first-child td:first-child { border-top: 0; } } -/* ---------- suspension notice (GitHub account suspended → gitea.com mirror) ---------- +/* ---------- suspension notice (GitHub account suspended → gitlab.com) ---------- Temporary: remove this block together with the .alert markup once the account is back. */ .alert { background: