New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a phoenix-static buildpack #835

Closed
josevalim opened this Issue May 1, 2015 · 30 comments

Comments

Projects
None yet
@josevalim
Member

josevalim commented May 1, 2015

We need a phoenix build pack that is going to compile brunch.io assets on Heroku. The phoenix-static build pack is supposed to play with the existing Elixir buildpack and just add the following steps:

  1. Installation and cache of node.js
  2. Running brunch --production
  3. Running mix phoenix.digest in the appropriate MIX_ENV to copy the files

For now, brunch can be hardcoded, but we can make it configurable in the future to support other build tools.

We would really appreciate help from developers interested in tackling and providing this build pack as a separate project!

@tsloughter

This comment has been minimized.

Show comment
Hide comment
@tsloughter

tsloughter May 1, 2015

A new Heroku CLI feature that should help with this will land today or tomorrow. I'll update when it is.

tsloughter commented May 1, 2015

A new Heroku CLI feature that should help with this will land today or tomorrow. I'll update when it is.

@josevalim

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim May 2, 2015

Member

Tell us more! 🙊

Member

josevalim commented May 2, 2015

Tell us more! 🙊

@lstor

This comment has been minimized.

Show comment
Hide comment
@lstor

lstor May 2, 2015

I personally think using a multi-buildpack approach is better. The advantages are among other things:

  • the Elixir community doesn't have to maintain a non-Elixir buildpack
  • it's build-tool agnostic, with a complete node environment
  • it's working already and doesn't require any extra effort

I've been thinking about writing a guide on how to do this, but a sooper quick rundown is:

  1. Use heroku-buildpack-multi as buildpack

    heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi
    
  2. Add this to .buildpacks

    https://github.com/HashNuke/heroku-buildpack-elixir.git#36f2ff22d0236589256d9044091b950b7cc565d2
    https://github.com/heroku/heroku-buildpack-nodejs.git#v75
    
  3. Add a postinstall hook to package.json

    {
      "...": {
        // Other stuff
      },
      "scripts": {
        "postinstall": "brunch build --production"
      }
    }
  4. Profit!

I'm using this for patback (very WIP project), and it works like a charm.

lstor commented May 2, 2015

I personally think using a multi-buildpack approach is better. The advantages are among other things:

  • the Elixir community doesn't have to maintain a non-Elixir buildpack
  • it's build-tool agnostic, with a complete node environment
  • it's working already and doesn't require any extra effort

I've been thinking about writing a guide on how to do this, but a sooper quick rundown is:

  1. Use heroku-buildpack-multi as buildpack

    heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi
    
  2. Add this to .buildpacks

    https://github.com/HashNuke/heroku-buildpack-elixir.git#36f2ff22d0236589256d9044091b950b7cc565d2
    https://github.com/heroku/heroku-buildpack-nodejs.git#v75
    
  3. Add a postinstall hook to package.json

    {
      "...": {
        // Other stuff
      },
      "scripts": {
        "postinstall": "brunch build --production"
      }
    }
  4. Profit!

I'm using this for patback (very WIP project), and it works like a charm.

@tsloughter

This comment has been minimized.

Show comment
Hide comment
@tsloughter

tsloughter May 2, 2015

You'll be able to do it without using that buildpack very soon.

tsloughter commented May 2, 2015

You'll be able to do it without using that buildpack very soon.

@tsloughter

This comment has been minimized.

Show comment
Hide comment
@tsloughter

tsloughter May 5, 2015

The buildpack stuff has been released if you update your client. They are still working on a devcenter article:

$ heroku buildpacks --help
.....
Additional commands, type "heroku help COMMAND" for more details:

  buildpacks:add BUILDPACK_URL       #  add new app buildpack, inserting into list of buildpacks if neccessary
  buildpacks:clear                   #  clear all buildpacks set on the app
  buildpacks:remove [BUILDPACK_URL]  #  remove a buildpack set on the app
  buildpacks:set BUILDPACK_URL       #  set new app buildpack, overwriting into list of buildpacks if neccessary

tsloughter commented May 5, 2015

The buildpack stuff has been released if you update your client. They are still working on a devcenter article:

$ heroku buildpacks --help
.....
Additional commands, type "heroku help COMMAND" for more details:

  buildpacks:add BUILDPACK_URL       #  add new app buildpack, inserting into list of buildpacks if neccessary
  buildpacks:clear                   #  clear all buildpacks set on the app
  buildpacks:remove [BUILDPACK_URL]  #  remove a buildpack set on the app
  buildpacks:set BUILDPACK_URL       #  set new app buildpack, overwriting into list of buildpacks if neccessary

@kineticdial

This comment has been minimized.

Show comment
Hide comment
@kineticdial

kineticdial May 5, 2015

Contributor

Awesome!! 😄 👍

Contributor

kineticdial commented May 5, 2015

Awesome!! 😄 👍

@tsloughter

This comment has been minimized.

Show comment
Hide comment
@hayesgm

This comment has been minimized.

Show comment
Hide comment
@hayesgm

hayesgm May 31, 2015

Contributor

As there's a few gotchas (e.g. multiple buildpacks and asset digesting), would it be good to add a "Deploying to Heroku" section to the official Phoenix guides? This would an alternative to creating a phoenix static buildpack.

Contributor

hayesgm commented May 31, 2015

As there's a few gotchas (e.g. multiple buildpacks and asset digesting), would it be good to add a "Deploying to Heroku" section to the official Phoenix guides? This would an alternative to creating a phoenix static buildpack.

@ericmj

This comment has been minimized.

Show comment
Hide comment
@ericmj

ericmj May 31, 2015

Member

We don't need a separate buildpack - just a post_compile hook in the existing buildpack, with that it should be fairly straight forward process of setting it up. Either way documenting it in the guides is a good idea.

Member

ericmj commented May 31, 2015

We don't need a separate buildpack - just a post_compile hook in the existing buildpack, with that it should be fairly straight forward process of setting it up. Either way documenting it in the guides is a good idea.

@lancehalvorsen

This comment has been minimized.

Show comment
Hide comment
@lancehalvorsen

lancehalvorsen May 31, 2015

Member

Revamping the way we handle deployment in the guides is coming up right after the current chunk of work on testing. Right now, we have this tabula rasa for Heroku deployment:
https://github.com/phoenixframework/phoenix_guides/blob/master/deployment/E_heroku.md

As always, PR's are very welcome. :)

Member

lancehalvorsen commented May 31, 2015

Revamping the way we handle deployment in the guides is coming up right after the current chunk of work on testing. Right now, we have this tabula rasa for Heroku deployment:
https://github.com/phoenixframework/phoenix_guides/blob/master/deployment/E_heroku.md

As always, PR's are very welcome. :)

@ericmj

This comment has been minimized.

Show comment
Hide comment
@ericmj

ericmj May 31, 2015

Member

@lancehalvorsen I will contribute docs when the buildpack is ready.

Member

ericmj commented May 31, 2015

@lancehalvorsen I will contribute docs when the buildpack is ready.

@lancehalvorsen

This comment has been minimized.

Show comment
Hide comment
@lancehalvorsen

lancehalvorsen May 31, 2015

Member

@ericmj, for that, you get the @josevalim -style-all-the-hearts-emoji!
❤️ 💚 💙 💛 💜

Member

lancehalvorsen commented May 31, 2015

@ericmj, for that, you get the @josevalim -style-all-the-hearts-emoji!
❤️ 💚 💙 💛 💜

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jun 14, 2015

Contributor

Hi all!

Just created a phoenix static buildpack. It has configuration much like elixir buildpack. It caches node, npm modules and bower components and runs brunch build --production and mix phoenix.digest.

I tried it out with several Heroku deploys and it seems to work fine. I also had @ericmj initially review it. I'll address any issues reported as soon as I can.

Feel free to leave any feedback and hope you guys find it satisfactory!

Contributor

gjaldon commented Jun 14, 2015

Hi all!

Just created a phoenix static buildpack. It has configuration much like elixir buildpack. It caches node, npm modules and bower components and runs brunch build --production and mix phoenix.digest.

I tried it out with several Heroku deploys and it seems to work fine. I also had @ericmj initially review it. I'll address any issues reported as soon as I can.

Feel free to leave any feedback and hope you guys find it satisfactory!

@josevalim

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim Jun 15, 2015

Member

This is just fantastic! Thank you @gjaldon! ❤️ 💚 💙 💛 💜

Member

josevalim commented Jun 15, 2015

This is just fantastic! Thank you @gjaldon! ❤️ 💚 💙 💛 💜

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jun 15, 2015

Contributor

My pleasure! 😄

Contributor

gjaldon commented Jun 15, 2015

My pleasure! 😄

@sheharyarn

This comment has been minimized.

Show comment
Hide comment
@sheharyarn

sheharyarn commented Jun 22, 2015

@gjaldon Awesome! 😮

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jun 22, 2015

Contributor

Thanks! :D

On Tue, Jun 23, 2015 at 3:40 AM, Sheharyar Naseer notifications@github.com
wrote:

@gjaldon https://github.com/gjaldon Awesome! [image: 😮]


Reply to this email directly or view it on GitHub
#835 (comment)
.

Gabe Jaldon

Contributor

gjaldon commented Jun 22, 2015

Thanks! :D

On Tue, Jun 23, 2015 at 3:40 AM, Sheharyar Naseer notifications@github.com
wrote:

@gjaldon https://github.com/gjaldon Awesome! [image: 😮]


Reply to this email directly or view it on GitHub
#835 (comment)
.

Gabe Jaldon

@ulrikstrid

This comment has been minimized.

Show comment
Hide comment
@ulrikstrid

ulrikstrid Jul 18, 2015

@gjaldon I think doing something like npm production or something like that would be better if some one want to use gulp/webpack/whatever instead of brunch.

ulrikstrid commented Jul 18, 2015

@gjaldon I think doing something like npm production or something like that would be better if some one want to use gulp/webpack/whatever instead of brunch.

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jul 18, 2015

Contributor

@ulrikaugustsson you could customize the commands being run for compiling your assets. Check it out here: https://github.com/gjaldon/heroku-buildpack-phoenix-static#compile

Contributor

gjaldon commented Jul 18, 2015

@ulrikaugustsson you could customize the commands being run for compiling your assets. Check it out here: https://github.com/gjaldon/heroku-buildpack-phoenix-static#compile

@ulrikstrid

This comment has been minimized.

Show comment
Hide comment
@ulrikstrid

ulrikstrid Jul 18, 2015

Okey, sorry! Just thought that a "sane default" would be best but documentation should give the same result. :) 👍

ulrikstrid commented Jul 18, 2015

Okey, sorry! Just thought that a "sane default" would be best but documentation should give the same result. :) 👍

@chrismccord

This comment has been minimized.

Show comment
Hide comment
@chrismccord

chrismccord Jul 18, 2015

Member

I've tested this out and it worked perfectly. Thank you very much @gjaldon. We have a Heroku guide in place here
https://github.com/phoenixframework/phoenix_guides/blob/master/deployment/E_heroku.md

I think the only thing left to close this one out is to get this up on the site. // @lancehalvorsen @jeregrine

Member

chrismccord commented Jul 18, 2015

I've tested this out and it worked perfectly. Thank you very much @gjaldon. We have a Heroku guide in place here
https://github.com/phoenixframework/phoenix_guides/blob/master/deployment/E_heroku.md

I think the only thing left to close this one out is to get this up on the site. // @lancehalvorsen @jeregrine

@lancehalvorsen

This comment has been minimized.

Show comment
Hide comment
@lancehalvorsen

lancehalvorsen Jul 18, 2015

Member

Fabulous! I'm on it.

Member

lancehalvorsen commented Jul 18, 2015

Fabulous! I'm on it.

@lancehalvorsen

This comment has been minimized.

Show comment
Hide comment
@lancehalvorsen

lancehalvorsen Jul 18, 2015

Member

Heroku Deployment Guide is now live on phoenixframework.org.

Thanks so much @gjaldon for providing the buildpack, and thanks again to @stevedomin for the guide!

Member

lancehalvorsen commented Jul 18, 2015

Heroku Deployment Guide is now live on phoenixframework.org.

Thanks so much @gjaldon for providing the buildpack, and thanks again to @stevedomin for the guide!

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jul 18, 2015

Contributor

My pleasure, guys! Looking forward to seeing the Heroku guide up on Phoenix Guides. :)

Contributor

gjaldon commented Jul 18, 2015

My pleasure, guys! Looking forward to seeing the Heroku guide up on Phoenix Guides. :)

@matthewlehner

This comment has been minimized.

Show comment
Hide comment
@matthewlehner

matthewlehner Jul 20, 2015

Contributor

Howdy folks, following along with the Heroku guide and ran into what is probably a small issue with the secret key and crypto key generation on forms, I think for CSRF stuff – detailed this in #1033

The tooling has really come along nicely! Thanks for so much hard work with the guides, and build packs, etc. 😸

Contributor

matthewlehner commented Jul 20, 2015

Howdy folks, following along with the Heroku guide and ran into what is probably a small issue with the secret key and crypto key generation on forms, I think for CSRF stuff – detailed this in #1033

The tooling has really come along nicely! Thanks for so much hard work with the guides, and build packs, etc. 😸

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jul 20, 2015

Contributor

@matthewlehner I just responded to the issue you posted

Contributor

gjaldon commented Jul 20, 2015

@matthewlehner I just responded to the issue you posted

@stevedomin

This comment has been minimized.

Show comment
Hide comment
@stevedomin

stevedomin Jul 20, 2015

Contributor

@matthewlehner @gjaldon sorry about that one, was a last minute change based on some reading I had done, forgot to try it

Contributor

stevedomin commented Jul 20, 2015

@matthewlehner @gjaldon sorry about that one, was a last minute change based on some reading I had done, forgot to try it

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jul 20, 2015

Contributor

No prob at all, @stevedomin. I'm just happy you wrote the guide :)

Contributor

gjaldon commented Jul 20, 2015

No prob at all, @stevedomin. I'm just happy you wrote the guide :)

@gjaldon

This comment has been minimized.

Show comment
Hide comment
@gjaldon

gjaldon Jul 22, 2015

Contributor

@chrismccord @josevalim looks like this is good to close

Contributor

gjaldon commented Jul 22, 2015

@chrismccord @josevalim looks like this is good to close

@josevalim

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim Jul 22, 2015

Member

Indeed! ❤️ 💚 💙 💛 💜

Member

josevalim commented Jul 22, 2015

Indeed! ❤️ 💚 💙 💛 💜

@josevalim josevalim closed this Jul 22, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment