502 Bad Gateway

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.