refactor(bigcapital): improve docker-compose reliability#717
refactor(bigcapital): improve docker-compose reliability#717adryserage wants to merge 2 commits intoDokploy:canaryfrom
Conversation
- Replace ports with expose (Traefik handles routing) - Add database_migration init container (runs migrations before server starts) - Add MinIO service for S3-compatible storage - Add minio-init container for bucket creation - Fix Gotenberg URL to use internal Docker DNS - Add healthchecks for MinIO - Clean up whitespace Ref: Resubmission of Dokploy#578 (closed for inactivity)
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Additional Comments (1)
Context Used: Context from Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
There was a problem hiding this comment.
Pull request overview
This PR refactors the BigCapital docker-compose template to improve reliability and Dokploy compatibility by switching from ports to expose, adding a database migration init container, and introducing self-contained MinIO storage for S3 compatibility.
Changes:
- Replaced
portswithexposefor all services (aligns with Dokploy's proxy-based routing) - Added
database_migrationinit container to run migrations before server startup - Added
minioandminio-initservices for self-contained S3-compatible storage - Hardcoded GOTENBERG_URL to internal Docker DNS address
| - "9000" | ||
| - "9001" | ||
| healthcheck: | ||
| test: ["CMD", "mc", "ready", "local"] |
There was a problem hiding this comment.
The healthcheck command "mc ready local" is not a valid MinIO health check. The correct healthcheck should use curl or wget to check the MinIO health endpoint. Based on other blueprints (e.g., budibase), the healthcheck should be: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]. Alternatively, you could use wget: test: ["CMD", "wget", "--spider", "-qO-", "http://localhost:9000/minio/health/live"].
| test: ["CMD", "mc", "ready", "local"] | |
| test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| expose: | ||
| - "3000" |
There was a problem hiding this comment.
Port mismatch: Gotenberg is configured to expose port 3000 here, but template.toml line 36 configures gotenberg_url = "http://gotenberg:9000". This inconsistency will cause PDF generation to fail as the application will try to connect to the wrong port. Either change the exposed port here to "9000" to match template.toml, or update template.toml to use port 3000. Based on Gotenberg's documentation, the default API port is 3000, so template.toml should be updated to match this configuration.
| - "3000" | ||
|
|
||
| minio: | ||
| image: minio/minio:latest |
There was a problem hiding this comment.
Using :latest tag violates repository conventions. According to the Dokploy coding guidelines: "NEVER use latest tag—it can break templates when upstream images change unexpectedly." Pin to a specific MinIO version instead (e.g., minio/minio:RELEASE.2025-04-08T15-41-24Z as seen in other templates like colanode, or minio/minio:RELEASE.2025-09-07T16-13-09Z as in budibase). This ensures deployment stability and reproducibility.
|
|
||
| # Creates the S3 bucket on startup | ||
| minio-init: | ||
| image: minio/mc:latest |
There was a problem hiding this comment.
Using :latest tag violates repository conventions. According to the Dokploy coding guidelines: "NEVER use latest tag—it can break templates when upstream images change unexpectedly." Pin to a specific version tag for minio/mc (e.g., check DockerHub for available release tags and use a specific one like minio/mc:RELEASE.2025-XX-XXT00-00-00Z).
|
|
||
| # Database migration - runs once then exits | ||
| database_migration: | ||
| image: bigcapitalhq/server:latest |
There was a problem hiding this comment.
Using :latest tag violates repository conventions. According to the Dokploy coding guidelines: "NEVER use latest tag—it can break templates when upstream images change unexpectedly." Pin to a specific version tag for bigcapitalhq/server. Check DockerHub for available version tags and use a specific one (e.g., bigcapitalhq/server:1.2.3 or similar).
| database_migration: | ||
| image: bigcapitalhq/server:latest | ||
| depends_on: | ||
| mysql: | ||
| condition: service_healthy | ||
| environment: | ||
| - DB_HOST=mysql | ||
| - DB_USER=${DB_USER} | ||
| - DB_PASSWORD=${DB_PASSWORD} | ||
| - DB_CHARSET=${DB_CHARSET} | ||
| - SYSTEM_DB_NAME=${SYSTEM_DB_NAME} | ||
| - TENANT_DB_NAME_PERFIX=${TENANT_DB_NAME_PERFIX} | ||
| - MONGODB_DATABASE_URL=mongodb://mongo/bigcapital | ||
| command: ["node", "packages/server/build/commands.js", "system:migrate:latest"] |
There was a problem hiding this comment.
The database_migration service uses MONGODB_DATABASE_URL=mongodb://mongo/bigcapital (line 103) but doesn't declare a dependency on the mongo service. This could cause the migration to fail if mongo isn't ready when the migration runs. Consider adding mongo to the depends_on section with condition: service_started to ensure proper startup order.
Summary
Improves the Bigcapital docker-compose template for better reliability and Dokploy compatibility.
Changes
Context
Clean resubmission of #578 (closed for inactivity). No review feedback was given on the original — changes are identical.
Testing
Greptile Summary
Refactored Bigcapital template to improve reliability by replacing
portswithexpose, adding database migration init container, and integrating self-contained MinIO for S3 storage.Major improvements:
exposeinstead ofports(Traefik handles external routing)Issues requiring attention:
version: "3.8"declaration violates Dokploy style guide requirementsConfidence Score: 3/5
docker-compose.yml(missing version, port conflicts) and verifytemplate.tomlGotenberg configuration matchesLast reviewed commit: 127b049
Context used:
dashboard- AGENTS.md (source)