From 0c6724cd4e7952bdfe96ee6e3f27c823fee44ef4 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Sun, 23 Feb 2025 21:31:15 +0100 Subject: [PATCH] Inital commit, added Dawarich --- .vscode/settings.json | 10 +++ Readme.md | 14 ++++ stacks/dawarich-stack.yaml | 150 +++++++++++++++++++++++++++++++++++++ templates.json | 74 ++++++++++++++++++ 4 files changed, 248 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 Readme.md create mode 100644 stacks/dawarich-stack.yaml create mode 100644 templates.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fc6515a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "json.schemas": [ + { + "fileMatch": [ + "/templates.json" + ], + "url": "https://raw.githubusercontent.com/portainer/templates/refs/heads/v3/schema.json" + } + ] +} \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..7fb0713 --- /dev/null +++ b/Readme.md @@ -0,0 +1,14 @@ +# Portainer app templates for the Home Server + +# Use this repo +1. Log into your Portainer web UI +2. Under Settings --> App Templates, update the URL to +* `https://git.bprieshof.nl/brammp/HomeServerPortainerTemplates/raw/branch/main/templates.json` +3. Now under Home --> App Templates, you should see all apps. Click one to deploy. + + +# List of templates + +| Name | Description | +|------|:-----------:| +| Dawarich | Self-hosted alternative to Google Location History | diff --git a/stacks/dawarich-stack.yaml b/stacks/dawarich-stack.yaml new file mode 100644 index 0000000..713d7ba --- /dev/null +++ b/stacks/dawarich-stack.yaml @@ -0,0 +1,150 @@ +version: '3' + +networks: + dawarich: +services: + dawarich_valkey: + image: valkey/valkey + container_name: dawarich_valkey + command: valkey-server + networks: + - dawarich + volumes: + - type: bind + source: /srv/dawarich/valkey + target: /data + restart: always + healthcheck: + test: [ "CMD", "valkey-cli", "--raw", "incr", "ping" ] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s + dawarich_app: + image: freikin/dawarich:latest + container_name: dawarich_app + volumes: + - type: bind + source: /srv/dawarich/watched + target: /var/app/tmp/imports/watched + - type: bind + source: /srv/dawarich/public + target: /var/app/public + networks: + - dawarich + ports: + - ${DAWARICH_PORT}:3000 + # - 9394:9394 # Prometheus exporter, uncomment if needed + stdin_open: true + tty: true + entrypoint: web-entrypoint.sh + command: ['bin/rails', 'server', '-p', '3000', '-b', '::'] + restart: on-failure + environment: + RAILS_ENV: production + REDIS_URL: redis://dawarich_valkey:6379/0 + DATABASE_HOST: ${POSTGRESS_HOST} + # Default 5432 + DATABASE_PORT: ${POSTGRESS_PORT} + DATABASE_USERNAME: ${POSTGRESS_DB_USERNAME} + DATABASE_PASSWORD: ${POSTGRESS_DB_PASSWORD} + DATABASE_NAME: ${POSTGRESS_DB_NAME} + MIN_MINUTES_SPENT_IN_CITY: 60 + #Default localhost,::1,127.0.0.1,, + APPLICATION_HOSTS: ${APPLICATION_HOSTS} + TIME_ZONE: Europe/Amsterdam + APPLICATION_PROTOCOL: http + DISTANCE_UNIT: km + PROMETHEUS_EXPORTER_ENABLED: false + PROMETHEUS_EXPORTER_HOST: 0.0.0.0 + PROMETHEUS_EXPORTER_PORT: 9394 + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + RAILS_LOG_TO_STDOUT: "true" + PHOTON_API_USE_HTTPS: "true" + PHOTON_API_HOST: ${PHOTON_API_HOST} + PHOTON_API_KEY: ${PHOTON_API_KEY} + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "5" + healthcheck: + test: [ "CMD-SHELL", "wget -qO - http://127.0.0.1:3000/api/v1/health | grep -q '\"status\"\\s*:\\s*\"ok\"'" ] + interval: 10s + retries: 30 + start_period: 30s + timeout: 10s + depends_on: + dawarich_valkey: + condition: service_healthy + restart: true + deploy: + resources: + limits: + cpus: '1' # Limit CPU usage to 50% of one core + memory: '4G' # Limit memory usage to 2GB + dawarich_sidekiq: + image: freikin/dawarich:latest + container_name: dawarich_sidekiq + volumes: + - type: bind + source: /srv/dawarich/watched + target: /var/app/tmp/imports/watched + - type: bind + source: /srv/dawarich/public + target: /var/app/public + networks: + - dawarich + stdin_open: true + tty: true + entrypoint: sidekiq-entrypoint.sh + command: ['bundle', 'exec', 'sidekiq'] + restart: on-failure + environment: + RAILS_ENV: production + REDIS_URL: redis://dawarich_valkey:6379/0 + DATABASE_HOST: ${POSTGRESS_HOST} + # Default 5432 + DATABASE_PORT: ${POSTGRESS_PORT} + DATABASE_USERNAME: ${POSTGRESS_DB_USERNAME} + DATABASE_PASSWORD: ${POSTGRESS_DB_PASSWORD} + APPLICATION_HOSTS: localhost,::1,127.0.0.1 + BACKGROUND_PROCESSING_CONCURRENCY: 10 + APPLICATION_PROTOCOL: http + DISTANCE_UNIT: km + PROMETHEUS_EXPORTER_ENABLED: false + PROMETHEUS_EXPORTER_HOST: dawarich_app + PROMETHEUS_EXPORTER_PORT: 9394 + SECRET_KEY_BASE: ${SECRET_KEY_BASE} + RAILS_LOG_TO_STDOUT: "true" + PHOTON_API_USE_HTTPS: "true" + PHOTON_API_HOST: ${PHOTON_API_HOST} + PHOTON_API_KEY: ${PHOTON_API_KEY} + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "5" + healthcheck: + test: [ "CMD-SHELL", "bundle exec sidekiqmon processes | grep $${HOSTNAME}" ] + interval: 10s + retries: 30 + start_period: 30s + timeout: 10s + depends_on: + dawarich_valkey: + condition: service_healthy + restart: true + dawarich_app: + condition: service_healthy + restart: true + deploy: + resources: + limits: + cpus: '1' # Limit CPU usage to 50% of one core + memory: '4G' # Limit memory usage to 2GB + +volumes: + dawarich_valkey_data: + dawarich_public: + dawarich_watched: \ No newline at end of file diff --git a/templates.json b/templates.json new file mode 100644 index 0000000..471d966 --- /dev/null +++ b/templates.json @@ -0,0 +1,74 @@ +{ + "version": "3", + "templates": [ + { + "id": 1, + "type": 3, + "title": "Dawarich", + "description": "Self-hosted alternative to Google Location History", + "categories": ["Applications"], + "platform": "linux", + "logo": "https://dawarich.app/img/logo.svg", + "repository": { + "url": "https://git.bprieshof.nl/brammp/HomeServerCTs", + "stackfile": "stacks/dawarich-DockerCompose.yaml" + }, + "env": [ + { + "name": "DAWARICH_PORT", + "label": "Dawarich port", + "description": "The port Dawarich is hosted on", + "default": "3000" + }, + { + "name": "POSTGRESS_HOST", + "label": "DB server ip/hostname", + "description": "Postgresql server ip adres or hostname" + }, + { + "name": "POSTGRESS_PORT", + "label": "DB server port", + "description": "Postgresql server port", + "default": "5432" + }, + { + "name": "POSTGRESS_DB_NAME", + "label": "DB name", + "description": "Postgresql database name" + }, + { + "name": "POSTGRESS_DB_USERNAME", + "label": "DB Username", + "description": "Postgresql database username" + }, + { + "name": "POSTGRESS_DB_PASSWORD", + "label": "DB Password", + "description": "Postgresql database pasword" + }, + { + "name": "APPLICATION_HOSTS", + "label": "App hosts", + "description": "IP Address and hostnames the application is reacheable from", + "default": "localhost,::1,127.0.0.1" + }, + { + "name": "SECRET_KEY_BASE", + "label": "Secret key base", + "description": "The secret_key_base is used as the input secret to the applications key generator" + }, + { + "name": "PHOTON_API_HOST", + "label": "Photon API endpoint", + "description": "Endpoint url for komoot Photon API" + }, + { + "name": "PHOTON_API_KEY", + "label": "Photon API Key", + "description": "API Key for komoot Photon API" + } + ], + "maintainer": "https://git.bprieshof.nl/brammp" + } + ] +} \ No newline at end of file