(I’ve tagged this unsupported-install but would appreciate guru input regardless )
Guys, I’m trying to run a basic Discourse image in a simple-ish(?) multi docker container setup via Docker Compose.
Here’s the basics:
- The forum is living in a subfolder, lets call it
/board
, so (https://blah.com/board
) - nginx is passing calls to
/board:443
tolocalhost:4000
. - Discourse rails was running on port 4000 (because 3000 is being used by something else)
- included in the Rails ENVs is a crucial setting which sets this up to work:
DISCOURSE_RELATIVE_URL_ROOT: “/board”
Now I’ve updated the version of Discourse (pre Ember-CLI) and things are no longer working.
So, of course, I add a container for Ember-CLI which runs:
discourse-ember:
command: bin/ember-cli --port 4000 --proxy "http://localhost:4200"
So Ember is now handling the calls coming in on 4000 in the first instance.
I move Discourse rails container to port 4200 and kick things off.
First the good news:
- curling the dev site works!
Now the bad news:
-
Doesn’t work in browser, why?:
because it’s apparently trying to reach Discourse but requesting:
/bootstrap.json
giving the error:
Discourse Ember CLI Proxy Error
Error: Could not get http://0.0.0.0:4200/bootstrap.json
FetchError: invalid json response body at http://0.0.0.0:4200/bootstrap.json?for_url=%2Fboard reason: Unexpected token N in JSON at position 0
instead of
/board/bootstrap.json
(which returns data).
If instead I use this config:
discourse-ember:
command: bin/ember-cli --port 4000 --proxy "http://0.0.0.0:4200/forum"
I get a Rails error:
Routing Error
No route matches [GET] "/forum"
Yet not a few lines away, it provides me with:
bootstrap_path GET /bootstrap(.:format)
bootstrap#index {:format=>/(json|html|\*\/\*)/}
Which is exactly the path I was trying to reach?
How do I make Ember smart enough to proxy to the subfolder when it’s trying to get the bootstrap info?, ie:
http://0.0.0.0:4200/forum/bootstrap.json
Remember, in this instance, Ember is running in its own container.