Skip to content

Commit

Permalink
chore: update bin/setup, config/database.yml, and capybara_setup.rb t…
Browse files Browse the repository at this point in the history
…o be compatible for devcontainer
  • Loading branch information
ericenns committed Feb 20, 2025
1 parent d82194a commit 3bd939b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 41 deletions.
3 changes: 2 additions & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ FileUtils.chdir APP_ROOT do
# Add necessary setup steps to this file.

puts "== Installing dependencies =="
system("bundle check") || system!("bundle install")
system("bin/bundle check") || system!("bin/bundle install")
system("pnpm install --frozen-lockfile")

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
Expand Down
74 changes: 47 additions & 27 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
# PostgreSQL configuration options for development, production,
# and test profiles. Currently using postgres version 14.6
# PostgreSQL. Versions 9.3 and up are supported.
#
# Ensure the PostgreSQL gem is defined in your Gemfile
# gem "pg"
# Install the pg driver:
# gem install pg
# On macOS with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Also, ensure you have postgresql installed on your machine
# and/or dev/prod server either using asdf or using the OS
# package manager (such as apt-get for Ubuntu)
# Configure Using Gemfile
# gem "pg"
#
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: test
password: test
<% if ENV["DB_HOST"] %>
host: <%= ENV["DB_HOST"] %>
username: postgres
password: postgres
<% else %>
host: localhost
timeout: 5000

jobs: &jobs
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: test
password: test
host: localhost
timeout: 5000
migrations_paths: db/jobs_migrate
<% end %>


development:
primary:
<<: *default
database: irida_next_development
jobs:
<<: *jobs
<<: *default
database: irida_next_jobs_development
migrations_paths: db/jobs_migrate

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
Expand All @@ -47,17 +46,38 @@ test:
<<: *default
database: irida_next_test
jobs:
<<: *jobs
<<: *default
database: irida_next_jobs_test
migrations_paths: db/jobs_migrate

# As with config/credentials.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password or a full connection URL as an environment
# variable when you boot the app. For example:
#
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
# JOBS_DATABASE_URL="postgres://myuser:mypass@localhost/someotherdatabase"
#
# If the connection URL is provided in the special DATABASE_URL environment
# variable, Rails will automatically merge its configuration values on top of
# the values provided in this file. Alternatively, you can specify a connection
# URL environment variable explicitly:
#
# production:
# url: <%= ENV["MY_APP_DATABASE_URL"] %>
#
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full overview on how database connection configuration can be specified.
#
production:
primary:
primary: &primary_production
<<: *default
url: <%= ENV['DATABASE_URL'] %>
database: irida_next_production
username: irida_next
password: <%= ENV["IRIDA_NEXT_DATABASE_PASSWORD"] %>
jobs:
<<: *jobs
url: <%= ENV['JOBS_DATABASE_URL'] %>
<<: *primary_production
database: irida_next_jobs_production
migrations_paths: db/jobs_migrate
13 changes: 0 additions & 13 deletions test/test_helpers/capybara_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@

Capybara.server = :puma, { Silent: true }

# Make server listening on all hosts
Capybara.server_host = '0.0.0.0'
# Use a hostname accessible from the outside world
Capybara.app_host = 'http://localhost'

# Which domain to use when setting cookies directly in tests.
CAPYBARA_COOKIE_DOMAIN = URI.parse(Capybara.app_host).host.then do |host|
# If host is a top-level domain
next host unless host.include?('.')

".#{host}"
end

# Don't wait too long in `have_xyz` matchers
Capybara.default_max_wait_time = 20.seconds

Expand Down

0 comments on commit 3bd939b

Please sign in to comment.