remix-run / blues-stack

The Remix Stack for deploying to Fly with PostgreSQL, authentication, testing, linting, formatting, etc.
https://remix.run/stacks
MIT License
961 stars 236 forks source link

fix: don't add `FLY_REGION` prefix when using recent `flyctl` version #187

Closed benwaffle closed 1 year ago

benwaffle commented 1 year ago

New versions of flyctl, when running fly postgres attach, use flycast URLs to connect to the DB. This provides the same geo-aware load balancing that the stack already achieves today by prefixing the hostname with the region. Flycast doesn't support region prefixes. This has been causing failures for new apps.

For example:

Old: postgres://top2.nearest.of.my-postgres.internal New: postgres://my-postgres.flycast

The old format supports a region prefix, but the new one does not.

Closes #88 Closes #101 Closes #182

benwaffle commented 1 year ago

cc @rubys @dalperin

benwaffle commented 1 year ago

@MichaelDeBoey can you take a look at this PR when you get some time?

dangra commented 1 year ago

What about adding the FLY_REGION prefix only if the host ends with .internal? Or not adding it if it ends with .flycast ?

rubys commented 1 year ago

I'd appreciate it if this were expedited, developers are seeing problems with apps v2 and we are making a push to move people off of apps v1.

markdalgleish commented 1 year ago

@rubys The updated code looked good to me. Merged! :)