[CI] Commit database.yml

Makes the test setup easier.
Also eases prod deploys with the two separate db pool sizes.
This commit is contained in:
Earlopain 2023-02-25 14:41:07 +01:00
parent 3fc87634eb
commit 09be4cded9
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
6 changed files with 26 additions and 47 deletions

View File

@ -26,23 +26,6 @@
# export UNICORN_USER=danbooru
# export UNICORN_GROUP=danbooru
#
# Database
#
# DATABASE_URL takes precedence over config/database.yml if defined.
# Put these in .env.production or .env.development to define your dev/prod
# databases. Do not define it in .env or .env.local! It will be taken as your
# test database too, and rails will wipe it if you run the test suite.
#
# If you are connecting to PostgreSQL via socket, omit the hostname (e.g.
# postgresql:///danbooru2)
# export DATABASE_URL="postgresql://localhost/danbooru2"
# Put these in .env.test to define your test database.
# export DATABASE_URL="postgresql://localhost/danbooru2_test"
#
# Rails
#

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
.env
.env.production
.bundle
.yardoc
config/database.yml
config/danbooru_local_config.rb
config/deploy/*.rb
config/application.yml

View File

@ -14,9 +14,6 @@ FileUtils.chdir APP_ROOT do
# Add necessary setup steps to this file.
puts "\n== Copying sample files =="
unless File.exist?('config/database.yml')
FileUtils.cp 'docker/database.yml', 'config/database.yml'
end
unless File.exist?('config/danbooru_local_config.rb')
FileUtils.cp 'docker/danbooru_local_config.rb', 'config/danbooru_local_config.rb'
end

25
config/database.yml Executable file
View File

@ -0,0 +1,25 @@
default: &default
adapter: postgresql
timeout: 5000
development:
<<: *default
database: danbooru2
username: danbooru
host: postgres
pool: 5
test:
<<: *default
database: danbooru2_test
username: danbooru
host: postgres
pool: 5
production:
<<: *default
database: e621
username: e621
password: <%= ENV["DB_PASSWORD"] %>
host: <%= ENV["DB_HOST"] %>
pool: <%= Sidekiq.server? ? ENV["DB_WORKER_POOL_SIZE"] : ENV["DB_POOL_SIZE"] %>

View File

@ -1,7 +1,6 @@
version: "3"
x-environment: &common-env
DATABASE_URL: postgresql://danbooru:@postgres
DANBOORU_HOSTNAME: http://localhost:3000
DANBOORU_REDIS_URL: redis://redis
DANBOORU_ELASTICSEARCH_HOST: elastic

View File

@ -1,25 +0,0 @@
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: postgresql
database: danbooru2
pool: 5
timeout: 5000
url: <%= ENV['DATABASE_URL'] %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
database: danbooru2_test
pool: 5
timeout: 5000
url: <%= ENV['DATABASE_URL'] %>
production:
adapter: postgresql
database: danbooru2
pool: 5
timeout: 5000
url: <%= ENV['DATABASE_URL'] %>