Skip to content

refactor(bigcapital): improve docker-compose reliability#717

Open
adryserage wants to merge 2 commits intoDokploy:canaryfrom
adryserage:refactor/bigcapital
Open

refactor(bigcapital): improve docker-compose reliability#717
adryserage wants to merge 2 commits intoDokploy:canaryfrom
adryserage:refactor/bigcapital

Conversation

@adryserage
Copy link

@adryserage adryserage commented Feb 20, 2026

Summary

Improves the Bigcapital docker-compose template for better reliability and Dokploy compatibility.

Changes

  • **\ports\ → \expose**: All services now use \expose\ since Traefik handles external routing
  • Database migrations: Added \database_migration\ init container that runs migrations before the server starts (prevents race conditions)
  • MinIO for S3: Added \minio\ + \minio-init\ services for self-contained S3-compatible storage
  • Gotenberg URL: Hardcoded to \http://gotenberg:3000\ (internal Docker DNS) instead of env var
  • Healthchecks: Added healthcheck for MinIO
  • Cleanup: Removed trailing whitespace and empty lines

Context

Clean resubmission of #578 (closed for inactivity). No review feedback was given on the original — changes are identical.

Testing

  • Verified docker-compose syntax with \docker compose config\
  • Services start in correct dependency order: mysql → migration → server

Greptile Summary

Refactored Bigcapital template to improve reliability by replacing ports with expose, adding database migration init container, and integrating self-contained MinIO for S3 storage.

Major improvements:

  • Database migration race condition eliminated via init container pattern
  • MinIO + minio-init services enable self-contained S3-compatible storage
  • Proper use of expose instead of ports (Traefik handles external routing)
  • Healthchecks ensure correct service startup order

Issues requiring attention:

  • Missing version: "3.8" declaration violates Dokploy style guide requirements
  • Gotenberg port configuration mismatch: hardcoded as 3000 in docker-compose but template.toml specifies 9000
  • MinIO bucket set to public download - verify this is intentional for your security requirements

Confidence Score: 3/5

  • This PR is safe to merge with moderate risk - requires minor fixes before production use
  • Score reflects solid architectural improvements (init containers, MinIO integration, proper expose usage) but requires critical fixes: missing version declaration violates Dokploy requirements, Gotenberg port mismatch between docker-compose and template.toml could break PDF generation, and public S3 bucket needs security review
  • Pay attention to docker-compose.yml (missing version, port conflicts) and verify template.toml Gotenberg configuration matches

Last reviewed commit: 127b049

Context used:

  • Context from dashboard - AGENTS.md (source)

- 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)
Copilot AI review requested due to automatic review settings February 20, 2026 08:07
@github-actions
Copy link

github-actions bot commented Feb 20, 2026

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
templates ✅ Ready (View Log) Visit Preview f4ee6ad

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 6 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 20, 2026

Additional Comments (1)

blueprints/bigcapital/docker-compose.yml
missing version: "3.8" declaration (required by Dokploy style guide)

version: "3.8"
services:

Context Used: Context from dashboard - AGENTS.md (source)

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!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ports with expose for all services (aligns with Dokploy's proxy-based routing)
  • Added database_migration init container to run migrations before server startup
  • Added minio and minio-init services for self-contained S3-compatible storage
  • Hardcoded GOTENBERG_URL to internal Docker DNS address

- "9000"
- "9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"].

Suggested change
test: ["CMD", "mc", "ready", "local"]
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.

Comment on lines +149 to +150
expose:
- "3000"
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
- "3000"

minio:
image: minio/minio:latest
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot generated this review using guidance from repository custom instructions.

# Creates the S3 bucket on startup
minio-init:
image: minio/mc:latest
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot generated this review using guidance from repository custom instructions.

# Database migration - runs once then exits
database_migration:
image: bigcapitalhq/server:latest
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +91 to +104
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"]
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants