rubyforgood / pantry_scheduler

MIT License
7 stars 13 forks source link

Upgrade webpacker and make it work on Cloud9 #112

Closed jgaskins closed 6 years ago

jgaskins commented 7 years ago

While pairing with @Elishebawiggins on her Cloud9 VM, we noticed a lot of extra work had to be done to get things working there:

A solution we discussed was to use foreman, but apparently webpacker 1.2 doesn't let us use environment variables in the YAML config the way database.yml does. Unfortunately, the webpack host needed to be dynamic.

This PR is the best solution I could find — it's basically just an upgrade of webpacker and some tweaked default config options. I created an account on Cloud9 to verify this branch works there (and added some workarounds to the README for things that didn't "just work") as well as deleted the entire app (DB and all) from my local machine to verify it works from scratch locally, too.

But once the instructions in the README were followed, rails s is all that's needed to run this both locally and on Cloud9. No separate webpack-dev-server process (I mean, I'm sure it runs, but Rails handles it and we don't need to care about it).

pollygee commented 7 years ago

@jgaskins what's the status with this?

jgaskins commented 7 years ago

It's good to go. I'm not sure why one of the builds is failing. I addressed the failure in 584f1f8 in this PR.

pollygee commented 7 years ago

OK @jgaskins I don't want to merge the code that breaks the build. When you have a chance can you take a look at it please? @bkemper did you ever look at the code?

jgaskins commented 7 years ago

That's what I meant by addressing the failure:

I addressed the failure in 584f1f8 in this PR.

The failure in CI:

$ RAILS_ENV=development rake db:setup db:drop
rake aborted!
Gem::LoadError: You have already activated rake 12.0.0, but your Gemfile requires rake 12.1.0. Prepending `bundle exec` to your command may solve this.

The fix is already in this PR. Gem version mismatches are due to the build server running a different version of Rake than we have in our Gemfile — the rake command loads the rake gem, and then when Rails loads rake through config/application.rb, it's a different version. The fix is to run the rake command through bundle exec, as I did in this PR.