-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finalize PDS in-process AppView removal #1198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left minor devex-related comments. I would lean towards just merging this huge effort and then address any of those in a follow-on, instead of trying to resolve them first.
In that category: make run-dev-pds
doesn't work on this branch; I think (and make run-dev-bsky
) should not maybe point to services/pds/
and services/bsky/
?
packages/pds/.env.example
Outdated
@@ -0,0 +1,24 @@ | |||
# See more env options in src/config/env.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we merge this file with the existing packages/pds/example.dev.env
? which gets auto-copied for use with make run-dev-pds
. I'd otherwise be worried this .env.example
will be hard to find (default hidden dotfile) and get stale.
If we did that, would need to ensure that the config actually works for local dev, instead of sandbox. I think just commenting out partial strings would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup yup that makes sense 👍
i actually forgot we already had an .env.example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright I actually removed the make run-dev-pds
& make run-dev-bsky
commands as well as their env files
Right now, the best way to run these services in dev is in the dev-env the packages themselves aren't set up very well with service entry files. So I also moved over the dotenv
code to dev-env so that it's env can be adjusted
I don't think we were using those Make commands at all during development, but lmk if this affects your ability to develop.
In the future, it might be worth taking another pass at refactoring running each of theses services in dev mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do use those make commands fairly often, for the PDS and appview, distinct from dev-env
. my workflow is basically to run make run-dev-*
in a bunch of different terminals and a bunch of repos, while editing 1-2 code bases.
but I can try to get all that working in a follow-up PR, don't need to block this one on that side feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty solid, pretty much just left a few misc questions and notes 💎
handler: async ({ params, auth }) => { | ||
const requester = auth.credentials.did | ||
const res = | ||
await ctx.appViewAgent.api.app.bsky.actor.searchActorsTypeahead( | ||
params, | ||
await ctx.serviceAuthHeaders(requester), | ||
) | ||
return { | ||
encoding: 'application/json', | ||
body: res.data, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that there's no logic in many of these routes, it's really tempting to create a lighter-weight passthrough proxy handler. Can just avoid a fair amount of parsing, validation, memory usage, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree 🤔
Could see about trying to wire something simple up - would be nice
packages/pds/src/config/config.ts
Outdated
|
||
const bskyAppViewCfg: ServerConfig['bskyAppView'] = { | ||
url: env.bskyAppViewUrl ?? 'https://api.bsky-sandbox.dev', | ||
did: env.bskyAppViewDid ?? 'did:plc:abc', // get real did |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user sets bskyAppViewUrl
but not bskyAppViewDid
this could get out of whack, but this should be correct in the more likely case that neither are set:
did: env.bskyAppViewDid ?? 'did:plc:abc', // get real did | |
did: env.bskyAppViewDid ?? 'did:web:api.bsky-sandbox.dev', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually may just get rid of the defaults & throw if not included 🤔
This was added really just for ease of running in sandbox
await db.schema | ||
.createTable('app_migration') | ||
.addColumn('id', 'varchar', (col) => col.primaryKey()) | ||
.addColumn('success', 'int2', (col) => col.notNull().defaultTo(0)) | ||
.addColumn('completedAt', 'varchar', (col) => col) | ||
.execute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can get rid of this table and the app migration system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe? it might be helpful with some automatic migrations for the pds distribution in the future tho 🤔
I think the runtime flag table is asking for it more tbh
.addColumn('did', 'varchar', (col) => col.primaryKey()) | ||
.addColumn('root', 'varchar', (col) => col.notNull()) | ||
.addColumn('indexedAt', 'varchar', (col) => col.notNull()) | ||
.addColumn('takedownId', 'varchar') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may need to run a manual migration for the live service to change these cols to varchars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good snag 🤔
Would we rather these be varchars or integers? Does it matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't quite remember why we changed it to a varchar back in the day
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was so that you can store any identifier there, i.e. if the takedown came from some external system that didn't use integers to identify their actions. Pretty sure it was foreseeing removing some of the moderation machinery from the PDS, making that field less coupled to the current implementation.
Overall it doesn't matter a ton either way, though 👍
? Database.postgres({ | ||
url: cfg.dbPostgresUrl, | ||
schema: cfg.dbPostgresSchema, | ||
txLockNonce: cfg.dbTxLockNonce, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of anything that allows us to drop this—is it possible we need to bring it back? Or maybe I missed the change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It got moved to AppContext
👍
* refactor pds tests to use dev env * refactor bsky tests * fix pds test * tidy bsky tests
* switch takedown ids back to ints, consistent with live pds * tidy/fix migration * update migration for sqlite
The simplify-pds branch was deleted on 2023-10-02 after it was merged into main. Refs: <bluesky-social/atproto#1198>
* rm tables * rm event-stream & proxied * Remove appview services, move label service to pds * only proxy appview stuff * delete more tables * Start removing message dispatched from pds * more syncing-up removal of message dispatcher in pds * merged * remove feedgens from pds, remove getPopular * remove unused image helper from pds * fixing compiler errors * clean up sharp * rm label service * first pass on cleaning up tests * fix up a bunch of tests * moderation view tests * last admin tests * got a lil overzealous in deletes * clean up unused cfg * clean up label table * simplify admin repo search query/logic * tidy pds entrypoint * in-progress pds config changes * cfg fiddling * finish cleaning up cfg/ctx * comments * building * pds prefix on env * test env * collapse pds migrations down into a single migration * fix up dev-env * tidy * cleanup * fix pds admin tests * fix handle test * fix pds proxy tests * fix subscribe repos test * fix sqlite config in pds tests * add sqlite clause in sequencer-leader * fix actor search w/ sqlite on pds * fixes * fix dev env build * update pds service entrypoint * simple env example * make takedown ids opaque identifiers in the pds * use pds routes for api tests * update pds dockerfile with volume and correct port env var * add a couple env vars to example * add comments to env example * @atproto/pds 0.2.0-beta.0 * @atproto/aws 0.0.1-beta.0 * appview did * @atproto/aws 0.0.1 * enable logs by default * update env example * bugfixing sandbox issues * consistency in pds env var name for appview url * log on pds start and stop, configure version at runtime * @atproto/pds 0.2.0-beta.1 * fix semver matching for pds beta version * v0.2.0-beta.2 * default invites to being not required * fix flaky test * limit db connections in tests * publish 0.2.0-beta.d3 * fix invite required parsing * @atproto/pds 0.2.0-beta.5 * Proxy getPopularFeedGenerators on simplified pds (bluesky-social#1222) proxy getPopularFeedGenerators on pds Co-authored-by: dholms <[email protected]> * tidy migrations * fix service entry * bump version * change auth order * bump version * bump version * add upgradeRepoVersion & fallback url for cdn * bump version * merging * merge pds * building dev-env * merging tests * merge service entry * test fixing * tidy * fix admin search * tidy * tidy * add snap for getListFeed * add backup nameserver cfg * tidy + pr feedback * tidy * tidy env * bit more * re-add dotenv to root package.json * fix dep * build branch * fix tests * Refactor tests to make better use of dev-env (bluesky-social#1690) * refactor pds tests to use dev env * refactor bsky tests * fix pds test * tidy bsky tests * build pds correctly * fix entry point * default logging to false (for now) * format service entry * Switch takedown ids back to ints on pds distribution (bluesky-social#1694) * switch takedown ids back to ints, consistent with live pds * tidy/fix migration * update migration for sqlite * export moderation action reversal * takedown tests * dont build branch --------- Co-authored-by: Devin Ivy <[email protected]>
Finalizing the work of removing the AppView from the PDS & syncing this branch (which is being used for the current PDS distribution in sandbox) up with
main