Skip to content

refactor: docker setup & example env files - #3360

Merged
dnechay merged 29 commits into
developfrom
dnechay/3053
May 27, 2025
Merged

refactor: docker setup & example env files#3360
dnechay merged 29 commits into
developfrom
dnechay/3053

Conversation

@dnechay

@dnechay dnechay commented May 21, 2025

Copy link
Copy Markdown
Collaborator

Issue tracking

First iteration of #3053.

Tip

GitBook has a review request with updated version of the docs to correspond to this PR, so you can check it for reference while reviewing

Context behind the change

env files refactor

If someone needs to add an env variable they need to add it in 4 places:

  • config service
  • env schema
  • .env.example
  • ENV.md

Last two don't provide much benefit and also not required for app to work, so they also become outdated. This PR changes the approach.

Now when adding new env variable you will have to add it to config and schema (so app will work in general), but no ENV.md anymore and .env.example has different purpose: it will serve as a minimal subset of valid env variables that are needed to run the app locally, so anyone can cp .env.example .env, replace some secrets and start app for local easily. Person who adds new env variable is responsible for adding a valid default value to config service and/or valid value for anything else to .env.example; for e.g. private keys there also should be a value, but placeholder, e.g. replace_me.

Also revisited env vars and removed what is not used.
Ideally we have aligned env vars names (e.g. RPC_POLYGON_AMOY_URL and RPC_AMOY_URL), but it impacts apps configuration, so better to do in a separate PR later.

docker setup refactor

  • aligned exposed port of docker services w/ env vars in services, so if you have something running in docker already, the app that you run in terminal can interact with it
  • removed docker-compose files in apps folder in favor of the one in docker-setup folder; the goal is to have one valid docker compose file that sets up all necessary infra for services, like postgres, redis and minio
  • fortune is now part of docker setup; had to fix incorrectly installed deps there
  • added convenience scripts via Makefile, but also you now can write yarn docker:infra-up from the root in order to start Postgre, Redis & Minio
  • added setup-kv-store scripts to Node.js apps in order to ease local setup
  • got rid of per-service compose files with env, now rely on .env from the service folder and override only necessary values

Warning

  • cvat service names in docker has changed, so in case you had them set up earlier - you will have to update url-values in KV store (from http://exchange-oracle:5000 to http://exchange-oracle-cvat:5000; same for recording oracle)
  • default minio bucket names changed for cvat, so you will have to update them and KV store values as well
  • env vars got changed in .env.compose, so please update it
  • also if you had the setup earlier and want to add fortune - you will need to manually create a Postgre DB for it;

As an alternative, you can down all the setup and recreate it service by service, just updating values on chain

What's next?

This PR is already big, so decided to split the work. In next iterations/PRs will:

  1. cleanup .env files for compose setup: the goal is to rely on .env.example instead of different set of env files and have some convenient setup scripts
  2. Refactor docker and scripts/web3 to be just part of core and sdk
  3. Setup KV store scripts for CVAT?
  4. Cleanup

How has this been tested?

  • do cp .env.example .env in each service and start it; make sure it can be started and does basic work (e.g. auth or /job endpoint)
  • run each service in Docker
  • run yarn setup:kvstore from inside of docker containers to make sure KV values are correctly set
  • for docker setup, launch fortune job using crypto, complete and ensure correct escrow completion

Release plan

Just merge this PR and changes to GitBook docs.

Potential risks; What to monitor; Rollback plan

N/A

@dnechay dnechay self-assigned this May 21, 2025
@vercel

vercel Bot commented May 21, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 4:06pm
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 4:06pm
staking-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 26, 2025 4:06pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
faucet-frontend ⬜️ Ignored (Inspect) Visit Preview May 26, 2025 4:06pm
faucet-server ⬜️ Ignored (Inspect) Visit Preview May 26, 2025 4:06pm

@vercel
vercel Bot temporarily deployed to Preview – staking-dashboard May 21, 2025 08:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-app May 21, 2025 08:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – human-dashboard-frontend May 21, 2025 08:55 Inactive
@dnechay
dnechay marked this pull request as ready for review May 21, 2025 13:12
@dnechay
dnechay requested review from Dzeranov and flopez7 May 21, 2025 13:13
@dnechay
dnechay marked this pull request as draft May 22, 2025 11:17
@dnechay
dnechay merged commit 759a20f into develop May 27, 2025
@dnechay dnechay mentioned this pull request May 27, 2025
17 tasks
@dnechay
dnechay deleted the dnechay/3053 branch May 27, 2025 21:20
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.

3 participants