# Portainer Deployment This directory contains Portainer stack templates for `production-orders-sync`. ## Stack Templates - `portainer-one-shot.yml`: manual one-shot stack for first dry-run checks and historical backfills. - `portainer-stack.yml`: long-running polling stack. It runs `npm run sync`, sleeps, then repeats. Keep the first production deployment as a one-day dry run: ```sh DRY_RUN=true SYNC_MODE=backfill SYNC_START_DATE=2026-07-02 SYNC_END_DATE=2026-07-02 TINY_REQUEST_DELAY_MS=5000 ``` After validating Tiny payload mapping and DB output, switch the polling stack to: ```sh DRY_RUN=false SYNC_MODE=recent RECENT_SYNC_DAYS=2 POLL_INTERVAL_SECONDS=1800 ``` ## Portainer Variables Set these in the Portainer stack environment: ```sh PRODUCTION_ORDERS_SYNC_IMAGE=gitea.blyzer.com.br/blyzer/production-order-tiny:latest TINY_API_TOKEN=... DATABASE_URL=postgres://... DRY_RUN=true SYNC_MODE=backfill SYNC_START_DATE=2026-07-02 SYNC_END_DATE=2026-07-02 TINY_REQUEST_DELAY_MS=5000 ``` For polling, use `SYNC_MODE=recent` and leave `SYNC_START_DATE` / `SYNC_END_DATE` empty unless you intentionally want an explicit recent range. ## Gitea Actions Secrets The workflow at `.gitea/workflows/ci-cd.yml` expects these repository secrets: ```sh REGISTRY_URL=gitea.blyzer.com.br REGISTRY_USERNAME=... REGISTRY_PASSWORD=... IMAGE_REPOSITORY=blyzer/production-order-tiny PORTAINER_WEBHOOK_URL=https://... # optional but recommended ``` `PORTAINER_WEBHOOK_URL` should be the webhook URL generated by Portainer for this stack. If it is missing, the workflow still tests and pushes the image, but it skips the redeploy trigger. ## Architecture Boundary This stack is standalone. It does not call n8n and does not add production-order sync logic to `api-tiny-n8n`.