The API backend for the Audius mobile apps and audius.co
-
Create
.env
file:readDbUrl='postgresql://postgres:somepassword@someip:5432/audius_discovery'
Regular database dumps are posted to S3, and can be pulled with
curl https://audius-pgdump.s3-us-west-2.amazonaws.com/discProvProduction.dump -O pg_restore -d <your-database-url> \ --username postgres \ --no-privileges \ --clean --if-exists --verbose -j 8 \ discProvProduction.dump
(more env vars and their defaults can be found in
config.go
) -
Run
make setup
(the first time)make setup
-
Run
make
make
http://localhost:1323/v1/users/handle/audius
This will watch sql files + re-run
sqlc generate
+ restart server when go files change.
docker compose up -d
make test
go build -o api main.go
Tool for comparing the new API server endpoints with the legacy Discovery Node APIs
http://localhost:1323/apidiff.html
Tool for interacting with the postgres server
http://localhost:21301/?pgsql=db&username=postgres
docker compose exec db bash
export discoveryDbUrl='a_db_url'
pg_dump $discoveryDbUrl --schema-only --no-comments --no-owner --no-acl > ./sql/01_schema.sql
If you re-dump schema, reset dev postgres state:
docker compose down --volumes
docker compose up -d
ElasticSearch is configured by the env var elasticsearchUrl
.
Tool for interacting with search
http://localhost:1323/searchtest.html
Re-index collections from scratch:
go build -o api main.go
time ./api reindex
You can also specify specific indexes. If you change the mapping you can add drop
:
go build -o api main.go
time ./api reindex drop playlists
If you make mapping changes, or want to re-index everything, you can do:
make esindexer-reindex-stage
#or
esindexer-reindex-prod
A deploy might disrupt this command, in which case, run it again.
See Makefile
for more details.