From a0314736c2d441aa8cd2a99f78a8726c3d53ecc6 Mon Sep 17 00:00:00 2001 From: Jack Danger Date: Wed, 21 Nov 2018 19:40:27 -0800 Subject: [PATCH 1/6] using defined Puma config This changes threads the `gemstash_env.config` options for Puma through to the `Puma::CLI.new` call. Prior to this change `:puma_workers` and `:puma_threads` were ignored when booting Gemstash via the CLI --- lib/gemstash/cli/start.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/gemstash/cli/start.rb b/lib/gemstash/cli/start.rb index 923fc3e1..d1ea2c3c 100644 --- a/lib/gemstash/cli/start.rb +++ b/lib/gemstash/cli/start.rb @@ -33,12 +33,24 @@ def puma_config File.expand_path("../../puma.rb", __FILE__) end + def store_pidfile + gemstash_env.pidfile = pidfile? + end + + def pidfile? + @cli.options[:pidfile] + end + def args - config_args + pidfile_args + daemonize_args + puma_args + pidfile_args + daemonize_args end - def config_args - ["--config", puma_config] + def puma_args + [ + "--config", puma_config, + "--workers", gemstash_env.config[:puma_workers], + "--threads", gemstash_env.config[:puma_threads] + ] end def daemonize_args From 00ceda55f7d7080f1d5e0260110197ff40eb09c1 Mon Sep 17 00:00:00 2001 From: Phan Le Date: Mon, 12 Aug 2019 13:58:38 -0700 Subject: [PATCH 2/6] Remove accidental changes --- lib/gemstash/cli/start.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/gemstash/cli/start.rb b/lib/gemstash/cli/start.rb index d1ea2c3c..37b03226 100644 --- a/lib/gemstash/cli/start.rb +++ b/lib/gemstash/cli/start.rb @@ -33,14 +33,6 @@ def puma_config File.expand_path("../../puma.rb", __FILE__) end - def store_pidfile - gemstash_env.pidfile = pidfile? - end - - def pidfile? - @cli.options[:pidfile] - end - def args puma_args + pidfile_args + daemonize_args end From bde49397cd7793a01a8141a7cd6384fc52c3ecdb Mon Sep 17 00:00:00 2001 From: Julia Lee Date: Wed, 16 Jan 2019 17:56:46 -0800 Subject: [PATCH 3/6] Convert puma config options to strings This effectively applies commit 76244016ab49fdde403e08e36cb99796a70bb3c1 When gusto/redis is merged in upstream, then this commit becomes unnecssary. For now gusto's gemstash fork is in an unideal inbetween state --- lib/gemstash/cli/start.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/gemstash/cli/start.rb b/lib/gemstash/cli/start.rb index 37b03226..88466b90 100644 --- a/lib/gemstash/cli/start.rb +++ b/lib/gemstash/cli/start.rb @@ -29,22 +29,30 @@ def daemonize? @cli.options[:daemonize] end - def puma_config - File.expand_path("../../puma.rb", __FILE__) - end - def args puma_args + pidfile_args + daemonize_args end def puma_args [ - "--config", puma_config, - "--workers", gemstash_env.config[:puma_workers], - "--threads", gemstash_env.config[:puma_threads] + '--config', puma_config, + '--workers', puma_workers, + '--threads', puma_threads, ] end + def puma_workers + gemstash_env.config[:puma_workers] ? gemstash_env.config[:puma_workers].to_s : '0' + end + + def puma_threads + gemstash_env.config[:puma_threads] ? gemstash_env.config[:puma_threads].to_s : '0' + end + + def puma_config + File.expand_path("../../puma.rb", __FILE__) + end + def daemonize_args if daemonize? ["--daemon"] From 82a75e99882ada559dc91ed4bbe16439239b2fdd Mon Sep 17 00:00:00 2001 From: Phan Le Date: Mon, 12 Aug 2019 14:50:28 -0700 Subject: [PATCH 4/6] Fix rubcop --- lib/gemstash/cli/start.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/gemstash/cli/start.rb b/lib/gemstash/cli/start.rb index 7f57af35..edcd44a5 100644 --- a/lib/gemstash/cli/start.rb +++ b/lib/gemstash/cli/start.rb @@ -38,18 +38,18 @@ def args def puma_args [ - '--config', puma_config, - '--workers', puma_workers, - '--threads', puma_threads, + "--config", puma_config, + "--workers", puma_workers, + "--threads", puma_threads ] end def puma_workers - gemstash_env.config[:puma_workers] ? gemstash_env.config[:puma_workers].to_s : '0' + gemstash_env.config[:puma_workers] ? gemstash_env.config[:puma_workers].to_s : "0" end def puma_threads - gemstash_env.config[:puma_threads] ? gemstash_env.config[:puma_threads].to_s : '0' + gemstash_env.config[:puma_threads] ? gemstash_env.config[:puma_threads].to_s : "0" end def puma_config From ac7a4736279eff2ef84469b76429c012acd7a98c Mon Sep 17 00:00:00 2001 From: Phan Le Date: Mon, 12 Aug 2019 20:58:52 -0700 Subject: [PATCH 5/6] Use expand __dir__ --- lib/gemstash/cli/start.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gemstash/cli/start.rb b/lib/gemstash/cli/start.rb index edcd44a5..ef26859e 100644 --- a/lib/gemstash/cli/start.rb +++ b/lib/gemstash/cli/start.rb @@ -53,7 +53,7 @@ def puma_threads end def puma_config - File.expand_path("../../puma.rb", __FILE__) + File.expand_path('../puma.rb', __dir__) end def daemonize_args From f03aca790afc2502bf2f440540579d405e4274a9 Mon Sep 17 00:00:00 2001 From: Phan Le Date: Mon, 12 Aug 2019 21:21:12 -0700 Subject: [PATCH 6/6] Use double quotes --- lib/gemstash/cli/start.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gemstash/cli/start.rb b/lib/gemstash/cli/start.rb index ef26859e..13c8a18f 100644 --- a/lib/gemstash/cli/start.rb +++ b/lib/gemstash/cli/start.rb @@ -53,7 +53,7 @@ def puma_threads end def puma_config - File.expand_path('../puma.rb', __dir__) + File.expand_path("../puma.rb", __dir__) end def daemonize_args