I want play with hubot-mattermost on my Mac, so I installed Mattermost with Docker (with the guide on the official site). I launch my container with
“docker run --name mattermost-preview -d --publish 8065:8065 mattermost/mattermost-preview”.
With this configuration, when I write something in my target channel, I have “Event POST failed, err=Post http://0.0.0.0:8065/hubot/incoming: address forbidden” in Mattermost logs on my container.
So I configured “Allow untrusted internal connections to:” in Mattermost with “0.0.0.0”. Now, I have no error in Mattermost logs.
So I can launch hubot with this configuration :
MATTERMOST_ENDPOINT=/hubot/incoming
MATTERMOST_INCOME_URL=http://localhost:8065/hooks/xxxxxxxxxxxxxxxxxx
EXPRESS_PORT=8065
MATTERMOST_TOKEN=xxxxxxxxxxxxxxx
and this command : bin/hubot --adapter mattermost
But I have this error in hubot logs :
[Tue May 01 2018 16:27:33 GMT+0200 (CEST)] ERROR Error: listen EADDRINUSE 0.0.0.0:8065
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at doListen (net.js:1517:7)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
I think it’s because the port 8065 is already used by Mattermost server (exposed in my docker container).
I don’t know how I should configure my Mattermost and my hubot properly.
Can someone help me please ?
And sorry for my English.
I don’t use mattermost-preview nor Hubot, but if you run a container using the --publish 8065:8065 option then your application (here the mattermost server) will bind the port 8065 on your host.
I’m not sure but I think your EXPRESS_PORT should be different than your Mattermost port. I guess that you need to choose another port for EXPRESS_PORT and change the callback URL of your Mattermost outgoing webhook with this port.
Hi, thanks for your reply. Yes, that’s I saw, the hubot start on the port 8081 for me now, and the problem is I can’t start hubot on the same port as exposed by docker. Finally, I installed hubot in the mattermost container. The problem is solved. Thank you pichouk.
I created a new Docker image by creating this Dockerfile :
FROM mattermost/mattermost-preview:latest
RUN apt-get update && apt-get upgrade -y
RUN apt-get install curl -y
RUN apt-get install sudo -y
RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
RUN apt-get install -y nodejs
RUN npm install -g yo generator-hubot && useradd hubot -m -s /bin/sh
USER hubot
WORKDIR /home/hubot
RUN echo no | yo hubot --owner=“Name mail@address.com” --name=“webhook-hubot” --description=“Hubot for mattermost webhooks” --adapter=mattermost &&
sed -i /heroku/d ./external-scripts.json && sed -i ‘/dependencies/a “coffee-script”: “^1.12.6”,’ ./package.json
USER root
WORKDIR /mm
ADD docker-entry.sh .
RUN chmod +x ./docker-entry.sh
ENTRYPOINT ./docker-entry.sh
Then launch your container, connect to it, and use a port different of 8065 to launch your hubot instance (with the EXPRESS_PORT environment variable). Configure the others hubot environment variable. Finally, you can configure your outgoing webhook in Mattermost with this callback url : http://localhost:{EXPRESS_PORT}/{MATTERMOST_ENDPOINT}
And there is no need for any more configuration or user creation in a different way? I don’t understand if everything is the same as you indicated because the bot doesn’t answer.