ehmatthes / django-simple-deploy

A reusable Django app that configures your project for deployment
BSD 3-Clause "New" or "Revised" License
304 stars 26 forks source link

Add requests to installed requirements. #289

Closed felixxm closed 5 months ago

felixxm commented 5 months ago

Required since 7d1d405385d266861eb284eed2f72b4da87d35e4.

$ python manage.py simple_deploy --platform fly_io
...
  File ".venv/lib/python3.10/site-packages/simple_deploy/management/commands/fly_io/deploy.py", line 15, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
ehmatthes commented 5 months ago

Thanks Mariusz! Are you planning to do anything more with this project at the moment? I will be coming back to this shortly, and can share a clearer idea of where I'm heading with it if you are interested.

felixxm commented 5 months ago

Are you planning to do anything more with this project at the moment?

I wanted to check how it works from a Fly.io perspective and if there was anything we could incorporate into flyctl to make deployment smoother for Fly.io users.

felixxm commented 5 months ago

I will be coming back to this shortly, and can share a clearer idea of where I'm heading with it if you are interested.

Sure I am.

ehmatthes commented 5 months ago

I wanted to check how it works from a Fly.io perspective and if there was anything we could incorporate into flyctl to make deployment smoother for Fly.io users.

I'm looking through the fly_io/deploy.py file, which is the main file that handles fly-specific configuration.

One issue I faced was finding that some fly commands accept the --json flag, and others do not. It's much more reliable to parse JSON output, so it's really nice to find commands that support that flag. The commands I needed to use that don't support --json are:

If you can implement --json support for every command that generates output, then all output could be handled consistently and reliably in automation code.

The second issue deals with connecting apps and databases. In the standard workflow:

I check for an existing database that matches the app name before creating a new database, for a variety of reasons. Is there a way to check if an existing database is already connected to an app? I'd love to run a command that would tell me the name of a database that's attached to an app. That would be more reliable than just looking for an existing database that matches my naming convention.

felixxm commented 5 months ago

fly secrets list supports the --json flag, check out docs.

felixxm commented 5 months ago

Support for json in fly postgres users list, should be fixed soonish, https://github.com/superfly/flyctl/pull/3322.

felixxm commented 5 months ago

Is there a way to check if an existing database is already connected to an app?

You can check if DATABASE_URL is in fly secrets list, that will give you a 0-1 answer.

As far as I'm aware, it's not possible (easy) to find a database name. For PostgreSQL you could try to check

flyctl postgres users list -a test123
ehmatthes commented 5 months ago

Thanks, this is really helpful! Cleanup work noted in #290.

felixxm commented 4 months ago

About fly apps open, unfortunately, it works only not a "happy path" so it always opens http://{APP_NAME}.fly.dev/, you can do the same by getting an app name from fly config show and building this URL on your own.

ehmatthes commented 4 months ago

Thanks again, I will give that a try.