Update database config (#11308)
This commit is contained in:
parent
3a7e8cb8e5
commit
e8fb17ca78
3 changed files with 30 additions and 14 deletions
15
.env_sample
15
.env_sample
|
|
@ -40,6 +40,21 @@ export OPENRESTY_URL=""
|
||||||
# SSL config
|
# SSL config
|
||||||
export FORCE_SSL_IN_RAILS="not applicable in dev"
|
export FORCE_SSL_IN_RAILS="not applicable in dev"
|
||||||
|
|
||||||
|
# Postgres DB
|
||||||
|
export DATABASE_NAME="Forem_development" # Used when creating a db instance `rails db:create`
|
||||||
|
export DATABASE_URL="postgresql://localhost:5432/$DATABASE_NAME" # This takes precedence over `DATABASE_NAME` if they don't match
|
||||||
|
export RAILS_MAX_THREADS=5 # Specifies the number of Puma threads
|
||||||
|
export WEB_CONCURRENCY=2 # Specifies the number of `workers` to boot in clustered mode.
|
||||||
|
export DATABASE_POOL_SIZE=5 # The number of concurrent connections to Postgres. If unset the value of RAILS_MAX_THREADS will be used in it's place.
|
||||||
|
export DATABASE_NAME_TEST=Forem_test
|
||||||
|
export DATABASE_URL_TEST="postgresql://localhost:5432/$DATABASE_NAME_TEST" # Differentiate test db from dev db. Test DB is wiped on each test run.
|
||||||
|
|
||||||
|
# Rails
|
||||||
|
export RAILS_ENV="development" # Set to 'production' when deploying for security and performance.
|
||||||
|
|
||||||
|
# Node
|
||||||
|
export NODE_ENV="development" # Set to 'production' when deploying for security and performance.
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
######### Optional 3rd Party Services ##########
|
######### Optional 3rd Party Services ##########
|
||||||
################################################
|
################################################
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,10 @@ services:
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- RAILS_ENV=test
|
- RAILS_ENV=test
|
||||||
- DATABASE_URL=postgres://postgres@localhost/
|
- DATABASE_URL=postgres://postgres@localhost/Forem_prod_test
|
||||||
|
- DATABASE_NAME=Forem_prod_test
|
||||||
|
- DATABASE_URL_TEST=postgres://postgres@localhost/Forem_test
|
||||||
|
- DATABASE_NAME_TEST=Forem_test
|
||||||
# Dummy values needed to verify the app boots via "rails runner"
|
# Dummy values needed to verify the app boots via "rails runner"
|
||||||
- APP_PROTOCOL=http://
|
- APP_PROTOCOL=http://
|
||||||
- APP_DOMAIN=localhost:3000
|
- APP_DOMAIN=localhost:3000
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,18 @@ default: &default
|
||||||
encoding: unicode
|
encoding: unicode
|
||||||
# For details on connection pooling, see Rails configuration guide
|
# For details on connection pooling, see Rails configuration guide
|
||||||
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
pool: <%= ENV.fetch("DATABASE_POOL_SIZE") { ENV.fetch("RAILS_MAX_THREADS", 5).to_i } %>
|
||||||
connect_timeout: 2
|
connect_timeout: 2
|
||||||
checkout_timeout: 2
|
checkout_timeout: 2
|
||||||
variables:
|
variables:
|
||||||
statement_timeout: <%= ENV.fetch('STATEMENT_TIMEOUT', 2500).to_i %>
|
statement_timeout: <%= ENV.fetch("STATEMENT_TIMEOUT", 2500).to_i %>
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
url: <%= ENV.fetch('DATABASE_URL', '') %>
|
url: <%= ENV.fetch("DATABASE_URL", "postgres:///Forem_development") %>
|
||||||
database: PracticalDeveloper_development
|
database: <%= ENV.fetch("DATABASE_NAME", "Forem_development") %>
|
||||||
variables:
|
variables:
|
||||||
statement_timeout: <%= ENV.fetch('STATEMENT_TIMEOUT', 10_000).to_i %>
|
statement_timeout: <%= ENV.fetch("STATEMENT_TIMEOUT", 10_000).to_i %>
|
||||||
|
|
||||||
# The specified database role being used to connect to postgres.
|
# The specified database role being used to connect to postgres.
|
||||||
# To create additional roles in postgres see `$ createuser --help`.
|
# To create additional roles in postgres see `$ createuser --help`.
|
||||||
|
|
@ -64,10 +64,10 @@ development:
|
||||||
# Do not set this db to the same as development or production.
|
# Do not set this db to the same as development or production.
|
||||||
test:
|
test:
|
||||||
<<: *default
|
<<: *default
|
||||||
url: <%= ENV['DATABASE_URL_TEST'] || ENV['DATABASE_URL'] || ''%>
|
url: <%= ENV.fetch("DATABASE_URL_TEST", "postgres:///Forem_test") %>
|
||||||
database: PracticalDeveloper_test<%= ENV['TEST_ENV_NUMBER'] %>
|
database: <%= ENV.fetch("DATABASE_NAME_TEST", "Forem_test") %><%= ENV["TEST_ENV_NUMBER"] %>
|
||||||
variables:
|
variables:
|
||||||
statement_timeout: <%= ENV.fetch('STATEMENT_TIMEOUT', 10_000).to_i %>
|
statement_timeout: <%= ENV.fetch("STATEMENT_TIMEOUT", 10_000).to_i %>
|
||||||
|
|
||||||
# As with config/secrets.yml, you never want to store sensitive information,
|
# As with config/secrets.yml, you never want to store sensitive information,
|
||||||
# like your database password, in your source code. If your source code is
|
# like your database password, in your source code. If your source code is
|
||||||
|
|
@ -86,11 +86,9 @@ test:
|
||||||
# You can use this database configuration with:
|
# You can use this database configuration with:
|
||||||
#
|
#
|
||||||
# production:
|
# production:
|
||||||
# url: <%= ENV['DATABASE_URL'] %>
|
# url: <%= ENV["DATABASE_URL"] %>
|
||||||
#
|
#
|
||||||
production:
|
production:
|
||||||
<<: *default
|
<<: *default
|
||||||
database: PracticalDeveloper_production
|
url: <%= ENV["DATABASE_URL"] %>
|
||||||
pool: <%= ENV['DATABASE_POOL_SIZE'] %>
|
database: <%= ENV["DATABASE_NAME"] %>
|
||||||
username: PracticalDeveloper
|
|
||||||
password: <%= ENV['PRACTICALDEVELOPER_DATABASE_PASSWORD'] %>
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue