SFDigitalServices / formio-sfds

The form.io theme for sf.gov
https://formio-sfds.herokuapp.com/
MIT License
15 stars 2 forks source link

Set up Heroku #182

Closed shawnbot closed 3 years ago

shawnbot commented 3 years ago

This moves us over to a new Heroku pipeline. The only big change is the introduction of Express to serve both the static examples and docs, and the previously serverless API endpoints. Heroku appears to restart the dyno whenever the server falls down (which happens when there are uncaught errors or rejected promises in the API code), but we should probably add some fault tolerance there and serve errors back more intentionally so that we don't see Heroku's grey screen of death.

This PR is safe to merge directly to main because it doesn't really touch any front end code. (The only changes in src are to convert ESM import and export statements to CommonJS.)

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sfds/formio-sfds/EV7utheXsuym2c3oBARmB4sRwJzB
✅ Preview: https://formio-sfds-git-heroku-sfds.vercel.app

github-actions[bot] commented 3 years ago

Size Change: +48 B (0%)

Total Size: 87.2 kB

Filename Size Change
dist/formio-sfds.standalone.js 67.2 kB +48 B (0%)
ℹ️ View Unchanged | Filename | Size | Change | | :--- | :---: | :---: | | `dist/common.css` | 297 B | 0 B | | `dist/formio-sfds.css` | 14.3 kB | 0 B | | `dist/portal.js` | 5.36 kB | 0 B |

compressed-size-action

akegan commented 3 years ago

looks pretty reasonable to me! You didn't have to add an app.json at all to get it up and running? LGTM from my end but I don't know enough about the product to really be able to QA.

I'd also recommend using something like papertrail as your logging system. You can set it up to automatically be added to your review apps with something like this in your app.json if you create one.

shawnbot commented 3 years ago

looks pretty reasonable to me! You didn't have to add an app.json at all to get it up and running?

Nope. Heroku's default Node.js environment runs the build npm script by default, just like Vercel. It looks like I could also ditch the Procfile and it would also use the start script to run the server.

LGTM from my end but I don't know enough about the product to really be able to QA.

Yeah, me neither tbh. Most of this stuff is going to move out of this repo eventually, and the JS used on sf.gov is "hosted" on unpkg.com.

I'd also recommend using something like papertrail as your logging system. You can set it up to automatically be added to your review apps with something like this in your app.json if you create one.

Thanks for the rec! I'm not sure it's worth it right now, but if we see errors in the WTF and translation views blocking that work I'll set it up for some better visibility into what's happening. I think that serving better error messages will go further than logging, since there's nothing persistent happening in the app.