Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Self-host: run containers as a normal user, clear startup errors
InlitX4e8be2c20830
diff --git a/Dockerfile b/Dockerfileindex c3b8644..dc5e770 100644--- a/Dockerfile+++ b/Dockerfile@@ -16,15 +16,17 @@ COPY packages /src/packagesCOPY server/pubspec.yaml server/pubspec.lock ./RUN dart pub getCOPY server ./-RUN mkdir -p /out && dart compile exe bin/server.dart -o /out/gymmane-server+RUN mkdir -p /out /data && chown 1000:1000 /data && dart compile exe bin/server.dart -o /out/gymmane-serverFROM scratchCOPY --from=server /runtime/ /COPY --from=server /out/gymmane-server /app/gymmane-serverCOPY --from=web /src/build/web /app/web+COPY --from=server --chown=1000:1000 /data /dataENV GYMMANE_DATA=/data \GYMMANE_WEB=/app/web \GYMMANE_PORT=8080+USER 1000:1000VOLUME /dataEXPOSE 8080HEALTHCHECK --interval=60s --timeout=5s --start-period=10s CMD ["/app/gymmane-server", "--health"]diff --git a/SELFHOST.md b/SELFHOST.mdindex e848d2a..1cd3e70 100644--- a/SELFHOST.md+++ b/SELFHOST.md@@ -58,12 +58,16 @@ update or remove it.## Docker by hand```sh-mkdir gymmane && cd gymmane+mkdir -p gymmane/gymmane-data/sync && cd gymmanecurl -fsSLO https://raw.githubusercontent.com/InlitX/GymMane/main/compose.yamlecho "GYMMANE_PASSWORD=pick-something-long" > .envdocker compose up -d gymmane```+GymMane runs as user `1000`, not root. If your user has another id (`id -u`), add `PUID=<id>` and+`PGID=<group id>` to `.env`, and create `gymmane-data` yourself before the first start, as above,+so it belongs to you.+Open `http://localhost:8080` (or `http://<server-ip>:8080` from any device on your network).Everything you log is stored in `./gymmane-data`. Back up that folder and you have everything.diff --git a/compose.yaml b/compose.yamlindex 3bfb0fe..9340b4a 100644--- a/compose.yaml+++ b/compose.yaml@@ -3,6 +3,7 @@ services:image: ghcr.io/inlitx/gymmane:latestbuild: .container_name: gymmane+ user: "${PUID:-1000}:${PGID:-1000}"restart: unless-stoppedports:- "${GYMMANE_PORT:-8080}:8080"@@ -20,8 +21,8 @@ services:profiles: ["sync"]hostname: gymmaneenvironment:- PUID: "0"- PGID: "0"+ PUID: ${PUID:-1000}+ PGID: ${PGID:-1000}ports:- "8384:8384"- "22000:22000/tcp"diff --git a/server/bin/server.dart b/server/bin/server.dartindex 73333fd..63b5175 100644--- a/server/bin/server.dart+++ b/server/bin/server.dart@@ -24,7 +24,17 @@ Environment:}final config = Config.fromEnvironment();final server = GymManeServer(config);- await server.start();+ try {+ await server.start();+ } on FileSystemException catch (e) {+ stderr.writeln('GymMane cannot write to ${e.path ?? config.dataDir}.');+ stderr.writeln('Give the user that runs GymMane write access to that folder, or set GYMMANE_DATA to another one.');+ exit(1);+ } on SocketException catch (e) {+ stderr.writeln('GymMane cannot listen on port ${config.port}: ${e.osError?.message ?? e.message}');+ stderr.writeln('Another program may be using it. Set GYMMANE_PORT to another port.');+ exit(1);+ }stdout.writeln('GymMane $serverVersion is running.');stdout.writeln(' Open: http://localhost:${server.port}');for (final ip in await _lanAddresses()) {