Need some help ironing stack configuration docker Mattermost ChatGPT

Hi Community,

I am currently running the following:

  • Ubuntu 22.0.4.3 Jammy
  • Docker
  • Portainer CE 2.19.1
  • NGinX pointing to point 8065

My docker stack file consists of:

  • mattermost:
    image: mattermost/mattermost-team-edition:latest
  • db:
    image: postgres:latest
  • chatgpt-bot:
    image: blackvoidclub/chatgpt-mattermost-bot:latest

I am getting the following error in my Mattermost console log:

WRN app/plugin_api.go:983 > timestamp=2023-09-29 14:41:36.055 Z msg=failed to get public IP address for local interface plugin_id=com.mattermost.calls origin=main.(*logger).Warn log.go:99 localAddr=127.0.0.1 error=failed to get public address: write udp4 127.0.0.1:8443->52.72.139.62:3478: sendto: invalid argument

And then in my ChatGPT console log I get this:

2023-09-29T14:41:33.751Z INFO name=bot-ws msg=websocket connecting to wss://RemovedForPrivacy/api/v4/websocket pid=1 hostname=da2a872b12a7 diff=0
/app/node_modules/@mattermost/client/lib/client4.js:1765
throw new ClientError(this.getUrl(), {
^
ClientError: Received invalid response from the server.
at Client4. (/app/node_modules/@mattermost/client/lib/client4.js:1765:23)
at Generator.throw ()
at rejected (/app/node_modules/@mattermost/client/lib/client4.js:8:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
url: ‘https://RemovedForPrivacy/api/v4/users/me’,
server_error_id: undefined,
status_code: undefined
}
2023-09-29T14:41:36.692Z INFO name=bot-ws msg=websocket connecting to wss://RemovedForPrivacy/api/v4/websocket pid=1 hostname=da2a872b12a7 diff=0
2023-09-29T14:41:36.727Z INFO name=bot-ws msg=websocket error pid=1 hostname=da2a872b12a7 diff=35
2023-09-29T14:41:36.727Z INFO name=bot-ws pid=1 hostname=da2a872b12a7 diff=0
2023-09-29T14:41:36.728Z INFO name=bot-ws msg=websocket closed pid=1 hostname=da2a872b12a7 diff=1
2023-09-29T14:41:36.729Z ERROR name=bot pid=1 hostname=da2a872b12a7 diff=0
2023-09-29T14:41:41.658Z INFO name=bot-ws msg=websocket connecting to wss://mattermost.gewspecmon.co.za/api/v4/websocket pid=1 hostname=da2a872b12a7 diff=0

I would appreciate any help or guidance. Any pointers on missing config in stack would help.

Thankyou to anyone willing to help and speculate.

See full stack below:

version: ‘3’

services:
mattermost:
image: mattermost/mattermost-team-edition:latest
container_name: mattermost
volumes:
- mattermost_data:/mattermost/data
- mattermost_config:/mattermost/config
- mattermost_logs:/mattermost/logs
- mattermost_plugins:/mattermost/plugins
environment:
- MM_USERNAME=RemovedForPrivacy
- MM_PASSWORD=RemovedForPrivacy
- MM_SITEURL=RemovedForPrivacy
- MM_SQLSETTINGS_DRIVERNAME=postgres
- MM_SQLSETTINGS_DATASOURCE=postgres://RemovedForPrivacy:RemovedForPrivacy@db:5432/mattermost?sslmode=disable&connect_timeout=10
- MM_EMAILSETTINGS_SMTPSERVER=mail.RemovedForPrivacy
- MM_EMAILSETTINGS_SENDERADDRESS=RemovedForPrivacy
ports:
- “8065:8065”
healthcheck:
test: [“CMD”, “curl”, “–fail”, “http://localhost:8065/”]
interval: 30s
timeout: 10s
retries: 5
logging:
driver: “json-file”
options:
max-size: “10m”
max-file: “7”
# … other configurations …
depends_on:
- chatgpt-bot
- db
restart: always

db:
image: postgres:latest
container_name: mattermost_db
volumes:
- mattermost_db_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=RemovedForPrivacy
- POSTGRES_PASSWORD=RemovedForPrivacy
- POSTGRES_DB=mattermost
ports:
- “5432:5432”
restart: always

chatgpt-bot:
image: blackvoidclub/chatgpt-mattermost-bot:latest
container_name: chatgpt-bot
environment:
- MATTERMOST_URL=https://RemovedForPrivacy
- MATTERMOST_TOKEN=RemovedForPrivacy
- OPENAI_API_KEY=sk-RemovedForPrivacy
restart: always

volumes:
mattermost_data:
driver: local
mattermost_config:
driver: local
mattermost_logs:
driver: local
mattermost_db_data:
driver: local
mattermost_plugins:
driver: local


Hi Crimzin69,

Welcome to the Mattermost community forums!

Based on the error messages you provided, it seems that there are a few issues in your setup. Let’s go through them one by one:

  1. Error in Mattermost console log: The warning message you received indicates that Mattermost failed to get the public IP address for the local interface. This warning is typically harmless and shouldn’t cause any major issues.
  2. Error in ChatGPT console log: The error message suggests that the ChatGPT bot is receiving an invalid response from the Mattermost server. This could be due to incorrect configuration or connectivity issues between the bot and the Mattermost server. Here are a few things to check:
  • Ensure that the MATTERMOST_URL environment variable in your chatgpt-bot service is set correctly. It should match the URL where Mattermost is accessible.
  • Verify that the MATTERMOST_TOKEN environment variable is set correctly. It should contain a valid token for the bot user in Mattermost.
  • Check if there are any network or firewall restrictions that might be preventing the bot from connecting to the Mattermost server.
  1. Missing configuration: From the provided stack file, it seems that you haven’t defined the networks section. It’s recommended to define a network for your services to ensure proper communication between them. Add the following section to your stack file:
networks:
  - mattermost-net

Then, update the services section of each service to include the network configuration:

services:
  mattermost:
    networks:
      - mattermost-net
    ...
  db:
    networks:
      - mattermost-net
    ...
  chatgpt-bot:
    networks:
      - mattermost-net
    ...

Finally, add the following section at the end of the stack file to define the network:

networks:
  mattermost-net:

Make sure to apply these changes to your stack file, and then redeploy the stack using Docker Compose. This should help resolve the issues you’re facing. Let me know if you have any further questions or need additional assistance!

Best regards,
~Matterbot 2.0 :robot:

[Disclaimer: This was an AI assisted response powered by ChatGPT. Were any of the above suggestions inaccurate? Let us know by replying to this comment!]