Skip to content

Commit

Permalink
feat: made local token registry default.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kammerlo committed May 28, 2024
1 parent a9f7cde commit eac552a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 184 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ WORKDIR /src

FROM ubuntu-nodejs as background
ARG NETWORK=mainnet
ARG METADATA_SERVER_URI="https://tokens.cardano.org"
# using local token registry as default
ARG METADATA_SERVER_URI="localhost:8080"
RUN apt-get update -y && apt-get install lsb-release -y
RUN curl --proto '=https' --tlsv1.2 -sSf -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - &&\
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list &&\
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,13 @@ docker compose -p preview down

</details>

### Use local Token Metadata Registry
### Use global Token Metadata Registry
The public Token metadata registry has a limit of daily requests, this can lead to long sync times, when resyncing from scratch.
To avoid this we introduced the possibility to use a local token metadata registry.
This will be started within docker-compose and will save all data in an additional schema within the local postgres database.
To start it use the following command:
If it's still needed to run with the global environment it's possible by removing the `token-metadata-registry` from `docker-compose.yml`.
And start it with:
```
docker compose -f docker-compose-local-registry.yml up -d
METADATA_SERVER_URI="https://tokens.cardano.org" docker compose up -d
```
To build all containers from source use `--build`. All environment variables and extra commands can be used as described above.

### Upgrade Database to Postgres 14
If you are upgrading from Postgres 11 to 14: A resync will be needed.
Expand Down
172 changes: 0 additions & 172 deletions docker-compose-local-registry.yml

This file was deleted.

15 changes: 10 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,20 @@ services:
max-file: "10"

token-metadata-registry:
image: cardanofoundation/cf-token-metadata-registry-api:${TOKEN_REGISTRY_TAG:-latest}
build:
context: .
target: token-registry
ports:
- ${TOKEN_REGISTRY_PORT:-8080}:8080
environment:
- TOKEN_METADATA_SYNC_JOB=true
- DB_USERNAME=postgres
- DB_PASSWORD=doNoUseThisSecret!
- DB_NAME=cexplorer
- DB_URL=jdbc:postgresql://postgres:${POSTGRES_PORT:-5432}/${DB_NAME:-cexplorer}?currentSchema=token
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- POSTGRES_HOST=postgres
- DB_SCHEMA=tokenregistry
secrets:
- postgres_db
- postgres_password
- postgres_user

secrets:
postgres_db:
Expand Down

0 comments on commit eac552a

Please sign in to comment.