holi-moderation
A monorepo containing the whole moderation stack. Dockerfiles are only used for deployment. The docker-compose file is the core of its local setup. You can run it via holi-meta mprocs or directly. You need Okuna db running to start it.
The yarn monorepo shall orchestrate all the shared tasks on all the packages locally and in the pipeline. (lint, test, build)
How to run
- Prepare your env file:
- copy
.env.local.template
to.env.local
and set okuna db credentials - fill it, with the looked up values from your local okuna and generate some new secrets
- copy
Start either with mprocs (enable in holi-meta/.envrc.local.backends) or using docker-compose (with separate okuna db):
direnv reload
gcloud auth configure-docker europe-north1-docker.pkg.dev
docker compose up -d
Optional tools:
- install hasura-cli https://hasura.io/docs/latest/hasura-cli/install-hasura-cli
An initial user account is created for you and a password shown in the backend container log and saved to the backend/.credentials file.
(+++ INITIAL USER: moderation@holi.social ...
)
You should be able to reach the following endpoints:
How to work on
Do your changes in the code and in the hasura configuration or its console.
When done,
- generate graphql types for the frontend
- export the hasura console metadata changes
- generate the migrations for the moderation entities
- add those files to git
To apply changes to hasura metadata or run db migrations, simply restart the services or use the dedicated commands.
Useful commands
-
Generate GraphQL types for frontend:
docker compose exec frontend yarn run gqlgen
-
Export hasura metadata after changes via the Web console:
cd apps/hasura hasura metadata export
-
Generate new moderation service migrations
cd apps/backend yarn makemigrations migrations/<MigrationName>
-
Run moderation service migrations
cd apps/backend yarn migrate
-
Reload hasura metadata (in case of connection errors, new graphql schema, ...)
cd apps/hasura hasura md reload
Troubleshooting
Be aware of platform specific node-modules. E.g. @node-rs/argon2 binary fetching dependents on what system installs node_modules. If a container installed it, it's for Linux and the backend might not start on a Mac. Try yarn install again.