openbikesensor-portal: init

This commit is contained in:
teutat3s 2022-11-28 16:08:31 +01:00
parent 8648709ed9
commit d78c4afe04
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
4 changed files with 165 additions and 0 deletions

View file

@ -0,0 +1,30 @@
###################################################
# Portal
###################################################
# Appears unused, configured in caddy on flora-6
OBS_PORTAL_URI=obs-portal.pub.solar
# Postgres + osm2pgsql
OBS_POSTGRES_HOST=postgres
OBS_POSTGRES_USER=obs
OBS_POSTGRES_PASSWORD=<<TODO>>
OBS_POSTGRES_DB=obs
OBS_POSTGRES_MAX_OVERFLOW=20
OBS_POSTGRES_POOL_SIZE=40
# Portal
OBS_HOST=0.0.0.0
OBS_PORT=3000
OBS_SECRET=<<TODO>>
OBS_POSTGRES_URL=postgresql+asyncpg://obs:<<TODO>>@obs-portal-db.svc.${TRITON_CNS_SEARCH_DOMAIN_PRIVATE}/obs
OBS_KEYCLOAK_URL=https://auth.pub.solar/realms/pub.solar/
OBS_KEYCLOAK_CLIENT_ID=openbikesensor-portal
OBS_KEYCLOAK_CLIENT_SECRET=<<TODO>>
OBS_DEDICATED_WORKER="True"
OBS_DATA_DIR=/data
OBS_PROXIES_COUNT=1
###################################################

View file

@ -0,0 +1,3 @@
FROM registry.greenbaum.cloud/library/openbikesensor-portal:c1ccec9
ADD ./config.py /opt/obs/api/config.py

View file

@ -0,0 +1,68 @@
# Bind address of the server
#HOST = "127.0.0.1"
#PORT = 3000
# Extended log output, but slower
DEBUG = False
VERBOSE = DEBUG
AUTO_RESTART = DEBUG
# Turn on lean mode to simplify the setup. Lots of features will be
# unavailable, but you will not need to manage OpenStreetMap data. Please make
# sure to configure the OBS_FACE_CACHE_DIR correctly for lean mode.
LEAN_MODE = False
# Required to encrypt or sign sessions, cookies, tokens, etc.
#SECRET = "!!!<<<CHANGEME>>>!!!"
# Connection to the database
#POSTGRES_URL = "postgresql+asyncpg://user:pass@host/dbname"
#POSTGRES_POOL_SIZE = 20
#POSTGRES_MAX_OVERFLOW = 2 * POSTGRES_POOL_SIZE
# URL to the keycloak realm, as reachable by the API service. This is not
# necessarily its publicly reachable URL, keycloak advertises that iself.
#KEYCLOAK_URL = "http://localhost:1234/auth/realms/obs/"
# Auth client credentials
#KEYCLOAK_CLIENT_ID = "portal"
#KEYCLOAK_CLIENT_SECRET = "00000000-0000-0000-0000-000000000000"
# Whether the API should run the worker loop, or a dedicated worker is used
#DEDICATED_WORKER = True
# The root of the frontend. Needed for redirecting after login, and for CORS.
# Set to None if frontend is served by the API.
FRONTEND_URL = None
FRONTEND_HTTPS = True
# Where to find the compiled frontend assets (must include index.html), or None
# to disable serving the frontend.
FRONTEND_DIR = "../frontend/build/"
# Can be an object or a JSON string
FRONTEND_CONFIG = {
"imprintUrl": "https://pub.solar/about",
"privacyPolicyUrl": "https://pub.solar/privacy",
"mapHome": {"zoom": 12, "longitude": 50.93, "latitude": 6.97},
"banner": {"text": "This is a test installation.", "style": "warning"},
}
# If the API should serve generated tiles, this is the path where the tiles are
# built. This is an experimental option and probably very inefficient, a proper
# tileserver should be prefered. Set to None to disable.
TILES_FILE = None
# Path overrides:
# API_ROOT_DIR = "??" # default: api/ inside repository
# DATA_DIR = "??" # default: $API_ROOT_DIR/..
# PROCESSING_DIR = "??" # default: DATA_DIR/processing
# PROCESSING_OUTPUT_DIR = "??" # default: DATA_DIR/processing-output
# TRACKS_DIR = "??" # default: DATA_DIR/tracks
# OBS_FACE_CACHE_DIR = "??" # default: DATA_DIR/obs-face-cache
# Additional allowed origins for CORS headers. The FRONTEND_URL is included by
# default. Python list, or whitespace separated string.
ADDITIONAL_CORS_ORIGINS = None
# vim: set ft=python :

View file

@ -0,0 +1,64 @@
version: '2.4'
volumes:
openbikesensor-portal-data:
# Uncomment this after volume creation
external: true
name: openbikesensor-portal-data
driver: tritonnfs
driver_opts:
size: "10G"
labels:
- volumename=openbikesensor-portal-data
services:
############################################################
# Portal
############################################################
postgres:
image: "openmaptiles/postgis:6.0"
environment:
- POSTGRES_DB=${OBS_POSTGRES_DB}
- POSTGRES_USER=${OBS_POSTGRES_USER}
- POSTGRES_PASSWORD=${OBS_POSTGRES_PASSWORD}
# Make sure the container starts after a host server reboot
restart: always
# This network is the default private fabric network in triton
network_mode: My-Fabric-Network
labels:
- triton.cns.services=obs-portal-db
portal:
image: registry.greenbaum.cloud/library/openbikesensor-portal:c1ccec9-pub-solar-config
env_file: .env
volumes:
- openbikesensor-portal-data:/data
# Make sure the container starts after a host server reboot
restart: always
# This network is the default private fabric network in triton
network_mode: My-Fabric-Network
depends_on:
- postgres
- worker
labels:
- triton.cns.services=obs-portal
worker:
image: registry.greenbaum.cloud/library/openbikesensor-portal:c1ccec9-pub-solar-config
env_file: .env
volumes:
- openbikesensor-portal-data:/data
# Make sure the container starts after a host server reboot
restart: always
# This network is the default private fabric network in triton
network_mode: My-Fabric-Network
depends_on:
- postgres
command:
- python
- tools/process_track.py
labels:
- triton.cns.services=obs-portal-worker