dpsapi deployment

This commit is contained in:
bryanpedini committed 2026-10-06 11:34:58 +02:00
1 parent 8183655897
commit 76285dae43
4 files changed
+75

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
.env
data
+18
View File
@@ -0,0 +1,18 @@
# dpsapi Deployment
Docker PS API — [source/dpsapi](https://git.bjphoster.com/source/dpsapi).
Exposes `GET /api/v1/containers` (the running containers, like `docker ps`) behind a bearer token. Needs the Docker socket and a persistent directory for its SQLite database.
## Usage
```sh
cp env.example .env
# edit .env
docker compose up -d
```
Manage tokens and read the audit log with the same binary:
```sh
docker compose exec dpsapi /app token new "description"
docker compose exec dpsapi /app token list
docker compose exec dpsapi /app audit
```
+39
View File
@@ -0,0 +1,39 @@
---
services:
dpsapi:
image: git.bjphoster.com/source/dpsapi:${DPSAPI_VERSION}
restart: unless-stopped
environment:
- DB_PATH=/data/dpsapi.db
- HTTP_ADDR=0.0.0.0
- HTTP_PORT=${TRAEFIK_SERVICE_PORT}
- LOG_LEVEL=${DPSAPI_LOG_LEVEL}
labels:
### Section Træfik
- traefik.enable=${TRAEFIK_ENABLED}
- traefik.docker.network=${TRAEFIK_NETWORK}
## HTTP
- traefik.http.routers.http-${TRAEFIK_ROUTER}.entrypoints=http
# redirect to HTTPS only
- traefik.http.routers.http-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_HTTP_MIDDLEWARES}
- traefik.http.routers.http-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE}
## HTTPS
- traefik.http.routers.https-${TRAEFIK_ROUTER}.entrypoints=https
# configure the exposed service
- traefik.http.routers.https-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_HTTPS_MIDDLEWARES}
- traefik.http.routers.https-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE}
# enable TLS and its certificate provider
- traefik.http.routers.https-${TRAEFIK_ROUTER}.tls=${TRAEFIK_TLSENABLED}
- traefik.http.routers.https-${TRAEFIK_ROUTER}.tls.certresolver=${TRAEFIK_CERTRESOLVER}
# specify a service so a custom port can be used
- traefik.http.services.${TRAEFIK_SERVICE}.loadbalancer.server.port=${TRAEFIK_SERVICE_PORT}
networks:
- traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ${DPSAPI_DATA}:/data
networks:
traefik:
external: true
name: ${TRAEFIK_NETWORK}
+16
View File
@@ -0,0 +1,16 @@
# Træfik
TRAEFIK_ENABLED=true
TRAEFIK_NETWORK=traefik
TRAEFIK_ROUTER=dpsapi_example_com
TRAEFIK_SERVICE=dpsapi_example_com
TRAEFIK_SERVICE_PORT=80
TRAEFIK_MATCHRULE=Host(`dpsapi.example.com`)
TRAEFIK_TLSENABLED=true
TRAEFIK_CERTRESOLVER=letsencrypt
TRAEFIK_HTTP_MIDDLEWARES=http-to-https
TRAEFIK_HTTPS_MIDDLEWARES=hsts
# dpsapi
DPSAPI_VERSION=latest
DPSAPI_DATA=./data
DPSAPI_LOG_LEVEL=INFO