Sign inSign up

nitje/pet_world

By nitje

•Updated 3 days ago

Image
0

535

nitje/pet_world repository overview

⁠pet✦world

⁠FROM A DISTANT PLANET

⁠A LITTLE ALIEN. A LOT OF LOVE.

⁠A little world, just for you two.

⁠Millions of miles from home. And now a little part of yours.


1. run as ugreen-docker-project.




Visit: https://interceptor.marconitschke.de/⁠



docker-compose.yaml
# Ma Ni - v0.0.0
#
# pet_world
#
# nur mit npm oder vergleichbar nutzen
# use only with npm or similar tools
#
name: pet_world

x-logging: &logging
  driver: json-file
  options:
    max-size: "10m"
    max-file: "3"

x-app: &app
  image: ${PET_WORLD_IMAGE:-nitje/pet_world}:backend-${PET_WORLD_VERSION:-latest}
  pull_policy: always
  restart: unless-stopped
  logging: *logging
  networks:
    - pet_world
  environment: &app-env
    TZ: ${TZ:-Europe/Berlin}
    SECRET_DIR: /secrets
    DATABASE_URL: ${DATABASE_URL:-}
    PUBLIC_URL: ${PUBLIC_URL:-https://sub.domain.de}
    ADMIN_USERNAME: ${ADMIN_USERNAME:-}
    ADMIN_PASSWORD: ${ADMIN_PASSWORD:-}
    TRUSTED_PROXY_HOSTS: ${TRUSTED_PROXY_HOSTS:-frontend}
    TRUSTED_PROXY_CIDRS: ${TRUSTED_PROXY_CIDRS:-}
    SMTP_HOST: ${SMTP_HOST:-}
    SMTP_PORT: ${SMTP_PORT:-587}
    SMTP_USER: ${SMTP_USER:-}
    SMTP_PASSWORD: ${SMTP_PASSWORD:-}
    SMTP_FROM: ${SMTP_FROM:-}
    SMTP_SECURITY: ${SMTP_SECURITY:-starttls}
    WEB_CONCURRENCY: ${API_WORKERS:-1}
    DB_POOL_SIZE: ${DB_POOL_SIZE:-10}
    DB_MAX_OVERFLOW: ${DB_MAX_OVERFLOW:-10}
    DB_POOL_TIMEOUT: ${DB_POOL_TIMEOUT:-30}
  volumes:
    - app_secrets:/secrets:ro

services:
  init:
    <<: *app
    restart: "no"
    command: ["python", "-m", "app.init_secrets"]
    volumes:
      - app_secrets:/secrets
  database:
    image: postgres:17-alpine
    restart: unless-stopped
    logging: *logging
    cpus: ${DATABASE_CPU_LIMIT:-0}
    mem_limit: ${DATABASE_MEMORY_LIMIT:-0}
    networks:
      - pet_world
    environment:
      POSTGRES_DB: pet_world
      POSTGRES_USER: pet_world
      POSTGRES_PASSWORD_FILE: /secrets/db_password
      TZ: ${TZ:-Europe/Berlin}
    volumes:
      - db_data:/var/lib/postgresql/data
      - app_secrets:/secrets:ro
    depends_on:
      init:
        condition: service_completed_successfully
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U pet_world -d pet_world"]
      interval: 10s
      timeout: 5s
      retries: 10
  backend:
    <<: *app
    cpus: ${BACKEND_CPU_LIMIT:-0}
    mem_limit: ${BACKEND_MEMORY_LIMIT:-0}
    depends_on:
      init:
        condition: service_completed_successfully
      database:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"]
      interval: 15s
      timeout: 5s
      retries: 10
  worker:
    <<: *app
    cpus: ${WORKER_CPU_LIMIT:-0}
    mem_limit: ${WORKER_MEMORY_LIMIT:-0}
    command: ["python", "-m", "app.worker"]
    healthcheck:
      test: ["CMD", "python", "-m", "app.operations", "check-worker"]
      interval: 30s
      timeout: 10s
      start_period: 120s
      retries: 3
    depends_on:
      backend:
        condition: service_healthy
  frontend:
    image: ${PET_WORLD_IMAGE:-nitje/pet_world}:frontend-${PET_WORLD_VERSION:-latest}
    pull_policy: always
    restart: unless-stopped
    logging: *logging
    cpus: ${FRONTEND_CPU_LIMIT:-0}
    mem_limit: ${FRONTEND_MEMORY_LIMIT:-0}
    networks:
      - pet_world
    environment:
      HTTP_PORT: ${HTTP_PORT:-55000}
      HTTPS_PORT: ${HTTPS_PORT:-55001}
      TLS_HOSTNAME: ${TLS_HOSTNAME:-localhost}
      TLS_IP: ${TLS_IP:-127.0.0.1}
      API_UPSTREAM: ${API_UPSTREAM:-backend:8000}
      # Operator confirmed: direct ports are LAN-only; NPM arrives via this gateway.
      REAL_IP_TRUSTED_PROXY: ${REAL_IP_TRUSTED_PROXY:-172.35.0.1}
      TZ: ${TZ:-Europe/Berlin}
    ports:
      - "${HTTP_PORT:-55000}:${HTTP_PORT:-55000}"
      - "${HTTPS_PORT:-55001}:${HTTPS_PORT:-55001}"
    volumes:
      - tls_data:/etc/nginx/certs
    depends_on:
      backend:
        condition: service_healthy
  backup:
    image: ${PET_WORLD_IMAGE:-nitje/pet_world}:ops-${PET_WORLD_VERSION:-latest}
    pull_policy: always
    restart: unless-stopped
    logging: *logging
    command: ["schedule"]
    networks: [pet_world]
    environment:
      DATABASE_URL: ${DATABASE_URL:-}
      BACKUP_INTERVAL_HOURS: ${BACKUP_INTERVAL_HOURS:-24}
      BACKUP_KEEP: ${BACKUP_KEEP:-7}
      BACKUP_TIMEOUT: ${BACKUP_TIMEOUT:-600}
    volumes:
      - app_secrets:/secrets:ro
      - tls_data:/tls:ro
      - ${BACKUP_DIRECTORY:-./backups}:/backups
    depends_on:
      backend:
        condition: service_healthy
      frontend:
        condition: service_started
    healthcheck:
      test: ["CMD", "python3", "/ops/backup.py", "health"]
      interval: 5m
      timeout: 10s
      start_period: 15m
      retries: 2
volumes:
  db_data:
    name: db_data
  app_secrets:
    name: app_secrets
  tls_data:
    name: tls_data

networks:
  pet_world:
    name: pet_world
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: "172.35.0.0/24"
          gateway: "172.35.0.1"







⁠BACKUP-RESTORE


docker-compose-restore.yaml
# Ma Ni - v0.0.0
#
# pet_world
#
# NUR UM EIN BACKUP IN EIN NEUES SYSTEM ZU ÜBERTRAGEN.
# MUSS VOR docker-compose.yml genutzt werden.
#
# ONLY TO TRANSFER A BACKUP TO A NEW SYSTEM.
# Must be used before docker-compose.yml.
name: pet_world

# Hier einmal den Namen des gesicherten Ordners eintragen, z. B. 20261024T120000Z-12345678.
# Enter the name of the backed-up folder here, e.g., 20261024T120000Z-12345678.
#
x-restore-path: &restore-path "/backups/${RESTORE_BACKUP:-HIER_BACKUP_ORDNER_EINTRAGEN}"

x-restore: &restore
  image: ${PET_WORLD_IMAGE:-nitje/pet_world}:ops-${PET_WORLD_VERSION:-latest}
  pull_policy: always
  restart: "no"
  networks: [pet_world]
  environment:
    DATABASE_URL: ${DATABASE_URL:-}
    BACKUP_TIMEOUT: ${BACKUP_TIMEOUT:-600}
  volumes:
    - app_secrets:/secrets
    - tls_data:/tls
    - ${BACKUP_DIRECTORY:-./backups}:/backups:ro

services:
  restore_prepare:
    <<: *restore
    command: ["prepare", *restore-path]
  database:
    image: postgres:17-alpine
    restart: unless-stopped
    networks: [pet_world]
    environment:
      POSTGRES_DB: pet_world
      POSTGRES_USER: pet_world
      POSTGRES_PASSWORD_FILE: /secrets/db_password
      TZ: ${TZ:-Europe/Berlin}
    volumes:
      - db_data:/var/lib/postgresql/data
      - app_secrets:/secrets:ro
    depends_on:
      restore_prepare:
        condition: service_completed_successfully
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U pet_world -d pet_world"]
      interval: 5s
      timeout: 5s
      retries: 30
  restore:
    <<: *restore
    command: ["restore-empty", *restore-path]
    depends_on:
      database:
        condition: service_healthy

# Dieselben Volumes wie docker-compose.yml. Beim Wechsel NICHT löschen.
# The same volumes as in docker-compose.yml. Do NOT delete when switching.
#
volumes:
  db_data:
    name: db_data
  app_secrets:
    name: app_secrets
  tls_data:
    name: tls_data

networks:
  pet_world:
    name: pet_world
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: "172.35.0.0/24"
          gateway: "172.35.0.1"




Tag summary

Content type

Image

Digest

sha256:f9ae5fa47…

Size

66 MB

Last updated

3 days ago

docker pull nitje/pet_world:backend-latest