Skip to main content

Deployment Guide

Konsolidat deploys with one script, deploy.sh, on one Docker host. Everything below is what the script and docker-compose.yml do on 2026-11-05. Read the script when in doubt; it is the procedure.

Quick start​

# On a fresh Ubuntu 22.04 server (Hetzner, DigitalOcean, AWS, ...)
curl -fsSL https://get.docker.com | sh
git clone https://github.com/grynn-in/konsolidat.git
cd konsolidat
./deploy.sh

Open the URL printed at the end and log in as Administrator. The password is in ./.credentials.

For HTTPS with a real DNS name:

./deploy.sh --domain epm.yourcompany.com

deploy.sh writes SITE_DOMAIN and SITE_SCHEME to .env. SITE_SCHEME is https only for a hostname. For localhost, an IP address or no domain it stays http, because Caddy would otherwise issue an internal certificate the browser rejects (konsolidat#59).

What deploy.sh does​

Before the numbered steps, deploy.sh:

  1. Checks that docker and docker compose exist.
  2. Creates .env from .env.example if it is missing, with random values for ADMIN_PASSWORD, DB_ROOT_PASSWORD, and CLICKHOUSE_PASSWORD. An existing .env is kept.
  3. Runs scripts/check-frappe-branch.sh .env. The image is built for Frappe version-16 only (Python 3.14, Node 24; konsol#358, konsolidat#272). If .env has a FRAPPE_BRANCH line with any other value, the deploy stops and tells you to back up the site, then delete the line or set it to version-16.

Then, in order:

StepCommandWhat happens
1/5docker compose up -d mariadb redis_cache redis_queue clickhouseStarts the infrastructure and waits up to 120 s for each health check.
2/5git clone or git fetch + reset --hard into docker/frappe/konsol, then docker compose --profile setup --profile backup buildStages the konsol app at KONSOL_BRANCH (default main) from KONSOL_REPO, then builds the one Frappe image, <project>-frappe:latest.
3/5docker compose --profile setup run --rm configuratorCreates the site and installs konsol on a new volume. On an existing site it runs bench migrate. In both cases it writes the ClickHouse connection into EPM Settings, syncs the scheduler jobs, and restores the baked asset manifest.
4/5docker compose up -d frappe_backend frappe_worker frappe_scheduler caddyStarts the application and waits for /api/method/ping.
FX pre-checkdbt show --inline '{{ fx_precheck() }}' through dbt_initChecks the governed group exchange rates (konsolidat#93). A missing epm_staging.group_exchange_rates table aborts the deploy; missing rates are listed as a warning and the deploy continues.
5/5docker compose --profile setup run --rm dbt_initRuns dbt build inside the image. A compilation error, database error or skipped model aborts the deploy with exit 1. Data-quality test failures are reported and tolerated.

At the end it prints the URLs and writes .credentials (mode 600).

There is no demo data. A fresh ClickHouse volume gets schema only: clickhouse/init-db.sql creates the databases and the konsol-owned reference tables, and clickhouse/raw-schema.sql creates the empty ERP landing tables in epm_raw so staging does not fail on a missing source. Load data as described in Loading data.

Server requirements​

A single server runs everything.

ProviderPlanSpecsMonthly cost
HetznerCPX418 vCPU, 16 GB RAM, 240 GB SSDabout EUR 15
DigitalOceanStandard 8GB4 vCPU, 8 GB RAM, 160 GBabout USD 48
AWSt3.xlarge4 vCPU, 16 GB RAM, EBSabout USD 120

Minimum: 4 vCPU, 8 GB RAM, 80 GB SSD, Ubuntu 22.04. The image build runs a Node asset build that takes about 700 MB; on an 8 GiB host build the image once and never in parallel (konsolidat#152).

Services​

docker-compose.yml defines 12 services. Six Frappe-based services run the same image, <project>-frappe:latest; only frappe_backend has a build: section.

ServiceContainerImageHost portProfile
mariadbkonsolidat_mariadbmariadb:10.11nonedefault
redis_cachekonsolidat_redis_cacheredis:7-alpinenonedefault
redis_queuekonsolidat_redis_queueredis:7-alpinenonedefault
clickhousekonsolidat_clickhouseclickhouse/clickhouse-server:24.8-alpine8123, 9000, 15432 on CLICKHOUSE_BIND (default 127.0.0.1)default
frappe_backendkonsolidat_backend<project>-frappe:latestFRAPPE_PORT (8069)default
frappe_workerkonsolidat_workersamenonedefault
frappe_schedulerkonsolidat_schedulersamenonedefault
caddykonsolidat_caddycaddy:2-alpineHTTP_PORT (80), HTTPS_PORT (443)default
configuratorkonsolidat_configuratorsame as backendnonesetup
dbt_initkonsolidat_dbt_initsame as backendnonesetup
backupkonsolidat_backupsame as backendnonebackup

Both Redis containers listen on 6379 inside the network. ClickHouse has the fixed address 172.30.0.10 on the open_epm network (subnet 172.30.0.0/24) so Airbyte pods can reach it by IP.

Every container's Docker log is capped at 3 files of 100 MB (x-logging in both compose files). This was added after an uncapped ClickHouse log reached 28.6 GB and filled the disk on 2026-10-06 (konsolidat 302250a).

Volumes: mariadb_data, clickhouse_data, clickhouse_logs, frappe_sites, frappe_logs, caddy_data, caddy_config. Docker prefixes each with the Compose project name (the checkout's directory name), for example repo_clickhouse_data for a checkout in ./repo. Do not set COMPOSE_PROJECT_NAME on an existing stack: a new name starts the stack on empty volumes.

The compose file docker-compose.v16.yml is an overlay for a second, independent stack used to verify an upgrade next to the live one (project konsolidat16, its own subnet and container names, Caddy not started). See Upgrading.

Managing the deployment​

./deploy.sh status # docker compose ps
./deploy.sh logs # docker compose logs -f --tail=50
./deploy.sh down # docker compose down
docker compose restart frappe_backend

A plain docker compose up -d starts the default-profile services. It does not run the configurator or dbt_init, because both are in the setup profile.

Loading data​

Data comes from two places:

  • Trial balance uploads. An entity without a connector uploads its trial balance. One trial balance goes through the Trial Balance Submission form in Desk. One file for many entities and periods goes through Trial Balance Upload in Desk (Check file, then Load); only the Close Lead (EPM Admin) or a System Manager may load. Every upload declares its Amount Basis (period movement, year-to-date movement or period-end balance); a wrong basis is caught by the build (assert_tb_submission_has_basis, assert_entity_has_one_amount_basis).
  • Connectors. A Connector document (module Pipeline) holds the ERP credentials and the Airbyte connection. See D365 Integration and ERPNext Integration.

The konsol-owned reference tables (entities, chart of accounts, fiscal calendar, rates, consolidation structure) are written by konsol into epm_staging on every document save, and re-written in full by reconcile_all after bench migrate. The Initial Setup Guide walks through them. To load them into a new site in dependency order, see Setting up a fresh site.

To start again from an empty ClickHouse volume:

./deploy.sh down
docker volume rm "$(basename "$PWD")_clickhouse_data"
./deploy.sh

Backup and restore​

Run a backup​

./deploy.sh backup

This runs docker/backup/backup.sh in the Frappe image and writes to BACKUP_PATH (default ./backups/<date>_<time>/):

  • mariadb.sql.gz: all Frappe databases (mariadb-dump --all-databases).
  • clickhouse/<db>__<table>.native.gz: every table in epm, epm_staging, epm_bronze, epm_silver and epm_gold, exported with FORMAT Native. epm_raw is not in the list; the uploaded trial balances it holds are rebuilt by re-loading the Trial Balance Upload documents.
  • frappe_sites.tar.gz: the sites/ directory (uploads, site_config.json).

Directories older than BACKUP_RETENTION_DAYS (default 7) are deleted. If BACKUP_S3_BUCKET is set and the aws CLI is in the image, the backup is also synced to s3://<bucket>/<date>/. The aws CLI is not installed by the Dockerfile today, so the S3 step prints a warning and skips.

./deploy.sh backup runs the image that ./deploy.sh built and never builds it: an unattended build next to a running ClickHouse can run the host out of memory. If the image is missing the command exits 1 with Frappe image ... not found. Run ./deploy.sh first; backup does not build. Watch the cron log for that line.

Schedule nightly backups​

crontab -e
0 2 * * * cd /path/to/konsolidat && ./deploy.sh backup >> /var/log/konsolidat-backup.log 2>&1

Push the backups off the server as well (rsync to a storage box, BACKUP_S3_BUCKET, or provider snapshots).

Restore​

./deploy.sh restore --from ./backups/2026-11-04_0200/
docker compose restart

deploy.sh restore does not call bench. It pipes mariadb.sql.gz into the mariadb client, copies and untars frappe_sites.tar.gz into the backend container, and curls each ClickHouse native file into INSERT INTO <db>.<table> FORMAT Native. It needs the stack running and reads DB_ROOT_PASSWORD, CLICKHOUSE_* from your shell, so run it as set -a; source .env; set +a; ./deploy.sh restore --from ....

Two things to know:

  1. A restore from another site carries that site's EPM Settings, including its ClickHouse password. Every write-through then fails with AUTHENTICATION_FAILED until you put this stack's password back in EPM Settings (seen on the demo rebuild, 2026-09-22).
  2. bench restore (the Frappe command, for a .sql.gz from bench backup) works in the image since konsolidat a73e143 added file(1) to the Dockerfile.

After a restore, run bench --site <site> execute konsol.clickhouse.reconcile_all inside frappe_backend so epm_staging matches the restored documents, then run dbt_init.

Upgrading​

git pull updates this repository only. The konsol app is a separate checkout, staged in docker/frappe/konsol and baked into the image; ./deploy.sh re-stages it on every run. So an upgrade is:

cd konsolidat
./deploy.sh backup # always first
git pull
KONSOL_BRANCH=main ./deploy.sh # re-stage konsol, rebuild, migrate, dbt build

./deploy.sh runs the five steps above. Step 3 runs the configurator, which runs bench migrate on the existing site. Never upgrade with a bare docker compose build && docker compose up -d: that skips the configurator, and new app code then runs against an unmigrated database. If you rebuild by hand, run the configurator yourself:

docker compose build frappe_backend
docker compose --profile setup run --rm configurator
docker compose up -d
docker compose --profile setup run --rm dbt_init

Upgrading an existing v15 stack to the v16 image​

The image moved to Frappe v16 (Python 3.14, Node 24) on 2026-11-04 (konsol#358, konsolidat#272). Deepak Pai chose to verify it on a side-by-side stack first; upgrading live in place was rejected. The order for an existing stack, from the konsol HANDOFF:

  1. Take a site backup inside the running backend: docker compose exec frappe_backend bench --site konsolidat.local backup --with-files. The v16 migrate cannot be undone. Take ./deploy.sh backup as well.
  2. In the stack's .env, delete the FRAPPE_BRANCH line or set it to version-16. A live .env written before 2026-11-04 pins version-15; deploy.sh refuses to run until it is changed (scripts/check-frappe-branch.sh).
  3. Run ./deploy.sh. It rebuilds the image on python:3.14-slim-bookworm with Node 24 and runs the configurator, which runs bench migrate.
  4. Desk links move to /desk; old /app/... URLs redirect.

To verify first on a copy, bring up the side-by-side stack from the same checkout with its own project name, env file and ports:

cp .env .env.v16 # then move every host port in .env.v16
docker compose -p konsolidat16 --env-file .env.v16 \
-f docker-compose.yml -f docker-compose.v16.yml up -d

Restore a backup of the live site into it, run the configurator for that project, and compare. Remove it with down -v when done. Verified on 2026-11-04: bench migrate exits 0, reconcile_all gives 43 of 43 synced epm_staging tables identical to live v15, dbt on Python 3.14 gives PASS=326 ERROR=0.

One shared image​

All six Frappe-based services run <project>-frappe:latest. Only frappe_backend builds it, so one rebuild updates all six together; pull_policy: never on all six stops Compose looking for the image on Docker Hub. deploy.sh builds with COMPOSE_PARALLEL_LIMIT=1. Stacks deployed before this change also have per-service images (<project>-frappe_worker and so on); once the new deploy is up, remove them with docker image rm.

The first upgrade to a version with the shared image must be a full ./deploy.sh run before the next scheduled backup, because ./deploy.sh backup needs that image and never builds it.

Production hardening​

Firewall​

ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

ClickHouse ports (8123, 9000, 15432) bind to CLICKHOUSE_BIND, default 127.0.0.1, so they are not reachable from outside the host. Open 15432 in the firewall only if you set CLICKHOUSE_BIND=0.0.0.0 for Excel ODBC, and then restrict it to your office IP range. The Frappe port 8069 is published on all interfaces; put it behind the firewall and reach them through Caddy.

Keep ClickHouse on loopback​

Leave CLICKHOUSE_BIND=127.0.0.1 in .env (the default). Set 0.0.0.0 only with TLS and a strong password in place. Set DBT_TARGET=prod for any networked ClickHouse so dbt uses TLS; the konsol app's own TLS is set in EPM Settings (clickhouse_secure, clickhouse_verify_tls).

Secrets​

.credentials holds every generated password; deploy.sh writes it with mode 600. Keep .env and .credentials out of version control and backups that leave the server unencrypted.

Component sizing​

ClickHouse​

WorkloadRecommendedNotes
Small (1-5 entities, under 1M rows)2 vCPU, 4 GB RAMDev, staging
Medium (10-50 entities, 1-10M rows)4 vCPU, 16 GB RAMTypical production
Large (50+ entities, 10M+ rows)8 vCPU, 32 GB RAMLarge groups

A clustered ClickHouse (docker-compose.cluster.yml) is scaffolding only and has not been verified on real hardware; the decision record (konsolidat#57) keeps single-node plus backups until a scale trigger arrives.

Frappe​

ComponentRecommendation
CPU2+ vCPU
RAM4+ GB
Storage20 GB (app plus MariaDB)
Gunicorn workers4 (the entrypoint default; GUNICORN_WORKERS is read by entrypoint.sh but not passed by compose, so change it in the compose file)

To run the warehouse as a sharded, replicated ClickHouse cluster instead of the single server described here, see ClickHouse Cluster Setup.

Next steps​