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

Dochub #2

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0081337
added sidekiq reboot info
wilkosz Nov 15, 2017
84be9fc
moved reboot threshold from 500 to 1400 MB
wilkosz Nov 15, 2017
2b7260c
totalmem 1400 -> 2000 Mb
wilkosz Nov 16, 2017
b080cde
disconnect from shards individually
chrisdevor Jan 17, 2018
e45a233
Merge branch 'disconnect-individually-from-shards' into dochub
chrisdevor Jan 17, 2018
919ddaa
Revert "disconnect from shards individually"
chrisdevor Jan 17, 2018
cb826d7
puma_worker_killer
chrisdevor Jan 17, 2018
6b091f1
Revert "Merge branch 'disconnect-individually-from-shards' into dochub"
chrisdevor Jan 17, 2018
ee65070
3000 MB default
chrisdevor Jan 17, 2018
8c5fb4f
disable puma rolling restart
chrisdevor Jan 25, 2018
116e586
Revert "disable puma rolling restart"
chrisdevor Jan 25, 2018
41dbe28
Revert "Revert "disable puma rolling restart""
chrisdevor Jan 29, 2018
15285ca
on worker boot -- ActiveRecord::Base.establish_connection
chrisdevor Jan 30, 2018
fa8689c
before_fork ActiveRecord::Base.connection.disconnect!
chrisdevor Jan 31, 2018
48d8075
after_fork establish_connection
chrisdevor Jan 31, 2018
4a32db8
asdf
chrisdevor Jan 31, 2018
1e29dbf
remove activeRecord::Base.connection.disconnect!
chrisdevor Feb 1, 2018
9edd845
Merge remote-tracking branch 'upstream/master' into dochub
chrisdevor Oct 23, 2018
0f65478
Merge branch 'master' into dochub
chrisdevor Oct 23, 2018
a842438
Update spec/unit/recipes/configure_spec.rb
chrisdevor Oct 23, 2018
2dfeaf1
Update libraries/helpers.rb
chrisdevor Oct 23, 2018
f2f9418
update from remote
chrisdevor Oct 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ docs/build/*
vendor
client.pem
.chef.login

# Dochub
**/*.idea
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ RUN gem install bundler
RUN pip install yamllint

WORKDIR $APP_HOME
COPY package.json $APP_HOME/
COPY Gemfile* $APP_HOME/
COPY Berksfile* $APP_HOME/
COPY metadata.rb $APP_HOME/
COPY README.md $APP_HOME/

COPY Gemfile* $APP_HOME/
RUN bundle install -j 4
Expand All @@ -40,10 +45,8 @@ RUN printf "client_key \"/cookbooks/opsworks_ruby/client.pem\"\n" >> /root/.chef
RUN printf "node_name \"$(cat /cookbooks/opsworks_ruby/.chef.login)\"\n" >> /root/.chef/knife.rb
RUN printf "cookbook_path \"/cookbooks\"\n" >> /root/.chef/knife.rb

COPY package.json $APP_HOME/
RUN npm install

COPY metadata.rb $APP_HOME/
COPY README.md $APP_HOME/
RUN chef exec berks

18 changes: 18 additions & 0 deletions templates/default/puma.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,23 @@ end
# The default is 60
worker_timeout <%= @out[:timeout] %>

# before_fork do
# require 'puma_worker_killer'
# PumaWorkerKiller.config do |config|
# config.ram = 3000 # mb
# config.frequency = 10 # seconds
# config.percent_usage = 0.80
# config.rolling_restart_frequency = false # 12 * 3600 # 12 hours in seconds
# config.pre_term = -> (worker) { puts "Worker #{worker.inspect} being killed" }
# end
# PumaWorkerKiller.start
# end
#
# on_worker_boot do
# ActiveSupport.on_load(:active_record) do
# ActiveRecord::Base.establish_connection
# end
# end

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart if Gem.loaded_specs['puma'].version >= Gem::Version.new('3.0')
1 change: 1 addition & 0 deletions templates/default/sidekiq.monitrc.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
with pidfile <%= pid_file.to_s %>
start program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') %> bundle exec sidekiq -C <%= conf_file.to_s %> -i <%= n %> -P <%= pid_file.to_s %><%= to_require.to_s %> <%= syslog.to_s %>'" with timeout 90 seconds
stop program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') %> bundle exec sidekiqctl stop <%= pid_file %> <%= timeout %>'" with timeout <%= timeout + 10 %> seconds
if totalmem is greater than 2000 MB for 2 cycles then restart # eating up memory?
group sidekiq_<%= @application.to_s %>_group

<% end %>