gratipay / grtp.co

Gratipay Widgets + API
https://grtp.co/
MIT License
26 stars 19 forks source link

Migrate to Heroku #173

Closed clone1018 closed 7 years ago

clone1018 commented 7 years ago

This pull request is what we need to move grtp.co to Heroku, besides the actual inside-heroku setup.

The grtp.co Heroku setup is two buildpacks in a specific order:

  1. index=1 heroku/nodejs
  2. index=2 https://github.com/heroku/heroku-buildpack-static.git

And adding a postinstall of make build. So really what's happening is heroku is installing nodejs for the build and then a simple nginx server serves up the www/ directory

Here's a demo: https://grtp.herokuapp.com/v2.js

Deployment is now git push heroku master

clone1018 commented 7 years ago

Not ready yet! Doing work on the documentation now.

clone1018 commented 7 years ago

Ready to review!

techtonik commented 7 years ago

I don't see why this "post/pre"install step is needed at all if README is right saying that "The heroku/nodejs buildpack will then npm build the sources and save them in www. "

clone1018 commented 7 years ago

The heroku buildpack only saves the sources in www because we tell it to with the postinstall. Without that we would need to install some kind of temporary Procfile.

techtonik commented 7 years ago

What does "npm install" do exactly? Can we just add build step as:

"install": "npm build & npm install",

Or it will fail as a recursive dependency?

techtonik commented 7 years ago

My point of confusion is that npm install on package.json is about installing dependencies. Not about installing the package itself, right? Because if it is about installing package itself, there should be a package build step between installing dependencies and installing built package.

clone1018 commented 7 years ago

Well I'm definitely not a master. What can we do better and how should we improve this?

techtonik commented 7 years ago

I don't know yet. Let's fix tests first - https://github.com/gratipay/grtp.co/issues/170 - and think about this later.

P.S. I wish we had less vendor lockin, but going to Heroku is an awesome step compared to Nginx and SSH config before.