Improve Docker configuration (#6055)
This commit is contained in:
parent
ef9611d745
commit
f1aca16a1e
2 changed files with 28 additions and 0 deletions
|
|
@ -119,6 +119,19 @@ Rails.application.configure do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Docker specific development configuration
|
||||
if File.file?("/.dockerenv")
|
||||
# Using shell tools so we don't need to require Socket and IPAddr
|
||||
host_ip = `/sbin/ip route|awk '/default/ { print $3 }'`.strip
|
||||
logger = Logger.new(STDOUT)
|
||||
logger.info "Whitelisting #{host_ip} for BetterErrors and Web Console"
|
||||
|
||||
if defined?(BetterErrors::Middleware)
|
||||
BetterErrors::Middleware.allow_ip!(host_ip)
|
||||
end
|
||||
config.web_console.whitelisted_ips << host_ip
|
||||
end
|
||||
end
|
||||
|
||||
Rails.application.routes.default_url_options = { host: Rails.application.config.app_domain }
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ services:
|
|||
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres
|
||||
YARN_INTEGRITY_ENABLED: "false"
|
||||
ELASTICSEARCH_URL: http://elasticsearch:9200
|
||||
REDIS_URL: redis://redis:6379
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
command: bundle exec rails server -b 0.0.0.0 -p 3000
|
||||
|
|
@ -21,12 +22,26 @@ services:
|
|||
command: rails jobs:work
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
environment:
|
||||
RAILS_ENV: development
|
||||
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres
|
||||
REDIS_URL: redis://redis:6379
|
||||
webpacker:
|
||||
build: .
|
||||
command: ./bin/webpack-dev-server
|
||||
sidekiq:
|
||||
build: .
|
||||
command: bundle exec sidekiq -c 2
|
||||
depends_on:
|
||||
- redis
|
||||
- db
|
||||
- elasticsearch
|
||||
environment:
|
||||
RAILS_ENV: development
|
||||
REDIS_SIDEKIQ_URL: redis://redis:6379
|
||||
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres
|
||||
ELASTICSEARCH_URL: http://elasticsearch:9200
|
||||
db:
|
||||
image: postgres:${POSTGRES_VERSION:-9.6.15-alpine}
|
||||
ports:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue