Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions deploy/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ProcessGit deployment environment.
#
# Copy this file to ../.env (one level above deploy/) and fill in the values.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point updater env template at the file the sidecar mutates

This template instructs operators to copy values into ../.env, but the updater is configured to persist version pins to /deploy/.env (PROCESSGIT_UPDATER_ENV_FILE). With the documented root-level invocation (docker compose -f deploy/docker-compose.yml ...), Compose resolves variables from a PWD .env first, so a root ../.env can override and effectively ignore updater-written deploy/.env values; the next restart may reuse a stale PROCESSGIT_VERSION instead of the committed update.

Useful? React with 👍 / 👎.

# All variables marked `(required)` MUST be set; the others can be left blank
# to accept defaults.
#
# Generate the bearer token once:
# openssl rand -hex 32
#
# Then either:
# - Paste it into PROCESSGIT_UPDATER_TOKEN= below, or
# - Run: echo "PROCESSGIT_UPDATER_TOKEN=$(openssl rand -hex 32)" >> ../.env

# -----------------------------------------------------------------------------
# REQUIRED
# -----------------------------------------------------------------------------

# Shared bearer token between the main ProcessGit app and the updater sidecar.
# 64 hex chars = 32 bytes of entropy. Both containers read this from .env.
# (required)
PROCESSGIT_UPDATER_TOKEN=

# -----------------------------------------------------------------------------
# VERSION CONTROL
# -----------------------------------------------------------------------------

# Pin the ProcessGit image version. The updater rewrites this line when a
# release is committed via the in-product UI, so the next `docker compose up`
# reuses the same version after a host restart.
# Defaults to `latest` if unset, which moves on every stable release —
# acceptable for evaluation but not recommended for production.
PROCESSGIT_VERSION=latest

# -----------------------------------------------------------------------------
# UPDATER CONFIG (optional)
# -----------------------------------------------------------------------------

# GitHub repository the updater polls for releases.
PROCESSGIT_UPDATER_REPO=Algomation-AI/ProcessGit

# Slice 3A stub mode. The updater simulates the docker operations rather
# than actually pulling/swapping containers. Default true while the docker
# operations harden in Slice 3B.
# Flip to `false` once Slice 3B (real docker calls) is merged AND you've
# tested a stub-mode update flow end-to-end.
PROCESSGIT_UPDATER_STUB=true

# -----------------------------------------------------------------------------
# PROCESSGIT APP CONFIG (passed through env_file to the main container)
# -----------------------------------------------------------------------------

# Add any APP_* / GITEA_* / PROCESSGIT_* settings you want passed to the
# main app container here. See:
# https://docs.gitea.com/installation/install-with-docker
# for the available config keys (ProcessGit inherits Gitea's config surface).

# Example:
# APP_NAME=ProcessGit
# DOMAIN=processgit.example.com
# SSH_PORT=12222
60 changes: 57 additions & 3 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
# ProcessGit production-capable deployment.
#
# Two ways to run this:
#
# 1. Build locally from source (dev / first install):
# docker compose -f deploy/docker-compose.yml up --build -d
#
# 2. Pull from GHCR (production / after first install):
# docker compose -f deploy/docker-compose.yml pull
# docker compose -f deploy/docker-compose.yml up -d
#
# The `processgit-updater` service drives in-product updates from the
# admin UI. It requires:
#
# - $PROCESSGIT_UPDATER_TOKEN in .env (generate once via:
# openssl rand -hex 32 >> /tmp/x && sed -i "s/^/PROCESSGIT_UPDATER_TOKEN=/" /tmp/x
# then append /tmp/x to your .env). See deploy/.env.example.
# - /var/run/docker.sock bind-mounted (it needs to drive `docker pull` etc).
# - deploy/ directory bind-mounted, so the updater can find this file and
# persist the new PROCESSGIT_VERSION to .env on commit.

services:
processgit:
container_name: processgit
restart: unless-stopped
# Build OR pull, depending on whether the local tag exists.
build:
context: ..
dockerfile: deploy/Dockerfile.processgit
image: processgit:0.1
image: ghcr.io/algomation-ai/processgit:${PROCESSGIT_VERSION:-latest}
depends_on:
processgit-init-perms:
condition: service_completed_successfully
Expand All @@ -21,14 +43,17 @@ services:
USER_GID: "1000"
APP_NAME: "ProcessGit: Git for Processes"
PROCESSGIT_SEED_STRICT: "false"
# So the main app knows how to reach the updater
PROCESSGIT_UPDATER_URL: "http://processgit-updater:9000"
PROCESSGIT_UPDATER_TOKEN: ${PROCESSGIT_UPDATER_TOKEN:?PROCESSGIT_UPDATER_TOKEN is required - see deploy/.env.example}
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/v1/version >/dev/null 2>&1 || exit 1"]
interval: 5s
timeout: 3s
retries: 30

processgit-init-perms:
image: processgit:0.1
image: ghcr.io/algomation-ai/processgit:${PROCESSGIT_VERSION:-latest}
user: "0:0"
volumes:
- processgit-data:/data
Expand All @@ -37,7 +62,7 @@ services:
restart: "no"

processgit-bootstrap:
image: processgit:0.1
image: ghcr.io/algomation-ai/processgit:${PROCESSGIT_VERSION:-latest}
restart: "no"
depends_on:
processgit:
Expand All @@ -51,5 +76,34 @@ services:
entrypoint: ["/bin/sh", "-c"]
command: ["/opt/processgit/bootstrap/bootstrap-templates.sh"]

# ---------------------------------------------------------------------------
# Self-update sidecar. See updater/README.md.
# Drives `docker compose up --no-deps processgit` with a new version variable
# when the admin clicks "Install update" in the UI.
# ---------------------------------------------------------------------------
processgit-updater:
container_name: processgit-updater
restart: unless-stopped
image: ghcr.io/algomation-ai/processgit-updater:${PROCESSGIT_VERSION:-latest}
Comment on lines +84 to +87
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add local build config for updater sidecar

This service is image-only, so docker compose up --build cannot build it from source. Docker’s Compose docs state that automatic builds apply to services that define a build section; services without build are still pulled by image tag. That makes the file header’s "build locally" path misleading for processgit-updater, and fresh deployments will fail whenever ghcr.io/algomation-ai/processgit-updater:${PROCESSGIT_VERSION} is missing or not yet published.

Useful? React with 👍 / 👎.

environment:
PROCESSGIT_UPDATER_TOKEN: ${PROCESSGIT_UPDATER_TOKEN:?PROCESSGIT_UPDATER_TOKEN is required - see deploy/.env.example}
PROCESSGIT_UPDATER_REPO: ${PROCESSGIT_UPDATER_REPO:-Algomation-AI/ProcessGit}
PROCESSGIT_UPDATER_APP_CONTAINER: processgit
PROCESSGIT_UPDATER_COMPOSE_FILE: /deploy/docker-compose.yml
PROCESSGIT_UPDATER_ENV_FILE: /deploy/.env
# Slice 3A landed with stubs as the default; flip to "false" once Slice 3B is merged.
# Override here per deployment if you want to opt into real updates early.
PROCESSGIT_UPDATER_STUB: ${PROCESSGIT_UPDATER_STUB:-true}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- processgit-updater-state:/var/lib/processgit-updater
# The deploy/ directory is mounted RW so the updater can:
# - read docker-compose.yml to drive `docker compose up --no-deps`
# - persist the new PROCESSGIT_VERSION to .env on commit
- .:/deploy
# Parent dir (project root) RO for .env access via ../.env path
- ..:/host-root:ro

volumes:
processgit-data:
processgit-updater-state:
Loading