Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

dbbasic-object-server/docker-compose.yml
Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 7 minutes ago History
docker-compose.yml · 4.2 KB · 96 lines
1# DBBASIC Object Server — Docker Compose deployment.
2#
3# This is a second deployment path alongside the bare-VM systemd installer
4# (scripts/install.sh, docs/single-vm-deployment.md). See
5# docs/docker-deployment.md for the full walkthrough, including Coolify.
6#
7# The image built from ../Dockerfile is stateless: server code and the
8# packages/ manifests ship inside it. All runtime state -- object source,
9# TSV records, logs, versions, identity, permissions, the generated admin
10# token -- lives on the two named volumes below, mounted at the same paths
11# the Dockerfile sets as DBBASIC_OBJECTS_DIR / DBBASIC_DATA_DIR. That split
12# is the entire point of this deployment shape: rebuilding and redeploying
13# the image (a server *code* change) never touches the volumes, while live
14# object/schema/package edits made through the admin HTTP API land on the
15# volumes and take effect immediately, independent of the image lifecycle.
16#
17# TLS and domain routing are intentionally NOT part of this file. Coolify
18# (or your own reverse proxy) terminates TLS and routes a public hostname to
19# this container's published port, the same way Caddy sits in front of, not
20# inside, the systemd unit in docs/single-vm-deployment.md.
21
22services:
23 object-server:
24 build:
25 context: .
26 args:
27 # Shown by GET /admin/status. Empty (unknown) unless you set it:
28 # BUILD_COMMIT=$(git rev-parse --short HEAD) docker compose build
29 BUILD_COMMIT: ${BUILD_COMMIT:-}
30 image: dbbasic-object-server
31 restart: unless-stopped
32 env_file:
33 # Git-ignored (see .gitignore). Copy .env.example to .env and fill in
34 # real values -- never commit .env itself. Marked optional so a fresh
35 # clone can `docker compose up --build` with zero setup: without a
36 # .env the server starts with its conservative built-in defaults and
37 # the entrypoint generates a first-boot admin token.
38 - path: .env
39 required: false
40 volumes:
41 - objects:/data/objects
42 - data:/data/state
43 ports:
44 # host:container -- change the host side if 8001 is already taken.
45 - "8001:8001"
46 healthcheck:
47 # Same check as the image's HEALTHCHECK: no curl in the image.
48 test: ["CMD", "python", "-c", "import http.client,sys; c = http.client.HTTPConnection('127.0.0.1', 8001, timeout=4); c.request('GET', '/health'); sys.exit(c.getresponse().status >= 400)"]
49 interval: 30s
50 timeout: 5s
51 start_period: 10s
52 retries: 3
53
54 # The background daemon, object_daemon.py: scheduled tasks (package
55 # schedules and the methods objects schedule for themselves with
56 # _schedule), the queue, change dispatch, retention and cleanup passes.
57 # Same image, same env, same volumes as object-server -- only the command
58 # differs -- so it sees the same object source and data. Without it the
59 # server still answers, but nothing time-driven ever happens: a cache an
60 # object refreshes on a schedule simply goes stale. It publishes no port.
61 # See docs/docker-deployment.md "The daemon".
62 object-daemon:
63 build:
64 context: .
65 args:
66 # Shown by GET /admin/status. Empty (unknown) unless you set it:
67 # BUILD_COMMIT=$(git rev-parse --short HEAD) docker compose build
68 BUILD_COMMIT: ${BUILD_COMMIT:-}
69 image: dbbasic-object-server
70 restart: unless-stopped
71 env_file:
72 - path: .env
73 required: false
74 volumes:
75 - objects:/data/objects
76 - data:/data/state
77 # Start after the server is healthy: the server's first boot creates the
78 # data directory and the admin token file the entrypoint would otherwise
79 # race it for.
80 depends_on:
81 object-server:
82 condition: service_healthy
83 command: ["python", "object_daemon.py"]
84 # The image's HEALTHCHECK asks port 8001, which the daemon does not
85 # serve. A running daemon rewrites .daemon_heartbeat in the data dir
86 # every 30s; healthy means it did so in the last two minutes.
87 healthcheck:
88 test: ["CMD", "python", "-c", "import os,sys,time; sys.exit(0 if time.time() - os.path.getmtime(os.path.join(os.environ.get('DBBASIC_DATA_DIR', '/data/state'), '.daemon_heartbeat')) < 120 else 1)"]
89 interval: 60s
90 timeout: 5s
91 start_period: 30s
92 retries: 3
93
94volumes:
95 objects:
96 data: