sparkyfitness

This commit is contained in:
Sönke Domröse
2025-07-14 16:20:33 +02:00
parent 099b7357c1
commit 435d928f55
4 changed files with 135 additions and 0 deletions

59
sparkyfitness/.env Normal file
View File

@@ -0,0 +1,59 @@
# SparkyFitness Environment Variables
# Copy this file to .env in the root directory and fill in your own values before running 'docker-compose up'.
# --- PostgreSQL Database Settings ---
# These values should match the ones used by your PostgreSQL container.
# For Docker Compose deployments, SPARKY_FITNESS_DB_HOST will be the service name (e.g., 'sparkyfitness-db').
# For local development (running Node.js directly), use 'localhost' or '127.0.0.1' if PostgreSQL is on your host.
SPARKY_FITNESS_DB_NAME=sparkyfitness_db
SPARKY_FITNESS_DB_USER=sparky
SPARKY_FITNESS_DB_PASSWORD=iI5EjjLHHPhYAsiw1H1eAUz6kfkTxLp6T3Zv4H0JSmi4Dt1rGCR2904lURub7ctB
#SPARKY_FITNESS_DB_HOST=localhost # Needed only for local development or if you are not using Docker Compose.
# --- Backend Server Settings ---
# The hostname or IP address of the backend server.
# For Docker Compose, this is typically the service name (e.g., 'sparkyfitness-server').
# For local development or other deployments, this might be 'localhost' or a specific IP.
SPARKY_FITNESS_SERVER_HOST=sparkyfitness-server
# The external port the server will be exposed on.
SPARKY_FITNESS_SERVER_PORT=3010
# The public URL of your frontend (e.g., https://fitness.example.com). This is crucial for CORS security.
# For local development, use http://localhost:8080. For production, use your domain with https.
SPARKY_FITNESS_FRONTEND_URL=https://sparkyfitness.domr.ovh
# Logging level for the server (e.g., INFO, DEBUG, WARN, ERROR)
SPARKY_FITNESS_LOG_LEVEL=INFO
# Node.js environment mode (e.g., development, production, test)
# Set to 'production' for deployment to ensure optimal performance and security.
NODE_ENV=production
# Server timezone. Use a TZ database name (e.g., 'America/New_York', 'Etc/UTC').
# This affects how dates/times are handled by the server if not explicitly managed in code.
TZ=Etc/UTC
# --- Security Settings ---
# A 64-character hex string for data encryption.
# You can generate a secure key with the following command:
# openssl rand -hex 32
# or
# node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
SPARKY_FITNESS_API_ENCRYPTION_KEY=6b81cdf06688652427c79ed4e08116c8612c87309bb7d0ed76edc586f240c81c
# A secret key for signing JSON Web Tokens (JWTs). Make this a long, random, and secure string.
# You can generate a secure key with the following command:
# openssl rand -base64 32
# or
# node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
JWT_SECRET=bvf4IpNQ9CtxdeRlcYk2K5lpQeAphPBgo72G7EQdPmE=
# --- Signup Settings ---
# Set to 'true' to disable new user registrations.
SPARKY_FITNESS_DISABLE_SIGNUP=false
# --- Admin Settings ---
# Set the email of a user to automatically grant admin privileges on server startup.
# This is useful for development or initial setup.
# Example: SPARKY_FITNESS_ADMIN_EMAIL=admin@example.com
SPARKY_FITNESS_ADMIN_EMAIL=soenke@domroese.eu

View File

@@ -0,0 +1,4 @@
sparkyfitness.domr.ovh {
tls soenke@domroese.eu
reverse_proxy 192.168.1.65:3942
}

View File

@@ -0,0 +1,62 @@
services:
sparkyfitness-db:
image: postgres:15-alpine
restart: always
environment:
POSTGRES_DB: ${SPARKY_FITNESS_DB_NAME}
POSTGRES_USER: ${SPARKY_FITNESS_DB_USER}
POSTGRES_PASSWORD: ${SPARKY_FITNESS_DB_PASSWORD}
volumes:
- ./postgresql:/var/lib/postgresql/data
networks:
- sparkyfitness-network # Use the new named network
sparkyfitness-server:
image: codewithcj/sparkyfitness_server:latest # Use pre-built image
environment:
SPARKY_FITNESS_LOG_LEVEL: ${SPARKY_FITNESS_LOG_LEVEL}
SPARKY_FITNESS_DB_USER: ${SPARKY_FITNESS_DB_USER}
SPARKY_FITNESS_DB_HOST: sparkyfitness-db # Use the service name 'sparkyfitness-db' for inter-container communication
SPARKY_FITNESS_DB_NAME: ${SPARKY_FITNESS_DB_NAME}
SPARKY_FITNESS_DB_PASSWORD: ${SPARKY_FITNESS_DB_PASSWORD}
SPARKY_FITNESS_DB_PORT: 5432
SPARKY_FITNESS_API_ENCRYPTION_KEY: ${SPARKY_FITNESS_API_ENCRYPTION_KEY}
JWT_SECRET: ${JWT_SECRET}
SPARKY_FITNESS_FRONTEND_URL: ${SPARKY_FITNESS_FRONTEND_URL}
SPARKY_FITNESS_DISABLE_SIGNUP: ${SPARKY_FITNESS_DISABLE_SIGNUP}
SPARKY_FITNESS_ADMIN_EMAIL: ${SPARKY_FITNESS_ADMIN_EMAIL} #User with this email can access the admin panel
networks:
- sparkyfitness-network # Use the new named network
restart: always
depends_on:
- sparkyfitness-db # Backend depends on the database being available
sparkyfitness-frontend:
image: codewithcj/sparkyfitness:latest # Use pre-built image
ports:
- "3942:80" # Map host port 8080 to container port 80 (Nginx)
networks:
- sparkyfitness-network # Use the new named network
restart: always
depends_on:
- sparkyfitness-server # Frontend depends on the server
labels:
kuma.tools.tag.name: 'Tools'
kuma.tools.tag.color: '#FF9900'
kuma.homelab.tag.name: 'Homelab'
kuma.homelab.tag.color: '#FF9955'
kuma.organization.tag.name: 'Organization'
kuma.organization.tag.color: '#FF99AA'
kuma.sparkyfitness.http.name: 'Sparkyfitness'
kuma.sparkyfitness.http.url: 'https://sparkyfitness.domr.ovh/'
kuma.sparkyfitness.http.tag_names: '[{"name": "tools", "value": "" }, {"name": "organization", "value": "" }]'
homepage.group: Hosting
homepage.name: Sparkyfitness
homepage.icon: sparkyfitness.png
homepage.href: https://sparkyfitness.domr.ovh/
homepage.description: Sparkyfitness Fitnesstracker
networks:
sparkyfitness-network:
driver: bridge