config: set default database connection settings.
Set sensible defaults for connecting to the database. By default, we try to connect to the `danbooru2` database running on localhost as the `danbooru` user. These are the defaults recommended by the install guide. If you need to change the database settings, set DATABASE_URL in .env.local or on the command line: # .env.local DATABASE_URL=postgresql://danbooru:password@localhost/danbooru2 # command line $ DATABASE_URL=postgresql://danbooru:password@localhost/danbooru2 bin/rails server This eliminates the need to copy script/install/database.yml.templ to config/database.yml during installation and during deployment. This is so that Danbooru works out of the box without extra configuration. In particular, this is so that we can run Danbooru in a Docker container without having to set DATABASE_URL.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,7 +3,6 @@
|
|||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
.gitconfig
|
.gitconfig
|
||||||
.git/
|
.git/
|
||||||
config/database.yml
|
|
||||||
config/danbooru_local_config.rb
|
config/danbooru_local_config.rb
|
||||||
config/deploy/*.rb
|
config/deploy/*.rb
|
||||||
config/newrelic.yml
|
config/newrelic.yml
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ mkdir -p /var/www/danbooru2/shared/data
|
|||||||
mkdir -p /var/www/danbooru2/shared/data/preview
|
mkdir -p /var/www/danbooru2/shared/data/preview
|
||||||
mkdir -p /var/www/danbooru2/shared/data/sample
|
mkdir -p /var/www/danbooru2/shared/data/sample
|
||||||
chown -R danbooru:danbooru /var/www/danbooru2
|
chown -R danbooru:danbooru /var/www/danbooru2
|
||||||
curl -L -s $GITHUB_INSTALL_SCRIPTS/database.yml.templ -o /var/www/danbooru2/shared/config/database.yml
|
|
||||||
curl -L -s $GITHUB_INSTALL_SCRIPTS/danbooru_local_config.rb.templ -o /var/www/danbooru2/shared/config/danbooru_local_config.rb
|
curl -L -s $GITHUB_INSTALL_SCRIPTS/danbooru_local_config.rb.templ -o /var/www/danbooru2/shared/config/danbooru_local_config.rb
|
||||||
|
|
||||||
echo "* Almost done! You are now ready to deploy Danbooru onto this server."
|
echo "* Almost done! You are now ready to deploy Danbooru onto this server."
|
||||||
|
|||||||
39
config/database.yml
Normal file
39
config/database.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Don't edit this file. To override this file, set `DATABASE_URL` in .env.local
|
||||||
|
# instead. Example:
|
||||||
|
#
|
||||||
|
# DATABASE_URL=postgresql://danbooru:password@localhost/danbooru2
|
||||||
|
#
|
||||||
|
# https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||||
|
|
||||||
|
default: &default
|
||||||
|
adapter: postgresql
|
||||||
|
username: danbooru
|
||||||
|
host: localhost
|
||||||
|
url: <%= ENV["DATABASE_URL"] %>
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *default
|
||||||
|
database: danbooru2
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
database: danbooru2
|
||||||
|
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
database: danbooru2_test
|
||||||
|
|
||||||
|
archive_production:
|
||||||
|
<<: *default
|
||||||
|
database: archive_production
|
||||||
|
url: <%= ENV["ARCHIVE_DATABASE_URL"] %>
|
||||||
|
|
||||||
|
archive_development:
|
||||||
|
<<: *default
|
||||||
|
database: archive_development
|
||||||
|
url: <%= ENV["ARCHIVE_DATABASE_URL"] %>
|
||||||
|
|
||||||
|
archive_test:
|
||||||
|
<<: *default
|
||||||
|
database: archive_test
|
||||||
|
url: <%= ENV["ARCHIVE_DATABASE_URL"] %>
|
||||||
@@ -3,7 +3,6 @@ namespace :symlink do
|
|||||||
task :local_files do
|
task :local_files do
|
||||||
on roles(:app, :worker) do
|
on roles(:app, :worker) do
|
||||||
execute :ln, "-s", "#{deploy_to}/shared/config/danbooru_local_config.rb", "#{release_path}/config/danbooru_local_config.rb"
|
execute :ln, "-s", "#{deploy_to}/shared/config/danbooru_local_config.rb", "#{release_path}/config/danbooru_local_config.rb"
|
||||||
execute :ln, "-s", "#{deploy_to}/shared/config/database.yml", "#{release_path}/config/database.yml"
|
|
||||||
if test("[ -f #{deploy_to}/shared/config/newrelic.yml ]")
|
if test("[ -f #{deploy_to}/shared/config/newrelic.yml ]")
|
||||||
execute :ln, "-s", "#{deploy_to}/shared/config/newrelic.yml", "#{release_path}/config/newrelic.yml"
|
execute :ln, "-s", "#{deploy_to}/shared/config/newrelic.yml", "#{release_path}/config/newrelic.yml"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,45 +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'] %>
|
|
||||||
|
|
||||||
archive_development:
|
|
||||||
adapter: postgresql
|
|
||||||
database: archive_development
|
|
||||||
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
|
||||||
|
|
||||||
archive_test:
|
|
||||||
adapter: postgresql
|
|
||||||
database: archive_test
|
|
||||||
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
|
||||||
|
|
||||||
archive_production:
|
|
||||||
adapter: postgresql
|
|
||||||
database: archive_development
|
|
||||||
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
|
||||||
|
|
||||||
archive_staging:
|
|
||||||
adapter: postgresql
|
|
||||||
database: archive_development
|
|
||||||
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
|
||||||
Reference in New Issue
Block a user