Rename env.local
file to .env
.
For the sanity content to work, you need to set
the SANITY_API_TOKEN
.
There are 2 kinds of graphql types to generate. We have types for interacting with the different subgraphs, and the types
for our exposed graphql api schema.
Run yarn generate
to generate all gql types
First we need to spin up the database, there is a docker-compose
file with a postgres
database configured. Spin it up by running docker-compose up -d
.
Run yarn prisma migrate dev
to apply all database migrations.
Run yarn prisma generate
to generate the prisma client. Usually this is already
done by applying the migrations
Trigger the following mutations when you start from a clean DB:
poolSyncAllPoolsFromSubgraph
poolReloadStakingForAllPools
userInitWalletBalancesForAllPools
userInitStakedBalances
Retrieve the current pg_dump file under https://api-db-dump.s3.eu-central-1.amazonaws.com/canary/api-dump.YYYYMMDD
.
Database dumps are kept for the previous 7 days, replace YYYYMMDD in the URL above (ie: 20230317) to download a db dump.
Run docker-compose up -d
to start the database via docker compose.
Retrieve the docker container ID through docker ps
.
Run docker exec -i <container-ID> /bin/bash -c "PGPASSWORD=let-me-in psql --username backend database" < /path/on/your/machine/dump
with the container-ID from the step before.
The output at the very end saying ERROR: role "rdsadmin" does not exist
is normal and can be ignored.
yarn start:local
We run a canary and a production (called main) deployment environment.
The canary environment is built from the v2-canary
branch and the production deployment
is built from the v2-main
branch. The environments can be accessed through the following links:
https://backend-v2.beets-ftm-node.com/graphql
https://backend-v2-canary.beets-ftm-node.com/graphql
https://backend-optimism-v2.beets-ftm-node.com/graphql
https://backend-optimism-v2-canary.beets-ftm-node.com/graphql
We follow the model of gitflow using the following naming for branches:
- main: v2-main
- development: v2-canary
- feature: feature/*
- release: release/*
- hotfix: hf/*
To contribute, branch from v2-canary
(which is our development branch) and open a PR against v2-canary
once the feature is complete. It will be reviewed and eventually merged into v2-canary.
If you make any changes to the database schema be sure to run yarn prisma migrate dev --name <change_name>
which will create a new file in prisma/migrations
that contains all the database changes you've made as an SQL update script.