From 010170fd2e5ecb2b83dd7e39066ee79a6eb40897 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 8 Apr 2024 19:46:08 +0200 Subject: [PATCH] spark -> voyager --- .../dependabot-auto-approve-always.yml | 2 +- README.md | 22 +++---- fly.toml | 6 +- lib/config.js | 2 +- package-lock.json | 57 +++++++------------ package.json | 6 +- test/handler.test.js | 2 +- 7 files changed, 40 insertions(+), 57 deletions(-) diff --git a/.github/workflows/dependabot-auto-approve-always.yml b/.github/workflows/dependabot-auto-approve-always.yml index 0a2dc2f..547a118 100644 --- a/.github/workflows/dependabot-auto-approve-always.yml +++ b/.github/workflows/dependabot-auto-approve-always.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: dependencyStartsWith: - - spark-evaluate + - voyager-evaluate steps: - name: Dependabot metadata id: metadata diff --git a/README.md b/README.md index 3674d8f..73452aa 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# spark-stats +# voyager-stats -API exposing public statistics about Spark +API exposing public statistics about Voyager ## Development @@ -10,7 +10,7 @@ Set up [PostgreSQL](https://www.postgresql.org/) with default settings: - Port: 5432 - User: _your system user name_ - Password: _blank_ - - Database: spark_public + - Database: voyager_public Alternatively, set the environment variable `$DATABASE_URL` with `postgres://${USER}:${PASS}@${HOST}:${POST}/${DATABASE}`. @@ -21,15 +21,15 @@ needs full management permissions for the database. You can also run the following command to set up the PostgreSQL server via Docker: ```bash -docker run -d --name spark-db \ +docker run -d --name voyager-db \ -e POSTGRES_HOST_AUTH_METHOD=trust \ -e POSTGRES_USER=$USER \ - -e POSTGRES_DB=spark_public \ + -e POSTGRES_DB=voyager_public \ -p 5432:5432 \ postgres ``` -Finally, run database schema migration scripts from spark-evaluate. +Finally, run database schema migration scripts from voyager-evaluate. ```bash npm run migrate @@ -47,22 +47,22 @@ npm test npm start ``` -You can also run the service against live data in Spark DB running on Fly.io. +You can also run the service against live data in Voyager DB running on Fly.io. -1. Set up a proxy to forward connections to Spark DB Postgres. Connect to the reader replica running +1. Set up a proxy to forward connections to Voyager 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. + The command below will forward connections to local post 5455 to Voyager DB's reader replica. ``` - fly proxy 5455:5433 -a spark-db + fly proxy 5455:5433 -a voyager-db ``` 2. 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 + DATABASE_URL="postgres://user:password@localhost:5455/voyager_public" npm start ``` ## Deployment diff --git a/fly.toml b/fly.toml index b842b1e..e3f115d 100644 --- a/fly.toml +++ b/fly.toml @@ -1,6 +1,4 @@ -# fly.toml file generated for spark on 2023-05-16T19:09:01+02:00 - -app = "spark-stats" +app = "voyager-stats" primary_region = "cdg" kill_signal = "SIGINT" kill_timeout = 5 @@ -21,7 +19,7 @@ processes = [] protocol = "tcp" script_checks = [] [services.concurrency] - # Remember to update PG Pool config option `max` in bin/spark-stats.js when changing `hard_limit`. + # Remember to update PG Pool config option `max` in bin/voyager-stats.js when changing `hard_limit`. hard_limit = 800 soft_limit = 600 type = "connections" diff --git a/lib/config.js b/lib/config.js index a04da5a..d5214a2 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,3 +1,3 @@ export const { - DATABASE_URL = 'postgres://localhost:5432/spark_stats' + DATABASE_URL = 'postgres://localhost:5432/voyager_stats' } = process.env diff --git a/package-lock.json b/package-lock.json index 687a8e1..e00c04f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "spark-stats", + "name": "voyager-stats", "lockfileVersion": 3, "requires": true, "packages": { @@ -13,8 +13,8 @@ }, "devDependencies": { "mocha": "^10.4.0", - "spark-evaluate": "filecoin-station/spark-evaluate#main", - "standard": "^17.1.0" + "standard": "^17.1.0", + "voyager-evaluate": "filecoin-station/voyager-evaluate#main" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -4013,18 +4013,6 @@ "node": ">=4" } }, - "node_modules/postgrator": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/postgrator/-/postgrator-7.2.0.tgz", - "integrity": "sha512-rVi/X5//51Sj5SWsBb2knBn/GCWdFOXRdq4VATnNePLK1h2774j0byr5tsDDb5B+UWVAZftjq5VYCQaB6dXMWw==", - "dev": true, - "dependencies": { - "glob": "^7.2.3" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/postgres-array": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", @@ -4506,27 +4494,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/spark-evaluate": { - "resolved": "git+ssh://git@github.com/filecoin-station/spark-evaluate.git#971848a2b63cabe244eed936adf3d79dd9e7aafe", - "integrity": "sha512-F4vt4+SpYxASfrAhIx6PHY0+tnzZcd1eLytXq8+1+7doIwR23HXsp0ctSFc4YSI9NflJ0WT1b665IVwAH7Mqfg==", - "dev": true, - "dependencies": { - "@glif/filecoin-address": "^3.0.4", - "@influxdata/influxdb-client": "^1.33.2", - "@ipld/car": "^5.3.0", - "@sentry/node": "^7.109.0", - "@web3-storage/car-block-validator": "^1.2.0", - "debug": "^4.3.4", - "ethers": "^6.10.0", - "ipfs-car": "^1.2.0", - "ipfs-unixfs-exporter": "^13.5.0", - "just-percentile": "^4.2.0", - "on-contract-event": "^1.0.2", - "p-retry": "^6.2.0", - "pg": "^8.11.5", - "postgrator": "^7.2.0" - } - }, "node_modules/sparse-array": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/sparse-array/-/sparse-array-1.3.2.tgz", @@ -4993,6 +4960,24 @@ "node": ">=0.10.48" } }, + "node_modules/voyager-evaluate": { + "resolved": "git+ssh://git@github.com/filecoin-station/voyager-evaluate.git#53179b351b0506a28a53a22690423b2f6923cb03", + "dev": true, + "dependencies": { + "@glif/filecoin-address": "^3.0.4", + "@influxdata/influxdb-client": "^1.33.2", + "@ipld/car": "^5.3.0", + "@sentry/node": "^7.109.0", + "@web3-storage/car-block-validator": "^1.2.0", + "debug": "^4.3.4", + "ethers": "^6.11.1", + "ipfs-car": "^1.2.0", + "ipfs-unixfs-exporter": "^13.5.0", + "just-percentile": "^4.2.0", + "on-contract-event": "^1.0.2", + "p-retry": "^6.2.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 54a1611..b96348d 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,13 @@ "type": "module", "private": true, "scripts": { - "migrate": "node node_modules/spark-evaluate/bin/migrate.js", - "start": "node bin/spark-stats.js", + "migrate": "node node_modules/voyager-evaluate/bin/migrate.js", + "start": "node bin/voyager-stats.js", "test": "standard && mocha" }, "devDependencies": { "mocha": "^10.4.0", - "spark-evaluate": "filecoin-station/spark-evaluate#main", + "voyager-evaluate": "filecoin-station/voyager-evaluate#main", "standard": "^17.1.0" }, "dependencies": { diff --git a/test/handler.test.js b/test/handler.test.js index dc29863..71b6f3c 100644 --- a/test/handler.test.js +++ b/test/handler.test.js @@ -3,7 +3,7 @@ import { once } from 'node:events' import assert, { AssertionError } from 'node:assert' import pg from 'pg' import createDebug from 'debug' -import { mapParticipantsToIds } from 'spark-evaluate/lib/public-stats.js' +import { mapParticipantsToIds } from 'voyager-evaluate/lib/public-stats.js' import { createHandler, today } from '../lib/handler.js' import { DATABASE_URL } from '../lib/config.js'