Skip to content

Conversation

MiViewIT
Copy link

@MiViewIT MiViewIT commented Sep 20, 2025

Litteral first Public PR for me, thanks for being my first. Do with this as you see fit or send it to the depths. personlly it is the difference between being able to run the app at all or not for me, in a way thats pseudo progromatic.

Title:
Fix: Restore local Docker-Compose & Local Environment Configuration


What does this PR do?

This PR fixes the local Docker Compose environment, restoring a working setup for developers (which was previously non-standard). It makes multiple changes so that running the project locally is smooth, reliable, and close to how production runs, without manual workarounds.


Commit Summary

Here are some of the key changes included:

  • Environment variables updated and expanded: sample .env now contains required variables; many new vars added to support local compose.
  • Images / static assets fixed — switched on “unoptimized” mode locally so images render correctly.
  • Increased DB transaction timeout (from 5s → 30s) for operations that were timing out in local / slower setups.
  • Fallback URL fixes to ensure services/auth/login etc work even when certain env vars are missing.
  • Added migrations & seeding logic (seeder / migrator) so local development can reset the DB and seed data automatically.
  • Suppressed noisy logs (e.g. PostHog warnings) to reduce distraction in local dev setup.
  • Refactored env var usage / deduplication to reduce duplication and maintain legacy compatibility.
  • Fixed crash bug in useRun type checking.
  • Housekeeping: removed deprecated husky lines, cleaned login URLs, merged latest upstream changes, updated dependencies where necessary.

Visual Demo

Image Demo:

Automated tests were updated to pass as a part of this PR, they shouldnt have failed because of me, i suspect they were stale.
(No "before" demo provided since setup was beyond my comprehension.)
image


Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code.
  • I have updated developer docs (README or /docs) to reflect changed/added environment variables or setup steps.
  • Automated tests are in place and passing, especially for local environment scenarios.

How should this be tested?

  1. Checkout branch Local-Compose-Fixes.
  2. Copy .env.example to .env (or equivalent), ensure all required environment variables are present.
  3. Run docker compose up --build.
  4. Confirm all services start without errors (migrator/seeder finish, no missing env var crashes).
  5. Confirm image assets load properly (unoptimized where needed).
  6. Verify login, authentication, APIs work correctly with fallback URLs.
  7. If applicable, reset DB / reseed and ensure seed logic runs.
  8. Run full test suite to ensure there are no regressions.

Checklist

  • No new warnings or errors on startup.
  • Environment variable changes documented.
  • Documentation updated to include any new / changed setup steps.
  • All relevant tests pass.

…se crash

remove overzealous type from useRun to prevent compose crash
allow project id to be set using the TRIGGER_PROJECT_ID environment variable instead of hardcoding it in the config
…TTER_AUTH_URL

use process.env.BETTER_AUTH_URL ?? process.env.NEXT_PUBLIC_BETTER_AUTH_URL to avoid duplication and ensure legacy compatibility
update concurrently to latest version
…BLIC_BETTER_AUTH_URL

use process.env.NEXT_PUBLIC_PORTAL_URL ?? process.env.NEXT_PUBLIC_BETTER_AUTH_URL to maintain legacy compatibility while reducing duplication
this change was to get docker compose working locally, with a singular env file. this does exclude the migrations at the moment
…osthog not setup log noise

posthog was being noisy for local enviornment users and/or users who do not use posthog.
…ompose config

FORCE_DATABASE_WIPE_AND_RESEED added to reset db if someone is experimenting/currupted. also added the migrator and seeder to the local compose project so they would run migrations automatically, and the app and portal would wait to start. Also sending logs to docker now from seeder and migrator
to resolve error

[Better Auth]: Your Better Auth config includes advanced.generateId which is deprecated. Please use advanced.database.generateId instead. This will be removed in future releases.
i misunderstood why we needed to point to auth over and over. this really needs to be an internal reference. so updated it to be static default if none was given
i decided that this would be better to return to how it was before, and allow the compose to set them with a default fallback.
put in the wrong fallback url
some more complicated tasks on low end databases would time out, this is important for scaling db's and local. so i increased the timeout from the default 5 seconds to 30. it can be increased further but 30 seconds is good as anything longer may run into client side aka browser, keep-alive limits
use previous app enviornment variable to set the unoptimized  to true which should fix local images. this is as per recomendation on issue 1467 trycompai#1467
i brought in all the variables i could fine into this one here. the required ones to run are uncommented from best as i could glean.
@CLAassistant
Copy link

CLAassistant commented Sep 20, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

vercel bot commented Sep 20, 2025

@james-miview is attempting to deploy a commit to the Comp AI Team on Vercel.

A member of the Team first needs to authorize it.

updated readme with docker compose usage. I forgot to update an env variable on the app, did that too.
the fallback url got dropped, adding it back
pretty sure this wasnt me, but the pr says they want a screen shot of it running without errors, so debugging here we go.
@MiViewIT MiViewIT marked this pull request as ready for review September 20, 2025 04:30
Copy link

vercel bot commented Sep 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
app Ready Ready Preview Comment Sep 22, 2025 1:04pm
portal Ready Ready Preview Comment Sep 22, 2025 1:04pm

@Marfuen
Copy link
Contributor

Marfuen commented Sep 22, 2025

@MiViewIT This is great, will review this later today or tomorrow

added concurrency limits to help with smaller db's. fixed trigger.dev setup process for local. added safety/skip check for fleet.
merge comments got left in somehow, weird. removed them.
updated readme to include DB connection pooling notes, so trigger.dev dosnt overwhelm smaller db's
@MiViewIT
Copy link
Author

MiViewIT commented Oct 2, 2025

I relised that Trigger.dev was never going to run, because the deploy function was never invoked locally. So i added that to the build pipeline in the Dockerfile. Going through that i relised FLEET was being noisy, added a check to bypass if it was not given. Added Trigger.dev PAT token to bypass manual browser auth. Added Trigger.dev Task concurrency limits globally -- this may be unnessarry, but its also optional. I updated readme to support these changes.

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.

4 participants