502 Bad Gateway

I installed Mattermost from GitHub - mattermost/mattermost-docker: Deprecated

Steps

sudo apt-get install git
sudo apt-get install docker-composer

git clone GitHub - mattermost/mattermost-docker: Deprecated
cd mattermost-docker
docker-compose build
mkdir -pv ./volumes/app/mattermost/{data,logs,config,plugins,client-plugins}
chown -R 2000:2000 ./volumes/app/mattermost/
docker-compose up -d

But when I go to the host: 502 Bad Gateway

Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:57:21 2018
OS/Arch: linux/arm
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:17:57 2018
OS/Arch: linux/arm
Experimental: false

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0984a6898519 mattermostdocker_web “/entrypoint.sh” 2 minutes ago Up 2 minutes (unhealthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp mattermostdocker_web_1
6dee4e5ca3c9 mattermostdocker_db “/entrypoint.sh post…” 2 minutes ago Up 2 minutes (healthy) 5432/tcp mattermostdocker_db_1
a3b6cce8dbf1 mattermostdocker_app “/entrypoint.sh matt…” 2 minutes ago Restarting (2) 37 seconds ago mattermostdocker_app_1

docker logs -f mattermostdocker_app_1

/mattermost/bin/mattermost: line 4: syntax error: unexpected “(”
Using existing config file /mattermost/config/config.json
Configure database connection…OK
Starting mattermost
/mattermost/bin/mattermost: line 1: ELF: not found
/mattermost/bin/mattermost: line 2: @%: not found
/mattermost/bin/mattermost: line 1: ��: not found
/mattermost/bin/mattermost: line 3: ����o���@Z
��@�
�@�@��@��@�@h�
�����@8: not found
/mattermost/bin/mattermost: line 4: syntax error: unexpected “(”

@pichouk ^ Let me know if this is something you can help take a look.

It seems there is an issue with the Mattermost binary. I don’t know why, the Docker image just download a binary from Mattermost servers.

Maybe you can try to rebuild the Docker image ?

I repeated the process and rebuild docker image, but it result same.

Can you help me to debug the error? @pichouk

thanks @amy.blais :slight_smile:

I just tried to build a fresh Mattermost image and it works. I don’t know why your Mattermost binary is not working. Did you add a specific configuration to your docker-compose.yml file ? What is the OS of your computer/server ?

OS: Raspbian

docker-compose.yml:

Version: “2”

services:

db:
build: db
read_only: true
restart: unless-stopped
volumes:
- ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
environment:
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
# uncomment the following to enable backup
# - AWS_ACCESS_KEY_ID=XXXX
# - AWS_SECRET_ACCESS_KEY=XXXX
# - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH
# - AWS_REGION=us-east-1

app:
build:
context: app
# uncomment following lines for team edition or change UID/GID
args:
- edition=team
# - PUID=1000
# - PGID=1000
restart: unless-stopped
volumes:
- ./volumes/app/mattermost/config:/mattermost/config:rw
- ./volumes/app/mattermost/data:/mattermost/data:rw
- ./volumes/app/mattermost/logs:/mattermost/logs:rw

  • ./volumes/app/mattermost/plugins:/mattermost/plugins:rw
    • ./volumes/app/mattermost/client-plugins:/mattermost/client/plugins:rw
    • /etc/localtime:/etc/localtime:ro
      environment:

    set same as db credentials and dbname

    • MM_USERNAME=mmuser
    • MM_PASSWORD=mmuser_password
    • MM_DBNAME=mattermost

    in case your config is not in default location

    #- MM_CONFIG=/mattermost/config/config.json

web:
build: web
ports:
- “80:80”
- “443:443”
read_only: true
restart: unless-stopped
volumes:
# This directory must have cert files if you want to enable SSL
- ./volumes/web/cert:/cert:ro
- /etc/localtime:/etc/localtime:ro
# Uncomment for SSL
# environment:
# - MATTERMOST_ENABLE_SSL=true

Ok, nothing special. I don’t know, maybe someone who know better the way Mattermost binary is build could help. But I am not able to reproduce and this error does not mean anything to me.

Oh I get it ! Someone came on Github with a similar issue, because he is using a Raspberry PI. I noticed that you are using an ARM version of Docker, so I assume you are running on an ARM device. The Mattermost Docker image is using the AMD64 binary.

I’m not sure Mattermost is working on ARM, maybe someone from the development team could answer on this.

Raspbian is 32-bit, at present. If you want a 64-bit OS on a Raspberry Pi, try BalenaOS instead. It’s especially suited to running 64-bit docker containers on the Raspberry Pi.

Unfortunately the difference in architecture between ARM and x86 is bigger than the memory address length (32 or 64 bit). You could try to cross-compile Mattermost for ARM, theoretically, but it’s not something that is supported, so I have no idea if that’s something that would succeed or not. With BalenaOS or not, however, you will not be able to execute the regular Mattermost binary.