Open chuck-dbos opened 3 weeks ago
How does the server and HTTP decorators fit into this new system? Is a server automatically launched by DBOS, or only if the HTTP decorators are present? Can you completely ignore the existence of the HTTP component when building with Express/Nest/Next?
DBOS.launch() will start an HTTP admin server. For the application HTTP component, you can ignore it completely. I don't think this change with what @chuck-dbos mentioned about HTTP decorators today.
How do entrypoints play into this?
It depends on the application. If you use a TS transpiler that places the DBOS code in an "easy place" (i.e., not bundled with other chunks of code "somewhere", like next would do, you can still use the entrypoints. You can also simply import the DBOS classes before DBOS.launch()
is called.
What does DBOS do on launch now?
On the transact side, this depends on your app. DBOS.launch() must be in a piece of code that's executed when your program starts (e.g., node dist/main.js
). On the cloud side, we'll need to add support for a start command in dbos-config.yaml
(Otherwise we have to resort to hacks like cp something node_modules/.bin/dbos-sdk
)
- How does the server and HTTP decorators fit into this new system?
You can call new functions from old, so you could use the old decorators. I also added new ones like DBOS.getApi, and you can get the Koa context from DBOS.koaContext.
Is a server automatically launched by DBOS, or only if the HTTP decorators are present
I changed this today, the koa server is not supposed to be launched by DBOS if you don't use the decorators.
Can you completely ignore the existence of the HTTP component when building with Express/Nest/Next?
It's supposed to (as of today). However there's still the admin server. Which I suppose you can ignore? With more experience, I think we'll learn more about this.
- How do entrypoints play into this? What does DBOS do on launch now?
That's potentially an issue, I think Max is looking at it. If you use the HTTP decorators, no issue with entrypoints. It would also load the entrypoint file and run any code that's in there. But if you opened a port, it wouldn't get passed through from load balancer.
Do we still need entrypoints? Or do we need a startup command like in Python? Or both?
Both are useful
Do we still need entrypoints? Or do we need a startup command like in Python? Or both?
Both are useful
100%. The entrypoints way has huge advantages for people building new apps that want the features we started with... and there are some. There's a lot less code for something that does just scheduled workflows, say. But we will need the startup command for some of the new usecases.
Main Change - New API In addition to supporting all prior API constructs, DBOS Transact Typescript has a new API that does not require passing contexts around between functions. (This was inspired by the relative simplicity of the Python API.) Instead, functionality is accessed by
DBOS.<thing>
, such as@DBOS.workflow
orDBOS.knexClient
orDBOS.authenticatedUser
. You can mix old and new code.Second Big Change - Library Usage DBOS can now be used as a library, or within Express.js or other frameworks, rather than just as serverless Koa-based entrypoints. Examples and guidance are evolving.
Other Items Recovery has been moved to after init.