Closed ehmatthes closed 4 months ago
__init__()
deploy()
_confirm_automate_all()
(Moved to simple_deploy.py)_validate_platform()
handle_poetry()
Good enough for now. This round of refactoring is focused on "Can someone else make sense of current approach, and build on what's been started?"_prep_automate_all()
_get_heroku_app_info()
_set_heroku_env_var()
_get_heroku_settings()
_check_allowed_hosts()
_add_db_settings()
_add_static_file_settings()
_check_current_heroku_settings()
_add_heroku_setting()
_prep_heroku_setting()
_add_gunicorn()
_configure_db()
_add_db_packages()
_configure_static_files()
_configure_debug()
_configure_secret_key()
_generate_procfile()
_add_static_file_directory()
_conclude_automate_all()
_summarize_deployment()
_show_success_message()
_generate_summary()
confirm_automate_all()
to simple_deploy.py? It doesn't seem to have any platform-specific behavior at this point, and it seems like it could be called right before calling the platform-specific deployer. (Don't do this, the platform does have a specific confirmation message. The method could be moved to simple_deploy, but the message would still have to come from the platform-specific code. That's probably a good thing to do. Maybe specify the plugin has to provide a confirmation message for automate_all.
contributing/architecture_notes.md
.deploy()
method._validate_platform()
_get_heroku_app_info()
.essential-0
now. See Choosing the right heroku postgres plan, Heroku postgres pricing. ~$5/month.self.heroku_app_name
is not set.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.
_add_heroku_setting()
.takewhile()
to keep only non-platform settings.modify_settings()
.add_packages()
?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:
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...
--wait
flag when generating the add-on; (This worked; takes ~2-3 min for db to be ready.)release
command in Procfile.
All open tasks moved to #319.
Once working, there's some refactoring to do.
First tasks
--json
wherever possible when parsing CLI calls. Start withapps:info
._get_deployed_project_name()
as an example.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.