Skip to content
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

Heroku support #15

Merged
merged 2 commits into from
Jan 17, 2020
Merged

Heroku support #15

merged 2 commits into from
Jan 17, 2020

Conversation

bklang
Copy link
Collaborator

@bklang bklang commented Jan 17, 2020

This does two things:

  1. It configures the app for PostgreSQL in both production (Heroku) and local (using Docker)
  2. Renames an asset to work around this error:
2020-01-17T16:10:51.207654+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913] ActionView::Template::Error (The asset "plant_default.jpeg" is not present in the asset pipeline.):
2020-01-17T16:10:51.207656+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     34:   <% end %>
2020-01-17T16:10:51.207660+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     35:   <div class="col mb-4">
2020-01-17T16:10:51.207663+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     36:     <div class="card h-100">
2020-01-17T16:10:51.207715+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     37:       <%= image_tag('plant_default.jpeg', width: '100%') %>
2020-01-17T16:10:51.207719+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     38:       <div class="card-body">
2020-01-17T16:10:51.207721+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     39:         <h3 class="card-title">
2020-01-17T16:10:51.207723+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]     40:           There is always room for more!
2020-01-17T16:10:51.207726+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913]
2020-01-17T16:10:51.207728+00:00 app[web.1]: [f0f6d13a-b942-49c8-a5a6-119bd360d913] app/views/plants/index.html.erb:37

I do not know why Heroku and/or Rails wants .jpg instead of .jpeg, but this fixed it.

To start the app for local development:

  1. Run docker-compose up -d to start the Postgres container
  2. Ensure you have dotenv installed (gem install dotenv)
  3. Copy the sample environment file in the root of this repo: cp env .env
  4. Boot up Rails: dotenv bin/rails s

According to https://stackoverflow.com/a/51576943/841295 this is required in Rails 5. I do not understand why it breaks in production Heroku but works locally
@that-jill that-jill merged commit 8dfaa37 into master Jan 17, 2020
@that-jill that-jill deleted the heroku branch January 17, 2020 16:19
@bklang
Copy link
Collaborator Author

bklang commented Jan 17, 2020

Probable explanation for the file rename issue: rails/sprockets-rails#304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants