From 2b8160d5bd000504078357dabf8733af21c9d017 Mon Sep 17 00:00:00 2001 From: Justin Grevich Date: Wed, 6 Dec 2017 21:44:33 -0800 Subject: [PATCH] Make DB pool size configurable based on instance role __Why__ * Workers need a 5x larger pool than the IdP hosts hence we need a way to configure the pool size based on instance role. __How__ * Use a conditional to set the pool size based on the instance role type. --- config/database.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/database.yml b/config/database.yml index b6c8b078cec..4754b5a20be 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,8 +5,8 @@ postgresql: &postgresql port: 5432 defaults: &defaults - pool: 5 host: localhost + pool: 5 <<: *postgresql # timeout settings timeout: 5000 @@ -30,5 +30,6 @@ production: username: <%= Figaro.env.database_username! %> host: <%= Figaro.env.database_host! %> password: <%= Figaro.env.database_password! %> + pool: <%= (File.exist?('/etc/login.gov/info') && File.read('/etc/login.gov/info/role').chomp == 'worker') ? 26 : 5 %> sslmode: 'verify-full' sslrootcert: '/usr/local/share/aws/rds-combined-ca-bundle.pem'