From 46cbd3b44740d59458577ad4e765eab3a314bcb2 Mon Sep 17 00:00:00 2001 From: code Date: Sun, 22 Nov 2026 17:08:54 +0000 Subject: [PATCH] paisa: PAISA_LEDGER_PATH full-path ledger mount for in-repo demo; fix DB volume Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 1 + paisa/README.md | 15 +++++++++------ paisa/compose.yaml | 2 +- paisa/docs/demo.md | 31 +++++++++++++------------------ paisa/sample.env | 2 +- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c00c0f4..d814585 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,6 +32,7 @@ These deliberately violate the conventions above — do not "fix" them: - `pangolin_dev` is itself an edge reverse proxy (Pangolin + gerbil + traefik), not a client of NPM; the `proxy` network is declared for convention but unused by its services, and `traefik` uses `network_mode: service:gerbil` instead of joining `internal` - `zammad_dev` `zammad-init` service hardcodes `restart: on-failure` (init container) - `nextcloud/compose-aio.yaml` follows the upstream AIO layout: fixed container/volume names, no env templating, no proxy network +- `paisa` mounts its ledger repo from `${PAISA_LEDGER_PATH:-/data/paisa}` (a full path, not `VOL_PROJECTS`) so it can point at any folder, e.g. `paisa/demo` in a clone of this repo - `opencode` and `vscode` default `VOL_PROJECTS` to `${VOL_PATH:-/data}/projects` (nested default), not plain `/data` - `mailu_dev` passes env via `env_file: .env`, so its sample.env holds vars the compose file never references - `headscale` sample.env documents `HEADSCALE_DOMAIN`/`HEADSCALE_URL` for the config file even though compose doesn't use them diff --git a/paisa/README.md b/paisa/README.md index 1f19912..2b02ec8 100644 --- a/paisa/README.md +++ b/paisa/README.md @@ -15,7 +15,7 @@ budgets, and transaction management. ## Getting Started -1. Copy this stack's `config/` folder to `${VOL_PROJECTS:-/data}/paisa` +1. Copy this stack's `config/` folder to `${PAISA_LEDGER_PATH:-/data/paisa}` and make it a git repo. It holds `paisa.yaml`, an empty `main.ledger`, `sheets/`, and a `.gitignore`. Edit `paisa.yaml` to suit you. Starting a new business? Copy `template/` instead: it has a chart of @@ -35,21 +35,24 @@ especially the section on closing entries. PAISA_IMAGE – container image (default ananthakumaran/paisa:latest) PAISA_RESTART – restart policy (default unless-stopped) VOL_PATH – host base path for the database, backed up by restic (default /data) - VOL_PROJECTS – host base path for the ledger git repo (default /data) + PAISA_LEDGER_PATH – full host path of the ledger git repo, not a base path (default /data/paisa) PAISA_PORT – host port for the web UI (default 7500) ## Volume Notes -Anything that belongs in git goes in `VOL_PROJECTS`; anything that +Anything that belongs in git goes in `PAISA_LEDGER_PATH`; anything that doesn't (the SQLite database) goes in `VOL_PATH`, which is backed up. - `/root/Documents/paisa` — `paisa.yaml`, `*.ledger`, `sheets/`; - `${VOL_PROJECTS:-/data}/paisa` on the host, kept in git + `${PAISA_LEDGER_PATH:-/data/paisa}` on the host, kept in git - `/var/lib/paisa` — `paisa.db`; `${VOL_PATH:-/data}/paisa` on the host, backed up by restic -Both default to `/data`, so they start out as the same folder. Change -them in the stack's env in Dockhand to split them. +Both default to `/data/paisa`, so they start out as the same folder. +`PAISA_LEDGER_PATH` is a full path (nothing is appended), so it can point +anywhere, such as the `demo/` folder in a clone of this repo. The +database location comes from `db_path` in `paisa.yaml` +(`/var/lib/paisa/paisa.db`), so it never lands in the ledger repo. ## Network Notes diff --git a/paisa/compose.yaml b/paisa/compose.yaml index 06203da..ff52387 100644 --- a/paisa/compose.yaml +++ b/paisa/compose.yaml @@ -6,7 +6,7 @@ services: restart: ${PAISA_RESTART:-unless-stopped} volumes: - - ${VOL_PROJECTS:-/data}/paisa:/root/Documents/paisa + - ${PAISA_LEDGER_PATH:-/data/paisa}:/root/Documents/paisa - ${VOL_PATH:-/data}/paisa:/var/lib/paisa ports: diff --git a/paisa/docs/demo.md b/paisa/docs/demo.md index 82ed7fe..2c6b04e 100644 --- a/paisa/docs/demo.md +++ b/paisa/docs/demo.md @@ -115,38 +115,33 @@ loan, a credit card, and a savings transfer toward an excavator fund. | Data | Host path | In git? | | ----------------------------- | ---------------------------- | ------- | -| `paisa.yaml`, `*.ledger` | `${VOL_PROJECTS:-/data}/paisa` | Yes | +| `paisa.yaml`, `*.ledger` | `${PAISA_LEDGER_PATH:-/data/paisa}` | Yes | | `paisa.db` (SQLite) | `${VOL_PATH:-/data}/paisa` | No, backed up by restic | -Both variables default to `/data`, so out of the box both are `/data/paisa`. +Out of the box both are `/data/paisa`. ## Load the demo -1. From the root of this repo, copy the demo into its own folder, keeping - your real books separate: +1. Clone this repo somewhere on the Docker host, e.g.: ```bash - mkdir -p /data/demo - cp -r paisa/demo /data/demo/paisa + cd /data/paisa + git clone https://github.com/nickyeoman/docker-compose-cookbooks.git ``` -2. In Dockhand, edit the stack's environment variables: +2. In Dockhand, set the stack's environment variable to the demo folder: ```env - VOL_PROJECTS=/data/demo - VOL_PATH=/data/demo-db + PAISA_LEDGER_PATH=/data/paisa/docker-compose-cookbooks/paisa/demo ``` - The compose file appends `/paisa`, so the ledger comes from - `/data/demo/paisa` and the database is written to `/data/demo-db/paisa`. + The path is used as-is, so the ledger comes straight from the clone. + The database stays in `${VOL_PATH:-/data}/paisa` (from `db_path` in + `demo/paisa.yaml`). 3. Redeploy the stack and open http://localhost:7500 (or the host's address or proxy hostname if you're not on the Docker host). -4. Optional: make it a git repo to try the workflow: - ```bash - cd /data/demo/paisa && git init && git add . && git commit -m "Demo books" - ``` ## Switch back to your own books -Set `VOL_PROJECTS` and `VOL_PATH` back to your values (default `/data`) -and redeploy. The demo database in `/data/demo-db` can be deleted at any -time; Paisa rebuilds it from the ledger files. +Set `PAISA_LEDGER_PATH` back to your books (default `/data/paisa`) and +redeploy. Paisa rebuilds `paisa.db` from the ledger files, so the demo +data in it is replaced on the next sync. ## Start your own books diff --git a/paisa/sample.env b/paisa/sample.env index a7aa358..af95937 100644 --- a/paisa/sample.env +++ b/paisa/sample.env @@ -1,5 +1,5 @@ PAISA_IMAGE=ananthakumaran/paisa:latest PAISA_RESTART=unless-stopped VOL_PATH=/data -VOL_PROJECTS=/data +PAISA_LEDGER_PATH=/data/paisa PAISA_PORT=7500