~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
27 lines · 1.1 KB Raw History
// The reference PDS as the benchmark runs it, in its container
// (bench/docker/reference.Dockerfile): dev-env's TestPds, as perf.mjs runs
// it, listening on PORT, registering DIDs with the PLC directory at PLC_URL,
// its data and blobs under /data, rate limits off and no invite codes; and
// in a storage round, BACKFILL_MS its repoBackfillLimitMs
// (PDS_REPO_BACKFILL_LIMIT_MS), else its default. It stops on SIGTERM, as
// `docker stop` sends.

import { mkdirSync } from 'node:fs'
import { TestPds } from '@atproto/dev-env'

for (const d of ['data', 'blobs']) mkdirSync(`/data/${d}`, { recursive: true })
const pds = await TestPds.create({
  port: Number(process.env.PORT),
  hostname: 'localhost',
  didPlcUrl: process.env.PLC_URL,
  dataDirectory: '/data/data',
  blobstoreDiskLocation: '/data/blobs',
  rateLimitsEnabled: false,
  inviteRequired: false,
  ...(process.env.BACKFILL_MS && { repoBackfillLimitMs: Number(process.env.BACKFILL_MS) }),
})
console.log(`listening at ${pds.url}`)
process.on('SIGTERM', async () => {
  await pds.close()
  process.exit(0)
})