ehmatthes / django-simple-deploy

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

Refactor Heroku deploy.py #275

Closed ehmatthes closed 4 months ago

ehmatthes commented 10 months ago

Once working, there's some refactoring to do.

First tasks

Second tasks

This is the last platform to be refactored. Go back through all three platforms, looking for utilities that can be pulled out into sd_utils. Any utility functions that can be put there can be much more reliably implemented and tested than leaving it to each platform to handle. This also creates much more consistent workflows across the different platforms that will be supported.

ehmatthes commented 4 months ago

Methods

ehmatthes commented 4 months ago

More tasks

ehmatthes commented 4 months ago

_validate_platform()

ehmatthes commented 4 months ago

Ongoing tasks

ehmatthes commented 4 months ago

Simplify approach to settings

This is a much simpler approach to idempotency, and multiple runs. People will do multiple runs if something fails and they have to modify their project. Avoid that if at all possible, but keep our workflow as simple as possible.

ehmatthes commented 4 months ago

Simplify approach to requirements

ehmatthes commented 4 months ago

Simplify overall approach

Originally, I got caught up in replicating the configuration workflow that people do when following a platform's docs. There's no need to do that, and it's much more verbose than it needs to be.

The process really boils down to, and should look as simple as:

ehmatthes commented 4 months ago

Misc

ehmatthes commented 4 months ago

Run e2e test

After first full pass refactoring heroku deploy.py, before porting some changes to other platforms.

Failed:

Migrating deployed project...
Running python manage.py migrate on ⬢ stark-coast-54964... up, run.2010 (Basic)
Traceback (most recent call last):
  File "/app/manage.py", line 22, in <module>
    main()
  File "/app/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
 ...
  File "/app/.heroku/python/lib/python3.12/site-packages/django/db/backends/base/base.py", line 262, in connect
    conn_params = self.get_connection_params()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.12/site-packages/django/db/backends/postgresql/base.py", line 174, in get_connection_params
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the NAME or OPTIONS['service'] value.
  Opening project...
ehmatthes commented 4 months ago

Make a new release

ehmatthes commented 4 months ago

All open tasks moved to #319.