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

Update Heroku deployment process #248

Closed ehmatthes closed 10 months ago

ehmatthes commented 1 year ago

Heroku only auto-provisions a Postgres db for users whose accounts were created before 5/15/23. This means deployments will fail for anyone with a new Heroku account:

heroku_db_annc_bordered

Task list

ehmatthes commented 10 months ago

Notes 12/23

This should be simpler to fix after working through Fly deployments, #263. We'll call heroku create, and look for a db. If it doesn't exist, we'll create one.

% heroku create
Creating app... done, ⬢ desolate-shore-27436
https://desolate-shore-27436-3a63a9188e3c.herokuapp.com/ | https://git.heroku.com/desolate-shore-27436.git
(.venv) eric@Erics-Mac-Studio dsd-dev-project_pg1o3 % heroku addons
No add-ons for app desolate-shore-27436.

This looks like I'm not getting a db auto-provisioned.

remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote: 
remote: -----> Compressing...
remote:        Done: 33.6M
remote: -----> Launching...
remote:  !     The following add-ons were automatically provisioned: heroku-postgresql. These add-ons may incur additional cost, which is prorated to the second. Run `heroku addons` for more info.

Postgres database was auto-provisioned:

% heroku addons

Add-on                                      Plan  Price         Max Price  State  
──────────────────────────────────────────  ────  ────────────  ─────────  ───────
heroku-postgresql (postgresql-curly-63375)  mini  ~$0.007/hour  $5/month   created
 └─ as DATABASE

The table above shows add-ons and the attachments to the current app (pacific-sands-48013) or other apps.
ehmatthes commented 10 months ago

Notes 12/23 (cont)

remote: -----> Compressing...
remote:        Done: 33.6M
remote: -----> Launching...
remote:  !     The following add-ons were automatically provisioned: . These add-ons may incur additional cost, which is prorated to the second. Run `heroku addons` for more info.
remote:        Released v8

Does not auto-provision a db if it finds an existing one. This is confirmed by running heroku addons again after the push, and finding just the one db that I manually created.

ehmatthes commented 10 months ago

Implementation

 % heroku create
Creating app... done, ⬢ polar-ocean-42915
https://polar-ocean-42915-4c1ec37e8ebe.herokuapp.com/ | https://git.heroku.com/polar-ocean-42915.git
(.venv) eric@Erics-Mac-Studio dsd-dev-project_pg1o3 % heroku addons
No add-ons for app polar-ocean-42915.
(.venv) eric@Erics-Mac-Studio dsd-dev-project_pg1o3 % heroku addons:create heroku-postgresql:mini
Creating heroku-postgresql:mini on ⬢ polar-ocean-42915... ~$0.007/hour (max $5/month)
Database has been created and is available
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pg:copy

Created postgresql-lively-93073 as DATABASE_URL
Use heroku addons:docs heroku-postgresql to view documentation
(.venv) eric@Erics-Mac-Studio dsd-dev-project_pg1o3 % heroku addons:create heroku-postgresql:mini
Creating heroku-postgresql:mini on ⬢ polar-ocean-42915... ~$0.007/hour (max $5/month)
Database has been created and is available
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pg:copy

Created postgresql-clear-50368 as HEROKU_POSTGRESQL_BLACK_URL
Use heroku addons:docs heroku-postgresql to view documentation
(.venv) eric@Erics-Mac-Studio dsd-dev-project_pg1o3 % heroku addons

Add-on                                       Plan  Price         Max Price  State  
───────────────────────────────────────────  ────  ────────────  ─────────  ───────
heroku-postgresql (postgresql-clear-50368)   mini  ~$0.007/hour  $5/month   created
 └─ as HEROKU_POSTGRESQL_BLACK

heroku-postgresql (postgresql-lively-93073)  mini  ~$0.007/hour  $5/month   created
 └─ as DATABASE

The table above shows add-ons and the attachments to the current app (polar-ocean-42915) or other apps.
ehmatthes commented 10 months ago

Implementation (cont.)

ehmatthes commented 10 months ago

Running on Ubuntu

I haven't tested any of these on Linux in a while. Let's start here.

Notes