Skip to content

Commit

Permalink
Add bin for launching dev-env with an appview (bluesky-social#1454)
Browse files Browse the repository at this point in the history
script for launching a full dev-env network
  • Loading branch information
dholms authored Aug 9, 2023
1 parent 203e72f commit 0bf75fe
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/dev-env/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (process.argv.includes('--update-main-to-dist')) {

require('esbuild').build({
logLevel: 'info',
entryPoints: ['src/index.ts', 'src/bin.ts'],
entryPoints: ['src/index.ts', 'src/bin.ts', 'src/bin-network.ts'],
bundle: true,
sourcemap: true,
outdir: 'dist',
Expand Down
1 change: 1 addition & 0 deletions packages/dev-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"build": "node ./build.js",
"postbuild": "tsc --build tsconfig.build.json",
"start": "node dist/bin.js",
"start:network": "../dev-infra/with-test-redis-and-db.sh node dist/bin-network.js",
"prettier": "prettier --check src/",
"prettier:fix": "prettier --write src/",
"lint": "eslint . --ext .ts,.tsx",
Expand Down
40 changes: 40 additions & 0 deletions packages/dev-env/src/bin-network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { generateMockSetup } from './mock'
import { TestNetwork } from './network'

const run = async () => {
console.log(`
██████╗
██╔═══██╗
██║██╗██║
██║██║██║
╚█║████╔╝
╚╝╚═══╝ protocol
[ created by Bluesky ]`)

const network = await TestNetwork.create({
pds: {
port: 2583,
publicUrl: 'http://localhost:2583',
dbPostgresSchema: 'pds',
},
bsky: {
dbPostgresSchema: 'bsky',
},
plc: { port: 2582 },
})
await generateMockSetup(network)

console.log(
`👤 DID Placeholder server started http://localhost:${network.plc.port}`,
)
console.log(
`🌞 Personal Data server started http://localhost:${network.pds.port}`,
)
console.log(`🌅 Bsky Appview started http://localhost:${network.bsky.port}`)
for (const fg of network.feedGens) {
console.log(`🤖 Feed Generator started http://localhost:${fg.port}`)
}
}

run()

0 comments on commit 0bf75fe

Please sign in to comment.