Fly `fly launch` doesn't work at once for site using Database

Hey Guys,

I’m trying to deploy to Fly.io, however the build is failing because the DATABASE_URL is missing in secrets.

I saw the tool auto inject the SECRET_KEY_BASE while building.

How do I find the DATABASE_URL?

ecto://USER:PASS@HOST/DATABASE

P.S. I’m using latest everything, and didn’t touch the default generated project.

P.P.S. I was able to deploy using Linode.

Fly does automatically create that secret if you attach a db to your project. It would sound like you don’t have a db attached and without a db there’s also no DATABASE_URL to construct.

I selected a DB option while creating the project.

I did the same a few days ago and it set the DATABASE_URL on the project using the db automatically. But you can also construct it manually as postgres://postgres:{password}@derpytools-db.internal:5432/{database}?sslmode=disable as described here: Legacy pre v1.6.3 Phoenix App · Fly Docs

I did it twice, to make sure I am not making a mistake.

image

At that point you’re likely better off asking that in the the fly forum / whatever support channels they have.

1 Like

:sweat_smile:

This forum is the only one I joined after 30 years of existence.

Thank you for replying with possible solutions.

BTW, where do you deploy your site?

Some shared hoster here in germany. Nothing worth noting. I use fly only for POCs due to GDPR concerns around US based companies.

1 Like

Their support is likely best for this. I have seen this problem and when I chose a different region the database container finally spun up as expected. It’s suppose to output the database url with password to keep for your records at the bottom of your screenshot. The problem with constructing the url manually is it isn’t set as a secret and in my instance I didn’t have any of the variables anywhere to capture. The dashboard seemed to report that it was in the starting status, I never saw it start the container for that region even after letting it sit for hours.

It’s anecdotal but this is the 4th example of this I’ve seen personally. Another post had the same issue and changing regions didn’t help.

There may be issues on their network where containers just aren’t spinning up in time or at all. I thought it was a fluke so I didn’t bother reporting it but if it’s still happening it sounds like that gremlin could still be around.

1 Like

I recommend Render for something a little easier to use. Fly is rough around the edges UX wise.

1 Like

I settled on Render after trying out 3 different approaches.

Linode → Fly → Render

What made you switch from Linode?

Fly.io can provide a Data Processing Agreement for GDPR compliance on request. And their data volumes, which can be Europe located, are encrypted at rest by default.

As someone looking to move to fly.io who also needs GDPR compliance, what else are they lacking from your perspective?

I am new to backend development, with no idea about how tough it is deploy manually.

And I don’t like Docker and other complexity that follows it.

I prefer the baremetal deployment and beam would take care of not crashing.

It took me a long time to deploy, and setup GitHub action for deployment to Linode.

Securing the Linode instance took effort, SSL certificate for the domain and subdomains was a breeze thanks to Caddy, but securing Cockroach DB and any other service I think about deploying would have taken even more of my time.

Plus it is geo restricted. Nodebalancer wont route traffic to nearest Server.

So I keeping complexity and Anycast in mind, I jumped to Fly.io.

I liked the idea of fly. I saw Chris Mccord deploy with just one command.

Which failed for me. I guess they are still migrating away from consul, that’s causing a bottleneck or maybe something else.

I was unable to make it work, and didn’t have the energy to reach out to their support.

Plus I don’t need GDPR compliance at the moment. I don’t have any data or plan to create something immediately that will need that.

So I moved to render, which was a breath of fresh air.

Deployment was as easy as using Netlify! Managed Postgres is confidence inspiring.

I did get blocked due to lacking documentation, that didn’t point out where to put Elixir and Erlang version.

But it is faster than manually SSHing into Linode or setting up GitHub action or securing and backing up Cockroach.


I haven’t given up on Linode and Fly.

Will try them soon, once I have projects that need them.

Like running Bumblebee serving, on Linode. Or low latency dashboards in Fly.

Discourse is erroring out for me.

I posted the same reply twice and since I don’t have delete functionality.

I am overwriting my comment.

P.S. Disregard the grammar mistakes on my post above. I’m unable to edit my post.

To my knowledge that doesn‘t help with US based companies. They‘re generally unable to hold the promises they make given the current laws in place as the cloud act is violating GDPR compliance no matter where the server is located. There‘s afaik work happening between the US and EU to replace the no longer active privacy shield, but until then US based companies are essentially a no-go.

2 Likes