Add Docker Compose runner for config.yaml #1

Closed
opened 2026-06-15 01:45:29 +02:00 by pregno · 4 comments
Owner

Summary

Create Docker Compose support for the daytrading / PivotBot project so it can run using a repository-local config.yaml and .env without installing the Python package directly on the host.

Plan

See the saved Hermes plan: .hermes/plans/2026-06-15_014401-docker-compose-config-yaml.md.

Scope

  • Add a Docker image definition for the Python app.
  • Add docker-compose.yml that builds the local image and runs PivotBot with a mounted config.yaml.
  • Load secrets from .env; do not bake credentials into the image.
  • Document Docker Compose usage in README.md.

Implementation checklist

  • Add Dockerfile for the PivotBot runtime.
  • Add .dockerignore excluding secrets, local envs, caches, git metadata, and runtime artifacts.
  • Add docker-compose.yml with a pivotbot service.
  • Mount ./config.yaml into the container, likely as /app/config.yaml:ro.
  • Configure .env loading for Alpaca credentials and live-trading acknowledgement.
  • Set PYTHONUNBUFFERED=1 for readable live logs.
  • Default to a safe command, likely python -m pivotbot live --config /app/config.yaml with safety controlled by config.yaml mode.
  • Update README.md with setup, build, backtest, live/paper run, and stop instructions.

Acceptance criteria

  • docker compose config succeeds.
  • docker compose build succeeds.
  • docker compose run --rm pivotbot python -m pivotbot --help succeeds.
  • A local config.yaml is used via mount, not baked into the image.
  • .env remains outside the image and git.
  • Existing tests still pass, or any unrelated external-service limitation is clearly documented.

Test plan

  • Run python -m pytest for the existing suite.
  • Run docker compose config.
  • Run docker compose build.
  • Run a smoke test inside the container: docker compose run --rm pivotbot python -m pivotbot --help.

Notes / assumptions

  • The Compose default should run live using /app/config.yaml; mode: paper in config keeps paper trading as the normal safe mode.
  • Real-money live remains gated by I_UNDERSTAND_LIVE_TRADING=yes.
  • Runtime outputs should remain visible on the host through bind mounts or documented config paths.
## Summary Create Docker Compose support for the `daytrading` / PivotBot project so it can run using a repository-local `config.yaml` and `.env` without installing the Python package directly on the host. ## Plan See the saved Hermes plan: `.hermes/plans/2026-06-15_014401-docker-compose-config-yaml.md`. ### Scope - Add a Docker image definition for the Python app. - Add `docker-compose.yml` that builds the local image and runs PivotBot with a mounted `config.yaml`. - Load secrets from `.env`; do not bake credentials into the image. - Document Docker Compose usage in `README.md`. ### Implementation checklist - [ ] Add `Dockerfile` for the PivotBot runtime. - [ ] Add `.dockerignore` excluding secrets, local envs, caches, git metadata, and runtime artifacts. - [ ] Add `docker-compose.yml` with a `pivotbot` service. - [ ] Mount `./config.yaml` into the container, likely as `/app/config.yaml:ro`. - [ ] Configure `.env` loading for Alpaca credentials and live-trading acknowledgement. - [ ] Set `PYTHONUNBUFFERED=1` for readable live logs. - [ ] Default to a safe command, likely `python -m pivotbot live --config /app/config.yaml` with safety controlled by `config.yaml` mode. - [ ] Update `README.md` with setup, build, backtest, live/paper run, and stop instructions. ## Acceptance criteria - [ ] `docker compose config` succeeds. - [ ] `docker compose build` succeeds. - [ ] `docker compose run --rm pivotbot python -m pivotbot --help` succeeds. - [ ] A local `config.yaml` is used via mount, not baked into the image. - [ ] `.env` remains outside the image and git. - [ ] Existing tests still pass, or any unrelated external-service limitation is clearly documented. ## Test plan - Run `python -m pytest` for the existing suite. - Run `docker compose config`. - Run `docker compose build`. - Run a smoke test inside the container: `docker compose run --rm pivotbot python -m pivotbot --help`. ## Notes / assumptions - The Compose default should run `live` using `/app/config.yaml`; `mode: paper` in config keeps paper trading as the normal safe mode. - Real-money live remains gated by `I_UNDERSTAND_LIVE_TRADING=yes`. - Runtime outputs should remain visible on the host through bind mounts or documented config paths.
Author
Owner

Hermes dev workflow: implementation started. I will create a worktree from latest main, implement the Docker Compose runner, run validation, and open a PR linked with Closes #1.

Hermes dev workflow: implementation started. I will create a worktree from latest main, implement the Docker Compose runner, run validation, and open a PR linked with Closes #1.
Author
Owner

Hermes dev workflow: implementation started. I will create a worktree from latest main, implement the Docker Compose runner, run validation, and open a PR linked with Closes #1.

Hermes dev workflow: implementation started. I will create a worktree from latest main, implement the Docker Compose runner, run validation, and open a PR linked with Closes #1.
Author
Owner

Hermes dev workflow update: implementation is complete locally in worktree /Users/andrea/projects/daytrading-issue-1 on branch feat/1-docker-compose-config-yaml at commit f0cf1c7 feat: add Docker Compose runner, but I could not push/open the PR from this cron environment.\n\nImplemented files: Dockerfile, .dockerignore, docker-compose.yml, README.md, .gitignore.\n\nValidation:\n- uv run --with pytest python -m pytest -> 155 passed, 1 warning\n- docker compose config -> passed\n- docker compose build -> blocked because Docker daemon/socket is unavailable at /Users/andrea/.docker/run/docker.sock\n- docker compose run --rm pivotbot python -m pivotbot --help -> blocked for the same Docker daemon issue\n\nPush/PR blocker:\n- HTTPS git push failed: fatal: could not read Username for 'https://forgejo.basa-mimosa.ts.net': Device not configured\n- SSH push failed after accepting host key: Permission denied (publickey,password)\n- fj pr create --agit also failed authentication.\n\nNext needed action: provide non-interactive git push credentials for this cron environment or push the local branch manually, then open a PR with Closes #1.

Hermes dev workflow update: implementation is complete locally in worktree `/Users/andrea/projects/daytrading-issue-1` on branch `feat/1-docker-compose-config-yaml` at commit `f0cf1c7 feat: add Docker Compose runner`, but I could not push/open the PR from this cron environment.\n\nImplemented files: `Dockerfile`, `.dockerignore`, `docker-compose.yml`, `README.md`, `.gitignore`.\n\nValidation:\n- `uv run --with pytest python -m pytest` -> 155 passed, 1 warning\n- `docker compose config` -> passed\n- `docker compose build` -> blocked because Docker daemon/socket is unavailable at `/Users/andrea/.docker/run/docker.sock`\n- `docker compose run --rm pivotbot python -m pivotbot --help` -> blocked for the same Docker daemon issue\n\nPush/PR blocker:\n- HTTPS git push failed: `fatal: could not read Username for 'https://forgejo.basa-mimosa.ts.net': Device not configured`\n- SSH push failed after accepting host key: `Permission denied (publickey,password)`\n- `fj pr create --agit` also failed authentication.\n\nNext needed action: provide non-interactive git push credentials for this cron environment or push the local branch manually, then open a PR with `Closes #1`.
Author
Owner

Implementation completed and PR opened: #2

Implementation completed and PR opened: https://forgejo.basa-mimosa.ts.net/pregno/daytrading/pulls/2
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pregno/daytrading#1
No description provided.