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

Various fixes for the Rails template #1047

Merged
merged 6 commits into from
Apr 6, 2020
Merged

Various fixes for the Rails template #1047

merged 6 commits into from
Apr 6, 2020

Conversation

Sam-Killgallon
Copy link
Contributor

I recently set up ship and came across a few things that required debugging in order to get it running

  1. Shipit uses the redis-rails gem for caching which doesn't support cache_versioning, so the app refuses to start. Rails ships with a redis_cache_store that does support this, but I didn't have the time to fully test it to know if its a drop in replacement, so I just disabled versioning for now https://guides.rubyonrails.org/caching_with_rails.html#activesupport-cache-rediscachestore
    Screenshot 2020-03-27 at 7 04 53 pm

  2. I had some confusion getting Shipit to talk to Github because the provided secrets file used the same environment variable for the app_id and the installation_id even though they are different values

  3. Pubsubstub seems to cause the whole app to hang after a little while (Discussed /events URL returns no content in 0.31.0 #1024). I appreciate in that thread the decision hadn't been made whether or not to make this the default, so can drop this commit if preferred.

  4. A slightly confusing message was output during the templating, didn't cause any issues but thought it was worth clearing up. Rails seems to already supply the ruby <version> line in the Gemfile, and the message comes from Thor because it's already there https://github.com/erikhuda/thor/blob/da1e707627578eacbf7c6336ed1bb22fb3abfb86/lib/thor/actions/inject_into_file.rb#L63

Screenshot 2020-03-27 at 7 06 41 pm

Thank you for your hard work on this app and I'm looking forward to trying it out 👍

The redis-rails cache store does not provide cache versioning, which
defaults to true. As such the application will not start in production.

Rails ships with a built in redis_cache_store
https://guides.rubyonrails.org/caching_with_rails.html#activesupport-cache-rediscachestore
which does support this feature
The app_id and installation_id are not the same and so should be set via
different environment variables
There appears to be an issue with using persistent connections which
locks up the web workers
This line outputs a confusing error message 'File unchanged! The
supplied flag value not found!' because the line already exists
@ghost ghost added the cla-needed label Mar 27, 2020
@ghost ghost removed the cla-needed label Mar 30, 2020
@casperisfine
Copy link
Contributor

  1. Shipit uses the redis-rails gem for caching which doesn't support cache_versioning, so the app refuses to start.

Yeah, we no longer need it. I simply forgot to remove it after the Rails 6.0 upgrade.

@casperisfine casperisfine changed the title Fixes for shipit Various fixes for the Rails template Mar 30, 2020
template.rb Outdated
@@ -18,7 +18,9 @@
worker: bundle exec sidekiq -C config/sidekiq.yml
CODE

environment 'Pubsubstub.use_persistent_connections = false'
environment 'config.cache_store = :redis_store, Shipit.redis_url.to_s, { expires_in: 90.minutes }', env: :production
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go all the way and use the :redis_cache_store shipped with Rails.

@Sam-Killgallon
Copy link
Contributor Author

Thanks for the feedback. I'll apply the changes when I get a spare moment in the next couple of days

Since rails 5.2+ provides its own redis_cache_store the 'redis-rails'
gem is no longer required.

create_file 'Procfile', <<-CODE
web: bundle exec rails s -p $PORT
worker: bundle exec sidekiq -C config/sidekiq.yml
CODE

environment 'config.cache_store = :redis_store, Shipit.redis_url.to_s, { expires_in: 90.minutes }', env: :production
environment 'Pubsubstub.use_persistent_connections = false'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. That's probably a better default for most people.

@casperisfine
Copy link
Contributor

Thanks!

@casperisfine casperisfine merged commit 8f8a42a into Shopify:master Apr 6, 2020
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems April 6, 2020 08:48 Inactive
@shopify-shipit shopify-shipit bot requested a deployment to rubygems April 6, 2020 08:48 Abandoned
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