Cleanup docker-compose file
parent
977f7244a4
commit
64ec0daa23
|
@ -1,79 +1,81 @@
|
|||
# FARMBOT SERVICE LAYOUT
|
||||
#
|
||||
# ==========================================
|
||||
#
|
||||
# +--+ +-----+ +------+ +----+
|
||||
# |DB| |REDIS| |PARCEL| |MQTT|
|
||||
# +--+ +-----+ +------+ +----+
|
||||
# ^ ^ ^ ^
|
||||
# | | | |
|
||||
# +----------------------------+
|
||||
# | WEB |
|
||||
# +----------------------------+
|
||||
# ^ ^ ^
|
||||
# | | |
|
||||
# +-----------+ +-----------+ +-----------+
|
||||
# |DELAYED_JOB| |LOG_DIGESTS| |RABBIT_JOBS|
|
||||
# +-----------+ +-----------+ +-----------+
|
||||
#
|
||||
# ==========================================
|
||||
|
||||
version: '3.4'
|
||||
|
||||
x-db_user: &db_user
|
||||
depends_on: ["db", "redis"]
|
||||
|
||||
x-rails: &rails
|
||||
image: farmbot_web
|
||||
volumes:
|
||||
- .:/farmbot
|
||||
- ./docker_volumes/bundle_cache:/bundle
|
||||
|
||||
x-base_config: &base_config
|
||||
x-rails: &rails_service
|
||||
env_file: .env
|
||||
# restart: unless-stopped
|
||||
image: farmbot_web
|
||||
volumes: [".:/farmbot", "./docker_volumes/bundle_cache:/bundle"]
|
||||
|
||||
services:
|
||||
db:
|
||||
env_file: .env
|
||||
image: postgres
|
||||
volumes: ["./docker_volumes/db:/var/lib/postgresql/data"]
|
||||
|
||||
redis:
|
||||
<<: *base_config
|
||||
image: redis
|
||||
env_file: .env
|
||||
expose: ["6379"]
|
||||
image: redis
|
||||
volumes:
|
||||
- ./docker_volumes/redis/data:/data
|
||||
- ./docker_volumes/redis/conf:/usr/local/etc/redis
|
||||
ports: ["6379:6379"]
|
||||
db: # ====================
|
||||
<<: *base_config
|
||||
image: postgres
|
||||
volumes: ["./docker_volumes/db:/var/lib/postgresql/data"]
|
||||
web: # ====================
|
||||
<<: *base_config
|
||||
<<: *db_user
|
||||
<<: *rails
|
||||
|
||||
parcel:
|
||||
<<: *rails_service
|
||||
command: bundle exec rake api:serve_assets
|
||||
ports: ["3808"] # Parcel HMR Server
|
||||
|
||||
mqtt:
|
||||
build:
|
||||
context: ./docker_configs
|
||||
dockerfile: rabbitmq.Dockerfile
|
||||
env_file: .env
|
||||
environment: ["RABBITMQ_CONFIG_FILE=/farmbot/farmbot_rmq_config"]
|
||||
expose: ["15672"] # Management API (optional)
|
||||
ports: ["5672", "1883", "8883", "3002"]
|
||||
volumes: ["./docker_volumes/rabbit:/farmbot"]
|
||||
|
||||
web:
|
||||
<<: *rails_service
|
||||
depends_on: ["db", "redis", "mqtt"]
|
||||
stdin_open: true # Needed for binding.pry
|
||||
tty: true # Needed for binding.pry
|
||||
tty: true # Needed for binding.pry
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker_configs/api.Dockerfile
|
||||
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -e development -p 3000 -b 0.0.0.0"
|
||||
ports: ["3000:3000"] # Web / API
|
||||
mqtt: # ====================
|
||||
<<: *base_config
|
||||
build:
|
||||
context: ./docker_configs
|
||||
dockerfile: rabbitmq.Dockerfile
|
||||
ports:
|
||||
- "5672:5672" # AMQP (RabbitMQ)
|
||||
- "1883:1883" # MQTT
|
||||
- "8883:8883" # MQTT over TLS/SSL
|
||||
- "3002:15675" # MQTT over WebSockets
|
||||
- "15672:15672" # Management API
|
||||
|
||||
delayed_job:
|
||||
<<: *rails_service
|
||||
depends_on: ["web"]
|
||||
environment:
|
||||
- RABBITMQ_CONFIG_FILE=/farmbot/farmbot_rmq_config
|
||||
volumes:
|
||||
- ./docker_volumes/rabbit:/farmbot
|
||||
typescript:
|
||||
<<: *base_config
|
||||
<<: *rails
|
||||
depends_on: ["parcel"]
|
||||
command: node_modules/typescript/bin/tsc -w --noEmit
|
||||
parcel: # ====================
|
||||
<<: *base_config
|
||||
<<: *rails
|
||||
depends_on: ["db","mqtt", "web"]
|
||||
command: bundle exec rake api:serve_assets
|
||||
ports: ["3808:3808"] # Parcel HMR Server
|
||||
delayed_job: # ====================
|
||||
<<: *base_config
|
||||
<<: *rails
|
||||
depends_on: ["db","mqtt", "web"]
|
||||
command: bundle exec rake jobs:work
|
||||
log_digests: # ====================
|
||||
<<: *base_config
|
||||
<<: *rails
|
||||
<<: *db_user
|
||||
|
||||
log_digests:
|
||||
<<: *rails_service
|
||||
depends_on: ["web"]
|
||||
command: bundle exec rake api:log_digest
|
||||
rabbit_jobs: # ====================
|
||||
<<: *base_config
|
||||
<<: *rails
|
||||
depends_on: ["db","mqtt"]
|
||||
|
||||
rabbit_jobs:
|
||||
<<: *rails_service
|
||||
depends_on: ["web"]
|
||||
command: bundle exec rails r lib/rabbit_workers.rb
|
||||
|
|
Loading…
Reference in New Issue