nextstrain / auspice.us

http://auspice.us
13 stars 8 forks source link

Use app.json, upgrade to `heroku-22` #33

Closed victorlin closed 2 years ago

victorlin commented 2 years ago

Description of proposed changes

Create an app.json and use it to upgrade the Heroku stack to heroku-22.

Related issue(s)

N/A

Testing

victorlin commented 2 years ago

Had to close and reopen the PR for build to use heroku-22 due to this:

An existing app’s stack cannot be changed using app.json. The stack specified is only applied to newly created apps that are a Review App, a Heroku CI test run app, or an app created using a Heroku Buttons.

victorlin commented 2 years ago

Is your understanding the same as mine that app.json is only used at app creation (e.g. new review apps, someone using the "Heroku Button", etc.) and changes to this file won't change our deployed/active auspice.us production app?

Oh, I hadn't thought of that but yes I'd expect the same. Meaning we'd have to coordinate some kind of re-deployment of the production app. I assume the approach would be:

  1. Merge this PR.
  2. Create a new staging app (which should use app.json).
  3. Make sure any config in the production app is added to the staging app (e.g. auto-deploys).
  4. Swap staging and production.
  5. Delete the old app that would then be in staging.
victorlin commented 2 years ago

Re-deploying PR review app with latest app.json:

  1. Deleting existing review app on Heroku Dashboard
  2. Closing and re-opening this PR to trigger review app creation
tsibley commented 2 years ago

Meaning we'd have to coordinate some kind of re-deployment of the production app. I assume the approach would be:

That dance would be required for every future change to app.json though, and so I suspect the approach would actually be more like:

:upside_down_face:

Nevertheless, I think reasonable to have the defaults/expectation documented here by app.json.

victorlin commented 2 years ago

Yeah that's probably easier. I wonder if auto-deploys can be set up so that it starts from a fresh "instance" every time.

This also has me wondering how much of app.json is ignored during new builds on existing apps. I only see the documentation that states stack will not be applied (https://github.com/nextstrain/auspice.us/pull/33#issuecomment-1182659051), but hopefully env var changes will be applied among other things.

tsibley commented 2 years ago

I wonder if auto-deploys can be set up so that it starts from a fresh "instance" every time.

I doubt it. This would be at odds with the model of Heroku, where the app is the container for persistent state (config, etc).

This also has me wondering how much of app.json is ignored during new builds on existing apps. I only see the documentation that states stack will not be applied (#33 (comment)), but hopefully env var changes will be applied among other things.

I doubt env var changes or any changes are applied to existing apps. As I understand it, app.json is only used for setting up new apps and never used for updating existing apps. See https://blog.heroku.com/introducing_the_app_json_application_manifest and https://devcenter.heroku.com/articles/setting-up-apps-using-the-heroku-platform-api, which talk only of new apps. That is, app.json is for bootstrapping an app on Heroku, not maintaining it. (This is why we haven't used app.json in the past; one-click bootstrapping isn't super useful for us.)

victorlin commented 2 years ago

Learned a lot about Heroku here! I created #34 to document some learnings and note the limitations of app.json.