-
Notifications
You must be signed in to change notification settings - Fork 145
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
Conversation
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
Yeah, we no longer need it. I simply forgot to remove it after the Rails 6.0 upgrade. |
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 |
There was a problem hiding this comment.
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.
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' |
There was a problem hiding this comment.
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.
Thanks! |
I recently set up ship and came across a few things that required debugging in order to get it running
Shipit uses the
redis-rails
gem for caching which doesn't support cache_versioning, so the app refuses to start. Rails ships with aredis_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-rediscachestoreI had some confusion getting Shipit to talk to Github because the provided secrets file used the same environment variable for the
app_id
and theinstallation_id
even though they are different valuesPubsubstub 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.
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 fromThor
because it's already there https://github.com/erikhuda/thor/blob/da1e707627578eacbf7c6336ed1bb22fb3abfb86/lib/thor/actions/inject_into_file.rb#L63Thank you for your hard work on this app and I'm looking forward to trying it out 👍