Devnet | Mainnet | |
---|---|---|
Staging | n/a | n/a |
Production |
Devnet | Mainnet | |
---|---|---|
Staging | Merge to main |
n/a |
Production | Via Infra GH Action | Via Infra GH Action |
- 1 setup git hooks
- 2 install go 1.18
- 3 install
docker
anddocker-compose
- 4 setup a
.env
file - 5 install
golangci-lint
- 10 if the api docs are updated, we need to update the api codegen'd files
- API docs are viewable at
http://localhost:8080/swagger.json
.
NOTE: TODO(mocha) do codegen in a dockerized db that is setup and destroyed automatically in the script.
- located in
internal/database/psql/migrations
- all migrations that are a number larger than what the db version is will be run automatically on startup or during codegen
- 12 running the migrations will automatically increment the schema version in the db
NOTE: The 6database must be running prior to running this script.
- Database models are generated using the database schema via go-gorm/gen
- Before generating the models, the 6database needs to be running
- The 10codegen script will also run migrations if new migrations are detected
go run cmd/codegen/main.go
NOTE: The 6database must be running prior to running this script.
- create a migration file under
internal/database/psql/migrations
, and name it appropriately (ex.2_new_migration.up.sql
) - 10 Run the migration + codegen script
NOTE: The 6database must be running prior to running this script.
- 13 Backfilling is done via the backfill script
- View the code to see how it is done
Footnotes
-
Register git hooks
git config --local core.hooksPath .githooks/
↩ -
Install go brew formula Verify with
go version
↩ -
Example
.env
↩# Devnet Staging ENV="STAGING" NETWORK="DEVNET" DRIP_PROGRAM_ID="F1NyoZsUhJzcpGyoEqpDNbUMKVvCnSXcCki1nN3ycAeo" # random wallet, this is the mint auth DRIP_BACKEND_WALLET="[141,241,173,131,255,186,170,216,65,246,24,196,173,94,39,225,161,108,251,102,177,20,166,223,13,69,103,38,242,107,72,194,177,170,44,204,179,183,235,4,231,51,88,169,156,153,132,247,235,166,41,123,87,219,139,204,95,1,176,98,72,90,51,82]" # Only for local testing, this is false on all deployed env's SHOULD_BYPASS_ADMIN_AUTH=true # Test Channel DISCORD_WEBHOOK_ID=1021592812954857492 DISCORD_ACCESS_TOKEN=qPeOyI4e4k6kYah44k9_PXFQDsuLO7lbHcazLrsKcvzqvrQh_lr1PK21kB3GZCSTv2Xg PORT="8080" PSQL_USER="dcaf" PSQL_PASS="drip" PSQL_DBNAME="drip" PSQL_PORT="5432" PSQL_HOST="localhost" PSQL_SSLMODE=disable OUTPUT=./internal/pkg/repository/models GOOGLE_KEY="" GOOGLE_SECRET=""
-
Install golangci-lint for your operating system
https://golangci-lint.run/usage/install
↩ -
Start the database via
docker-compose
docker-compose --file ./build/docker-compose.yaml --env-file ./.env up
↩ ↩2 ↩3 ↩4 ↩5 ↩6 -
Start the api-server and event server
go run main.go
↩ -
Run unit and integration tests
go test ./...
If you need to run just unit testsgo test ./... -short
To force the unit test to not use the embedded DB, set the following in.env
SHOULD_USE_EMBEDDED_DB=false
↩ -
Update mock files
./scripts/create-mocks.sh
↩ -
Run migrations and codegen db models
go run cmd/codegen/main.go
↩ ↩2 ↩3 -
Stop the database via
docker-compose
docker-compose --file ./build/docker-compose.yaml --env-file ./.env down
↩ -
Just run db migrations
go run cmd/migrate/main.go
↩ -
Run the backfill data script
go run cmd/backfill/main.go
↩