Fix for when webpack runs outside of docker. Requires `npm run webpack` instead of `rake api:webpack`.

pull/1006/head
Rick Carlino 2018-10-05 13:58:27 -05:00
parent e8e8f4e52f
commit 5e976c0189
3 changed files with 3 additions and 7 deletions

View File

@ -17,7 +17,7 @@ module FarmBot
config.active_job.queue_adapter = :delayed_job
config.action_dispatch.perform_deep_munge = false
I18n.enforce_available_locales = false
LOCAL_API_HOST = ENV["API_HOST"] || "localhost"
LOCAL_API_HOST = ENV.fetch("API_HOST", "webpack")
WEBPACK_URL = "http://#{LOCAL_API_HOST}:3808"
config.webpack.dev_server.host = proc { request.host }
# PROBLEM: Containers run in docker. Default dev_server.manifest_host is
@ -26,7 +26,7 @@ module FarmBot
# SOLUTION: Explicitly set the hostname of the container where Webpack runs.
# In our case, that's `webpack`. See docker-compose.yml for all
# hostnames. -RC 1 OCT 18
config.webpack.dev_server.manifest_host = "webpack"
config.webpack.dev_server.manifest_host = LOCAL_API_HOST
config.webpack.dev_server.manifest_port = 3808
config.generators do |g|
g.template_engine :erb

View File

@ -50,6 +50,7 @@ services:
<<: *rails
depends_on: ["db","mqtt"]
command: bundle exec rake jobs:work
restart: "always"
log_digests: # ====================
<<: *rails
<<: *db_user

View File

@ -111,11 +111,6 @@ namespace :api do
sh "sudo docker-compose up --scale webpack=0"
end
desc "Run Webpack _ONLY_. No other services"
task webpack: :environment do
sh "sudo docker-compose run webpack npm run webpack"
end
desc "Pull the latest Farmbot API version"
task(update: :environment) { same_thing }