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:
- Checks that
dockeranddocker composeexist. - Creates
.envfrom.env.exampleif it is missing, with random values forADMIN_PASSWORD,DB_ROOT_PASSWORD, andCLICKHOUSE_PASSWORD. An existing.envis kept. - Runs
scripts/check-frappe-branch.sh .env. The image is built for Frappeversion-16only (Python 3.14, Node 24; konsol#358, konsolidat#272). If.envhas aFRAPPE_BRANCHline with any other value, the deploy stops and tells you to back up the site, then delete the line or set it toversion-16.
Then, in order:
| Step | Command | What happens |
|---|---|---|
| 1/5 | docker compose up -d mariadb redis_cache redis_queue clickhouse | Starts the infrastructure and waits up to 120 s for each health check. |
| 2/5 | git clone or git fetch + reset --hard into docker/frappe/konsol, then docker compose --profile setup --profile backup build | Stages the konsol app at KONSOL_BRANCH (default main) from KONSOL_REPO, then builds the one Frappe image, <project>-frappe:latest. |
| 3/5 | docker compose --profile setup run --rm configurator | Creates 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/5 | docker compose up -d frappe_backend frappe_worker frappe_scheduler caddy | Starts the application and waits for /api/method/ping. |
| FX pre-check | dbt show --inline '{{ fx_precheck() }}' through dbt_init | Checks 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/5 | docker compose --profile setup run --rm dbt_init | Runs 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.
| Provider | Plan | Specs | Monthly cost |
|---|---|---|---|
| Hetzner | CPX41 | 8 vCPU, 16 GB RAM, 240 GB SSD | about EUR 15 |
| DigitalOcean | Standard 8GB | 4 vCPU, 8 GB RAM, 160 GB | about USD 48 |
| AWS | t3.xlarge | 4 vCPU, 16 GB RAM, EBS | about 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.
| Service | Container | Image | Host port | Profile |
|---|---|---|---|---|
mariadb | konsolidat_mariadb | mariadb:10.11 | none | default |
redis_cache | konsolidat_redis_cache | redis:7-alpine | none | default |
redis_queue | konsolidat_redis_queue | redis:7-alpine | none | default |
clickhouse | konsolidat_clickhouse | clickhouse/clickhouse-server:24.8-alpine | 8123, 9000, 15432 on CLICKHOUSE_BIND (default 127.0.0.1) | default |
frappe_backend | konsolidat_backend | <project>-frappe:latest | FRAPPE_PORT (8069) | default |
frappe_worker | konsolidat_worker | same | none | default |
frappe_scheduler | konsolidat_scheduler | same | none | default |
caddy | konsolidat_caddy | caddy:2-alpine | HTTP_PORT (80), HTTPS_PORT (443) | default |
configurator | konsolidat_configurator | same as backend | none | setup |
dbt_init | konsolidat_dbt_init | same as backend | none | setup |
backup | konsolidat_backup | same as backend | none | backup |
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 inepm,epm_staging,epm_bronze,epm_silverandepm_gold, exported withFORMAT Native.epm_rawis not in the list; the uploaded trial balances it holds are rebuilt by re-loading the Trial Balance Upload documents.frappe_sites.tar.gz: thesites/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:
- A restore from another site carries that site's EPM Settings, including its ClickHouse password. Every write-through then fails with
AUTHENTICATION_FAILEDuntil you put this stack's password back in EPM Settings (seen on the demo rebuild, 2026-09-22). bench restore(the Frappe command, for a.sql.gzfrombench backup) works in the image since konsolidata73e143addedfile(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:
- 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 backupas well. - In the stack's
.env, delete theFRAPPE_BRANCHline or set it toversion-16. A live.envwritten before 2026-11-04 pinsversion-15;deploy.shrefuses to run until it is changed (scripts/check-frappe-branch.sh). - Run
./deploy.sh. It rebuilds the image onpython:3.14-slim-bookwormwith Node 24 and runs the configurator, which runsbench migrate. - 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
| Workload | Recommended | Notes |
|---|---|---|
| Small (1-5 entities, under 1M rows) | 2 vCPU, 4 GB RAM | Dev, staging |
| Medium (10-50 entities, 1-10M rows) | 4 vCPU, 16 GB RAM | Typical production |
| Large (50+ entities, 10M+ rows) | 8 vCPU, 32 GB RAM | Large 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
| Component | Recommendation |
|---|---|
| CPU | 2+ vCPU |
| RAM | 4+ GB |
| Storage | 20 GB (app plus MariaDB) |
| Gunicorn workers | 4 (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
- Operations Runbook: monthly close, reconcile, maintenance
- Monitoring: health, connector health, watermarks
- D365 Integration and ERPNext Integration
- Security Architecture