Conversation
voidash
changed the base branch from
chore/configurable-compose-ports
to
main
September 28, 2026 06:27
Collaborator
|
@voidash seems like there is a merge conflict. |
The host ports for Postgres and the app were fixed at 5432 and 3000. They can now be overridden with DB_PORT and API_PORT; the defaults are unchanged. Also document that the migrate image runs one-off tasks such as db:init, and fix a Dockerfile comment that still mentioned the removed design CSS and fonts. Signed-off-by: voidash <ashish.thapa477@gmail.com>
Migrations ran from a separate image that was the whole build stage, dev dependencies included (2.07 GB), as root. The migration, project-init and GitHub-sync scripts are now bundled into single files that Node runs from the app image, so the migrate service uses the same image and the separate one is gone. db:migrate uses the same Drizzle migrator, which shares its history table with drizzle-kit. The runtime image also leaves out the unused image optimiser (sharp and libvips, about 19 MB; no page uses next/image) and the package managers, and both base images are pinned by digest. Signed-off-by: voidash <ashish.thapa477@gmail.com>
Compose required apps/api/.env.local and passed nothing else into the containers, so a deployment that supplies settings the usual way, in a .env next to docker-compose.yml, could not start: Compose refused to run without the file, and once it existed the app still received only DATABASE_URL and STORAGE_DIR. Both files are now optional env files for the app and migrate services; .env.local wins where both set a value. The Postgres credentials can also be set from .env (POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB), with the previous values as defaults, and DATABASE_URL is built from them. Signed-off-by: voidash <ashish.thapa477@gmail.com>
voidash
force-pushed
the
chore/lean-runtime-image
branch
from
September 30, 2026 18:46
790297a to
b732659
Compare
prod-docker-compose.yaml runs Postgres, the one-shot migration and the app the way Dokploy expects: settings load from the .env Dokploy writes, the app only exposes port 3000 and joins dokploy-network for Traefik, Postgres stays on the stack's own network, data is in named volumes, and no service sets container_name. Compose refuses to deploy without AUTH_URL or POSTGRES_PASSWORD, and there is no default database password. The deployment guide gets step-by-step Dokploy instructions. Signed-off-by: voidash <ashish.thapa477@gmail.com>
9 tasks done
| POSTGRES_USER: refined | ||
| POSTGRES_PASSWORD: refined | ||
| POSTGRES_DB: refined | ||
| POSTGRES_USER: ${POSTGRES_USER:-refined} |
Collaborator
There was a problem hiding this comment.
This is likely not reading .env.local
abhiyandhakal
requested changes
Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Makes the Docker deployment work from the settings a hosting platform provides, and ships one 286 MB image instead of a 341 MB app image plus a 2.07 GB migration image.
Settings from
.env. Compose requiredapps/api/.env.localand passed nothing else into the containers. A deployment that supplies settings the usual way, in a.envnext todocker-compose.yml, could not start: Compose refused to run without the file, and once it existed the app received onlyDATABASE_URLandSTORAGE_DIR, so it stopped with "Invalid environment configuration". Both files are now optional env files for the app andmigrate;.env.localwins where both set a value.Production stack for Dokploy.
prod-docker-compose.yamlfollows Dokploy's Docker Compose rules: settings load from the.envDokploy writes, the app only exposes 3000 and joinsdokploy-networkfor Traefik, Postgres stays on the stack's own network, data is in named volumes, nocontainer_name. Compose refuses to deploy withoutAUTH_URLorPOSTGRES_PASSWORD, and there is no default database password.docs/deployment.mdhas step-by-step Dokploy instructions.Database credentials from
.env.POSTGRES_USER,POSTGRES_PASSWORDandPOSTGRES_DBcan be set there (defaults unchanged), andDATABASE_URLis built from them.No separate migration image. The migration, project-init and GitHub-sync scripts are bundled with
bun buildinto three single files (1.1 MB in total) that plain Node runs from the app image. Themigrateservice in Compose uses the same image withnode scripts/migrate.js, and reads the env file so one-off tasks getGITHUB_TOKEN.One migrator everywhere.
db:migrateuses Drizzle's built-in migrator, the one the tests already used, instead ofdrizzle-kit migrate. Both record applied migrations in the same table, so existing databases carry on as they are.No unused image optimiser.
sharpand libvips (about 19 MB) are left out of the standalone output; no page usesnext/image, andimages.unoptimizedis set.No package managers (npm, yarn, corepack) in the runtime image.
Base images pinned by digest.
Configurable ports.
DB_PORTandAPI_PORToverride the host ports incompose.yaml(defaults unchanged: 5432, 3000), so the stack can run beside another Postgres or app. This was chore: make compose ports configurable #38, folded in here.Closes #52
Contract impact
packages/api-contractChecks
bun run lintbun run typecheckbun run test(150 passed)bun run buildbun run db:migrateon a clean database) with the new scriptTested with Docker from a clone of this branch:
npm/yarn/corepack, nosharp; runs asnodedocker compose upon a fresh databasenode scripts/init-project.js,node scripts/sync-github.jsin the image/en,/ne, members, issues, project,/v1/*,/health)DB_PORT=15432 API_PORT=13000 docker compose up -dbeside a stack holding 5432 and 3000.env(customPOSTGRES_PASSWORD,AUTH_URL), no.env.localhttps://devnepal.gov.np/..., pages 200prod-docker-compose.yamlwithoutPOSTGRES_PASSWORDorAUTH_URLprod-docker-compose.yamlwith Dokploy-style.env, on adokploy-networkdokploy-network; callbackhttps://devnepal.gov.np/...; pages 200;node scripts/init-project.jsin the app container works; data survives a redeployapps/api/.env.localdrizzle-kit migratethen this image's migration on the same databasedrizzle-kit migrate, and the reverse, on fresh databasesNotes for reviewers
outputFileTracingExcludesnames Bun'snode_modules/.bun/layout explicitly, because globs do not match that hidden directory. If the package manager changes, those two paths need updating; the build would then includesharpagain, not break.Foundation checklist
git commit -s)docs/deployment.md,.env.example)