Skip to content

filecoin-station/spark-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spark-stats

API exposing public statistics about Spark

Public API

Base URL: http://stats.filspark.com/

Development

Database

Set up PostgreSQL with default settings:

  • Port: 5432
  • User: your system user name
  • Password: blank
  • Database: spark_public

Alternatively, set the environment variable $DATABASE_URL with postgres://${USER}:${PASS}@${HOST}:${POST}/${DATABASE}.

The Postgres user and database need to exist already, and the user needs full management permissions for the database.

You can also run the following command to set up the PostgreSQL server via Docker:

docker run -d --name spark-db \
  -e POSTGRES_HOST_AUTH_METHOD=trust \
  -e POSTGRES_USER=$USER \
  -e POSTGRES_DB=spark_public \
  -p 5432:5432 \
  postgres

Finally, run database schema migration scripts from spark-evaluate.

npm run migrate

Run the test suite

npm test

Run the service

npm start

You can also run the service against live data in Spark DB running on Fly.io.

  1. Set up a proxy to forward connections to Spark DB Postgres. Connect to the reader replica running on port 5433 (not 5432).

The command below will forward connections to local post 5455 to Spark DB's reader replica.

fly proxy 5455:5433 -a spark-db
  1. Start the service and configure the database connection string to use the proxied connection. Look up the user and the password in our shared 1Password vault.
DATABASE_URL="postgres://user:password@localhost:5455/spark_public" npm start

Deployment

git push

About

API exposing public statistics about Spark

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •