Add guidance on how to use LibSQL with Astro DB#8955
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
| - `ASTRO_DB_REMOTE_URL`: the connection URL to your LibSQL server | ||
| - `ASTRO_DB_APP_TOKEN`: the auth token to your LibSQL server | ||
|
|
||
| The environment variables have to be set during `astro build`, `astro db push --remote` and during runtime if your project use Astro DB on SSR pages. |
There was a problem hiding this comment.
Can we explain or give an example of what someone needs to do to make sure these are set at the correct time? It's one thing to say they "have to be set during..", but it's helpful to show what they will need to do to make that happen. If simply setting the variables were enough, then this sentence wouldn't be necessary, right? So what else do they have to make sure they do?
ooops, this ended up as a plain comment, not review comment! I'm doing a review now, and the rest will come in one review batch!
There was a problem hiding this comment.
Setting the environment variables is enough, but they have to do it in all places being used. So, for example, when deploying to Vercel you need the environment variable set locally when you run astro db push --remote to apply the schemas and on Vercel to connect to the DB.
Using Studio, the token only needs to be set on Vercel since the local run of astro db push --remote will use the user token.
There was a problem hiding this comment.
So, would this be added to the command as a flag when run? Or just added in the appropriate places (one and done, like in a .env file or in a dashboard somewhere? I think this is what I'm getting at.
"Set when you run" could mean "pre-set, and available somewhere" or something you need to provide each time.
There was a problem hiding this comment.
I made the examples show the .env file so people put it there. There is multiple ways to do it along with security considerations, but that will depend on how their project and their connection to LibSQL is structured. I don't think there is much point going into details on Astro Docs vs following the docs of the hosting they are using
sarah11918
left a comment
There was a problem hiding this comment.
Thanks @Fryuni , this is looking great! I can spot a few areas where I'd like to see more examples or have more descriptive help than "use", but this is pretty close to where I think it will end up! 🙌
|
|
||
| The environment variables have to be set during `astro build`, `astro db push --remote` and during runtime if your project use Astro DB on SSR pages. | ||
|
|
||
| Details of the LibSQL connection can be configured using the connection URL. |
There was a problem hiding this comment.
| Details of the LibSQL connection can be configured using the connection URL. | |
| Details of the LibSQL connection (e.g. host, encryption key, sync interval) can be configured as query parameters in the remote connection URL. | |
| For example, to ... | |
| ``` | |
| `ASTRO_DB_REMOTE_URL`: | |
| ``` |
My earlier comment holds here too. "using the connection URL" is not as helpful as spelling out specifically "as query parameters".
Can we have one actually, complete full example here showing the broader context to set people up for the following sections all being understood as additional query parameters? Pick the most common situation you can think of. There's been a lot of "you can set" below without seeing what that looks like.
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
sarah11918
left a comment
There was a problem hiding this comment.
This looks great, @Fryuni ! Just a tiny bit of light editing on the top.
See what you think re: my comment about the commands, and at some point, I do wonder whether some of this belongs on the @astrojs/db integration reference page? (like the sync stuff?) and we just link to it from here? But I think this is fine for now, unless you see a way you'd prefer to offload some documentation to the other page.
[skip ci] Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
[skip ci] Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
|
Thanks @Fryuni ! Literally two tiny nits to get just right grammatically, and we're done! This is amazing, thank you! |
yanthomasdev
left a comment
There was a problem hiding this comment.
Amazing work @Fryuni, I have a few suggestions. After applying those, LGTM!
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
sarah11918
left a comment
There was a problem hiding this comment.
We did it! 🥳 This is gonna be so popular, @Fryuni . Can't wait!
Co-authored-by: Lorenzo Lewis <lorenzo_lewis@icloud.com>
|
|
||
| <p><Since pkg="@astrojs/db" v="0.14.0" /></p> | ||
|
|
||
| Astro DB can connect to any LibSQL server from any platform that exposes the Hrana protocol of the server, or can be self-hosted. |
There was a problem hiding this comment.
| Astro DB can connect to any LibSQL server from any platform that exposes the Hrana protocol of the server, or can be self-hosted. | |
| Astro DB can connect to any libSQL server from any platform that exposes the libSQL remote protocol of the server, or can be self-hosted. |
We're moving away from calling it "Hrana", so not using it here would be a huge help 🫶
There was a problem hiding this comment.
As a reader, this also makes it a lot easier to understand what it is in this context.
There was a problem hiding this comment.
The name everywhere I see is LibSQL with capital L, is that changing too?
There was a problem hiding this comment.
I looked again, and there seems to be a mix. I'll normalize our references to be libSQL but as a heads up @notrab , on Turso docs and the repos the links and titles are mostly using "LibSQL" while the content on the pages are using "libSQL".
There was a problem hiding this comment.
Good spot! I’ll make sure our docs are updated to reflect our new messaging, and additional pages on our site/GitHub repos.
|
Thanks for jumping in here @notrab ! I'm glad this was caught in lots of time (a day... but for docs that's an eternity 😂 ) Will be released tomorrow! 🙌 |
|
!coauthor |
|
Description
Related issues & labels (optional)