ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
5.76k stars 260 forks source link

Support libsql+ws:// scheme for local environment libSQL databases #1951

Closed george-lim closed 11 months ago

george-lim commented 1 year ago

Atlas currently supports libsql+wss:// scheme for managing Turso databases, but there isn't a way to manage a self-hosted libSQL database (running in a Docker container for example) for local environments, unless it is secured by SSL.

It would help a lot for local migration testing if the non-secured scheme were supported as well.

a8m commented 1 year ago

Does libsql support connecting to ws? Also, can you elaborate on why not use plain SQLite for local development? e.g., sqlite://file.db/sqlite://file?mode=memory?

george-lim commented 1 year ago

Does libsql support connecting to ws?

Absolutely! Turso uses sqld under the hood to manage the libSQL database in server mode. sqld supports http or ws schemes.

Also, can you elaborate on why not use plain SQLite for local development?

For my product, I am self-hosting sqld for all environments instead of using Turso. I want to use sqld instead of SQLite for local development for two reasons:

  1. I want to ensure that all environments run as close to the same as possible for both simplicity and also consistency
  2. There are features in libSQL that are not present in SQLite

In my specific case, the problem I'm running into is that all of my containers sit behind nginx, which is responsible for SSL termination. I want to have all of my internal services communicate without SSL, which includes Atlas (for local development).

For staging and production environments I will be using the Atlas deploy action which will point to a wss:// URL, so that won't be a problem

george-lim commented 1 year ago

Hey @a8m sorry to bump, but any thoughts on this? I can make a PR if you'd like. This blocks a project that I am currently working on

george-lim commented 1 year ago

@a8m Is there something I can do to help this change get through? My company would really like to get this in because Atlas is the only migration tool that supports libSQL (Turso) out of the box at the moment

zestsystem commented 12 months ago

@a8m @george-lim Facing the same issue not being able to utilize local development of Turso. Can the changes be merged? Being able to develop with a local file without having to connect to a real hosted instance is a big part of what makes Turso great.

leovanhaaren commented 11 months ago

Agree with the above, would be great to see this merged!

george-lim commented 11 months ago

This is now merged!