-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
acmeserver: support additional database types beside bbolt
#6097
base: master
Are you sure you want to change the base?
Conversation
9f20097
to
2452c23
Compare
2452c23
to
f94affb
Compare
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
Hey @mohammed90, this is nice 🙂 We're working on a new version of our nosql package. The goal is to be compatible with the existing implementation (at least data model wise, and hopefully API too), but it might be good to await its release, just in case there are breaking changes. Curious why badger is excluded explicitly? In the CA it's our current default, and likely what most people use today. |
As Francis said, it's been painful. It doesn't appear to be maintained (see dgraph-io/badger#2035) and causes the issues Francis has referenced. See how switching to bbolt resolved numerous issues.
The PR can wait 🙂 This enhancement occurred to me as I was writing the post Zero-Trust Architecture with Caddy. As you're developing the new version, is it possible to decouple the drivers (of PostgreSQL or MySQL) from the implementation to avoid pulling the unused driver into downstream users? One trick I know of is to use URLs for DSN where the scheme is the driver name to use with |
Makes sense
We already support URIs as the DSN, if I'm understanding you correctly. One change in the package will indeed be to have blank imports for the specific drivers, so that it's not needed to specify build tags in the dependent projects, and can rely on just the import in those dependent projects. You would still need the import to happen in the dependent project, or else parsing the DB type from the DSN will result in an unsupported DB type error. |
I meant to exclude the explicit import/dependency on the driver. See how the Anyways, looking at the code, it seems to implement an optimization through |
With my previous comment I meant that the new version will require the use of blank imports to actually import the driver. That seems to attain what you're looking for. For Caddy it would mean that It's possible to only import the database specific logic based on the DSN at runtime using something akin to a Go plugin (although I would suggest WASM instead), using a shim that's always compiled, which calls into the DB plugin loaded at runtime. But at the moment that's not in scope, and sounds like kind of a different project 😅 |
If they were excluded from the build, with Caddy anyway it would be super trivial to add with |
Hadn't thought about that, but yes, I think that would work too. Maybe needs some changes/thought, but I like it that way. If it works, it could be an option to only support |
Sorry I'm just catching up; is this ready to come out of draft state, or are there other complications/nuances that remain? |
Herman recommends waiting until v1 of nosql lib is out the door. The nosql PR for v1 brings back Badger and couples all the storage engines into the module, so I'm not very enthusiastic about its direction, but watching closely. This PR can move forward, but I'm not sure how to ensure the user's databases are safely upgraded once v1 of nosql comes out with changes, if any. @hslatman, any pointers? |
This change allows the database (storage backend) for the ACME server to be PostgreSQL or MySQL as well. This allows scaling of the ACME server across multiple nodes and avoids issue of losing ACME account data when switching nodes.