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
|
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
|
end
|
||||||
|
|
||||||
Rails.application.routes.default_url_options = { host: Rails.application.config.app_domain }
|
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
|
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres
|
||||||
YARN_INTEGRITY_ENABLED: "false"
|
YARN_INTEGRITY_ENABLED: "false"
|
||||||
ELASTICSEARCH_URL: http://elasticsearch:9200
|
ELASTICSEARCH_URL: http://elasticsearch:9200
|
||||||
|
REDIS_URL: redis://redis:6379
|
||||||
volumes:
|
volumes:
|
||||||
- .:/usr/src/app
|
- .:/usr/src/app
|
||||||
command: bundle exec rails server -b 0.0.0.0 -p 3000
|
command: bundle exec rails server -b 0.0.0.0 -p 3000
|
||||||
|
|
@ -21,12 +22,26 @@ services:
|
||||||
command: rails jobs:work
|
command: rails jobs:work
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
- redis
|
||||||
environment:
|
environment:
|
||||||
RAILS_ENV: development
|
RAILS_ENV: development
|
||||||
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres
|
DATABASE_URL: postgres://postgres:mysecretpassword@db:5432/postgres
|
||||||
|
REDIS_URL: redis://redis:6379
|
||||||
webpacker:
|
webpacker:
|
||||||
build: .
|
build: .
|
||||||
command: ./bin/webpack-dev-server
|
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:
|
db:
|
||||||
image: postgres:${POSTGRES_VERSION:-9.6.15-alpine}
|
image: postgres:${POSTGRES_VERSION:-9.6.15-alpine}
|
||||||
ports:
|
ports:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue