Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
spark -> voyager
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Apr 8, 2024
1 parent e1fdbd1 commit 010170f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-approve-always.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
dependencyStartsWith:
- spark-evaluate
- voyager-evaluate
steps:
- name: Dependabot metadata
id: metadata
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# spark-stats
# voyager-stats

API exposing public statistics about Spark
API exposing public statistics about Voyager

## Development

Expand All @@ -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}`.
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const {
DATABASE_URL = 'postgres://localhost:5432/spark_stats'
DATABASE_URL = 'postgres://localhost:5432/voyager_stats'
} = process.env
57 changes: 21 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion test/handler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 010170f

Please sign in to comment.