Never mind! I figured out that issue. I had the environment set to development.
I couldnāt figure out how to download the Gem into the container.
You need to:
-
add the entry to the
Gemfile
, eg: add agem "rails"
entry to installrails
. -
run
sudo docker-compose run web bundle install
. -
Restart all containers
When I disable the variable, I have a browser call to wss://my-domain.com:3002/ws (but of course no answer)
I am unsure of this one and donāt have time to investigate, unfortunately. Perhaps you need to change the ws://
to wss://
when FORCE_SSL
is enabled?
Hereās how we do it in a production settings (on Heroku, not Docker):
# Notice, no `mqtt://` protocol specifier here
MQTT_HOST=foo.bar.com
# This will be system specific. The default is "/"
MQTT_VHOST=xyz
# This value is copy/pasted by the web app.
# Notice I added a protocol specifier and port number.
MQTT_WS=wss://foo.bar.com:443/ws/mqtt
Thanks @RickCarlino
Hereās what Iām going to try for the reverse-proxy and RabbitMQ:
Seems simple enough, but you know how this goes!
Thanks,
Steve
When I put wss:// the browser does the get request for a websocket again. So I think itās not possible to force https for the web application and to use ws:// at the same time.
I am unsure of this one and donāt have time to investigate
I donāt know if itās a rule in the browser or something in the ruby application. Donāt lose your time on this, I will setup wss:// for Rabbit
I just got HaProxy working for the RabbitMQ. The problem Iām having right now is Iām getting content security errors in the browser so it doesnāt work on the site of course but it is secure. Any idea how I can get around that? Iām using the same root domain for both servers. I thought that was the only thing would affect CSP. Maybe something else Iām missing?
Thanks!
I just got HaProxy working for the RabbitMQ.
This is great news! Congratulations! I hope you can share your steps with the community once we figure out the CSP issues.
RE: CSP problems- I think you probably are missing (or misconfigured) one of the following ENV vars.
I have provided example values after the #
character.
Does this look similar on your end?
API_HOST # => "foo.bar.org"
MQTT_HOST # => "foo.bar.org"
EXTRA_DOMAINS # => "foo.bar.org" (probably not required- comman seperated list of all domains)
API_PORT # => "443"
FORCE_SSL # => "true"
Please let me know and if not, can keep investigating.
quote=āRickCarlino, post:26, topic:6151ā]
This is great news! Congratulations! I hope you can share your steps with the community once we figure out the CSP issues.
[/quote]
Absolutely. However, I think I broke it I was trying to fix the CSP issues and now Iām getting an error in the browser console that is saying: āfailed: Connection closed before receiving a handshake responseā so I have to figure out what I did to cause that.
But I think Iām close.
I also found another method to do this without the reverse-proxy which is along the lines of what @Pitou is doing but I have to figure out how to edit your RabbitMQ config file within the Docker container. Docker is relatively new to me.
@stre1026 I might be able to help. At one point, FarmBot had a script that would generate the RabbitMQ config at startup, based on .env
files.
I want to see if I can get the reverse proxy working because Iām invested now butā¦
Is there a quick crash course on how to edit the config file in the Docker image you have?
Hereās an odd one: Iām getting this error now:
client.js:1076 Uncaught Error: Connection refused: Bad username or password
at _._handleConnack (client.js:1076)
at _._handlePacket (client.js:365)
at d (client.js:283)
at g.n._write (client.js:294)
at m (_stream_writable.js:428)
at _ (_stream_writable.js:417)
at g.write (_stream_writable.js:334)
at _.f (_stream_readable.js:619)
at _.o.emit (events.js:152)
at S (_stream_readable.js:291)
Any idea why this would happen after going through the HAProxy? I donāt think itās requesting credentialsā¦
@stre1026 A few things:
- Not sure whatās going on with that error. It would be good to post your work onto Github (with build instructions in the README.md file) and I can take a look when I have time. In the meantime, I would try to completely log out and log back in to see if that helps.
- Editing the RabbitMQConfig happens in this file. It is basically Ruby code that dynamically generates the RabbitMQ config before the application starts. CC: @Pitou You will need to write some Ruby to make this work. Is this what you were looking for?
Thanks for your help as always!
I honestly havenāt modified much code at all. Iāve only changed the .env file and I changed the docker-compose.yml file. Thatās it. Iām still running into the CSP issues on one browser but the socket appears to come up security now. Itās still not working due to that login issue which is odd but Iāll get there.
I appreciate the help with the rabbitMQ config. I will check that out. I just need to add some variables to the config so it looks like you pretty much have that outlined in there alreadyā¦
Iāll report back when I have more time to work on this. The weather is supposed to be beautiful this weekend in the Northeast so Iām hoping to actually get outside and start assembling the Farmbot!