alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
306 stars 236 forks source link

Add support for deploying to GOV.UK PaaS #480

Closed bfk closed 1 year ago

bfk commented 6 years ago

Given the awesomeness of building and prototyping using production-like methods and the existence of the GOV.UK PaaS, I suggest making some small tweaks to make it easier to deploy prototype kit applications to the PaaS.

In order to make it possible to deploy a govuk prototype app to either heroku or CloudFoundry/PaaS, I needed to do the following to a vanilla install of the kit:

---
applications:
- name: APPNAME
  command: node start.js
  memory: 256M
  buildpack: nodejs_buildpack

Pretty minor. Those changes could all be added to the default kit without the user being aware or bothered. In terms of user actions and therefore docs changes, the only change I made compared to the heroku config was changing heroku config:set USERNAME=username_here to cf set-env APPNAME USERNAME username_here, and the same with PASSWORD to control the basic auth.

After those changes, the app could be deployed via git push heroku master or cf push APPNAME and worked on both platforms.

Obviously there were the couple of additional PaaS steps of registering for a PaaS account and downloading the CloudFoundry CLI. Then after checking cf target, just cf push APPNAME and done.

I'm sure that actual developers (not me!) could do a more straightforward job of this, but it seems like we are only a few steps away from making it trivial to deploy GOV.UK Prototype Kit apps to GOV.UK PaaS instead of or in addition to Heroku, and it might be in the longer-term GDS interest to do so.

Cheers!

edwardhorsford commented 6 years ago

Hi @bfk thanks for this - there's actually some PRs open on the kit to do most of this, but I think time constraints and our lack of familiarity with PaaS prevented us from merging.

One question - is it possible to get the .cfignore to mirror the .gitignore? There's other files in there that should likely not get sent up as well as /node_modules/.

quis commented 6 years ago

@edwardhorsford You can symlink .cfignore to .gitignore

Command: ln -s .gitignore .cfignore

Example: https://github.com/alphagov/notifications-admin/blob/8f40574c8383a40009482ea63a2e9bc40adb3d8c/.cfignore

edwardhorsford commented 6 years ago

@quis can this be done as part of the kit? Ie not something our end users have to do.

quis commented 6 years ago

Yeah, you can just run that command then commit the changes to the kit.

ruthhammond commented 1 year ago

No longer relevant as PaaS is being retired.