diff --git a/config/settings.yml b/config/settings.yml index ba559c3..a28a838 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -23,3 +23,4 @@ force-ssl: false # dev-download: false postgres-string: "_env:PGSTRING:host=localhost port=5432 user=stackage dbname=stackage password=stackage" +postgres-poolsize: "_env:PGPOOLSIZE:8" diff --git a/src/Application.hs b/src/Application.hs index 8454f55..94e5a97 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -140,7 +140,7 @@ withFoundation appLogFunc appSettings inner = do gitRepoDev fp loadWebsiteContent else gitRepo "https://github.com/fpco/stackage-content.git" "master" loadWebsiteContent let pgConf = - PostgresConf {pgPoolSize = 2, pgConnStr = encodeUtf8 $ appPostgresString appSettings} + PostgresConf {pgPoolSize = appPostgresPoolsize appSettings, pgConnStr = encodeUtf8 $ appPostgresString appSettings} -- Temporary workaround to force content updates regularly, until -- distribution of webhooks is handled via consul runContentUpdates = diff --git a/src/Settings.hs b/src/Settings.hs index 889d724..6fe9a3f 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -39,6 +39,8 @@ data AppSettings = AppSettings -- behind a reverse proxy. , appPostgresString :: !Text -- ^ PostgreSQL connection string + , appPostgresPoolsize :: !Int + -- ^ PostgreSQL poolsize , appDetailedRequestLogging :: Bool -- ^ Use detailed request logging system @@ -71,6 +73,7 @@ instance FromJSON AppSettings where appPort <- o .: "port" appIpFromHeader <- o .: "ip-from-header" appPostgresString <- o .: "postgres-string" + appPostgresPoolsize <- o .: "postgres-poolsize" dev <- o .:? "development" .!= defaultDev diff --git a/stack.yaml b/stack.yaml index 5c8f607..1c8f98a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -13,6 +13,9 @@ extra-deps: subdirs: - casa-client - casa-types +- github: yesodweb/persistent + commit: f66ed6f472ff3faa140db37bf4649e5b80be4c57 + subdirs: [persistent] drop-packages: - Cabal