Skip to content

NEAR-DevHub/neardevhub-api-rs

Repository files navigation

Devhub Cache API

This repository leverages PostgreSQL as a caching layer to reduce DevHub's RPC calls to a rate of 1 per second. The API is built using Rust's Rocket framework and deployed on Fly.io.

Develop

cargo run

or

cargo watch -q -c -w src/ -x 'run '

SQLx Postgres


More information

Create and run migrations

Github codespace: If the database server is not running, you can start it by typing sudo service postgresql start.

sqlx migrate add <name>

Creates a new file in migrations/<timestamp>-<name>.sql. Add your database schema changes to this new file.


sqlx migrate run

Compares the migration history of the running database against the migrations/ folder and runs any scripts that are still pending.

Deploy

Until the ci/cd.yml is fixed the only way to deploy is with the fly cli.

Install for linux:

curl -L https://fly.io/install.sh | sh

Install for Mac:

brew install flyctl

Then

fly deploy -c fly.*.toml

How to deploy when Starting from a blockheight. For instance templar we added proposals removed everything and rebuild it Templar contract was deleted after https://nearblocks.io/txns/FzKXtDhvR3oFWxqDvfXNVp8HUgmcrNkYtmccEjbaFCMj this txn. So we only want to indexer after this.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •