chore: switch to all-SQLite stack (drop Postgres service)
This commit is contained in:
parent
74831483eb
commit
7d5ade6b6a
12 changed files with 104 additions and 62 deletions
|
|
@ -8,7 +8,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
# lfx = flow runtime; requests = convenience for custom-component code.
|
||||
RUN pip install "lfx==1.12.0" requests
|
||||
RUN pip install lfx requests
|
||||
|
||||
RUN mkdir -p /flows
|
||||
VOLUME /flows
|
||||
|
|
|
|||
|
|
@ -19,26 +19,8 @@ services:
|
|||
- "8000:8000" # FastAPI
|
||||
- "3000:3000" # Vite
|
||||
|
||||
db:
|
||||
image: postgres:16-trixie
|
||||
env_file:
|
||||
- ../.env
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
- ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
langflow:
|
||||
image: langflowai/langflow:1.12.0
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
image: langflowai/langflow:latest
|
||||
env_file:
|
||||
- ../.env
|
||||
environment:
|
||||
|
|
@ -49,6 +31,9 @@ services:
|
|||
PORT: "7860"
|
||||
LANGFLOW_AUTO_LOGIN: "false"
|
||||
LANGFLOW_API_KEY_SOURCE: env
|
||||
# SQLite file inside the langflow-data volume (absolute path required
|
||||
# by Langflow); overrides any postgres URL in ../.env.
|
||||
LANGFLOW_DATABASE_URL: sqlite:////app/langflow/langflow.db
|
||||
volumes:
|
||||
- langflow-data:/app/langflow
|
||||
ports:
|
||||
|
|
@ -85,9 +70,23 @@ services:
|
|||
retries: 12
|
||||
start_period: 30s
|
||||
|
||||
# Optional nightly auto-updates of :latest images. Not part of the default
|
||||
# dev startup (no container updates needed while iterating).
|
||||
watchtower:
|
||||
image: nickfedor/watchtower:latest
|
||||
profiles: ["updates"]
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
WATCHTOWER_LABEL_ENABLE: "true"
|
||||
WATCHTOWER_SCHEDULE: "0 0 4 * * *"
|
||||
WATCHTOWER_CLEANUP: "true"
|
||||
WATCHTOWER_ROLLING_RESTART: "true"
|
||||
labels:
|
||||
com.centurylinklabs.watchtower.enable: "true"
|
||||
|
||||
volumes:
|
||||
kirche-einfach-venv:
|
||||
kirche-einfach-node-modules:
|
||||
postgres-data:
|
||||
langflow-data:
|
||||
lfx-data:
|
||||
lfx-data:
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
-- Runs once on first init of the postgres-data volume.
|
||||
-- The main app database ($POSTGRES_DB) is created by the image itself.
|
||||
-- Langflow (authoring UI) gets its own database on the same instance.
|
||||
CREATE DATABASE langflow;
|
||||
|
||||
-- Isolated database for the pytest suite (migrated via Alembic in conftest).
|
||||
CREATE DATABASE kirche_einfach_test;
|
||||
|
|
@ -13,7 +13,7 @@ echo "--- Installing Node dependencies ---"
|
|||
cd /workspaces/kirche-einfach/frontend
|
||||
npm install
|
||||
|
||||
# Compose services (db, langflow, lfx) must be up; fail loudly otherwise.
|
||||
# Compose services (langflow, lfx) must be up; fail loudly otherwise.
|
||||
echo "--- Waiting for compose services ---"
|
||||
if [ ! -f /workspaces/kirche-einfach/.env ]; then
|
||||
echo "ERROR: /workspaces/kirche-einfach/.env is missing. Copy .env.example to .env and fill in secrets." >&2
|
||||
|
|
@ -24,7 +24,7 @@ import socket
|
|||
import sys
|
||||
import time
|
||||
|
||||
targets = [("db", 5432), ("langflow", 7860), ("lfx", 6004)]
|
||||
targets = [("langflow", 7860), ("lfx", 6004)]
|
||||
deadline = time.time() + 180
|
||||
pending = dict(targets)
|
||||
while pending and time.time() < deadline:
|
||||
|
|
@ -45,6 +45,14 @@ if pending:
|
|||
sys.exit(f"ERROR: compose services not ready: {sorted(pending)}")
|
||||
EOF
|
||||
|
||||
# Migrate the SQLite schema and reconcile backend/flows into the DB + LFX.
|
||||
echo "--- Migrating database ---"
|
||||
cd /workspaces/kirche-einfach/backend
|
||||
uv run alembic upgrade head
|
||||
|
||||
echo "--- Syncing canonical flows ---"
|
||||
uv run python scripts/sync_flows.py --sync || echo "WARN: flow sync failed (check backend/flows and LFX)"
|
||||
|
||||
echo ""
|
||||
echo "=== Setup complete ==="
|
||||
echo "Forgejo username: $FORGEJO_USERNAME"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue