Install Mattermost via Docker with nginx

Summary
I am getting 502 Bad Gateway error and fail to deploy Mattermost via Docker with nginx on a server hosted on my personal Mac Book Pro Monterey 12.6.1.

Steps to reproduce
I followed the steps from the Install Mattermost via Docker guide.
I created the certificates for MYDOMAIN = dionperd.ddns.net.
In creating the certificates by running

bash scripts/issue-certificate.sh -d $MYDOMAIN -o ${PWD}/certs

I got an error from Docker of not being able to access the folders where it should be able to write the certificates.

So, I had to go to Docker → Preferences → Resources and add the whole ~/opt/mattermost/docker folder to File Sharing.

Then, the certificates were issued as expected.

I uncommented and adapted the paths for the certificates into .env and tried to start the application with

sudo docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up -d

I got the above error in navigating to the dionperd.ddns.net in a Chrome browser.

Then, I copied the certificates into paths:

CERT_PATH=./volumes/web/cert/cert.pem
KEY_PATH=./volumes/web/cert/key-no-password.pem

and tried all different combinations of commenting either those two paths or the other two:

CERT_PATH=./certs/etc/letsencrypt/live/$MYDOMAIN/fullchain.pem
KEY_PATH=./certs/etc/letsencrypt/live/$MYDOMAIN/privkey.pem

or none of them, always with the same result, i.e., the same error.

Expected behavior
502 Bad Gateway when starting the app and navigating to $MYDOMAIN

I can upload my .env if you wish.

The db failed to start, this caused the app to fail, which causes the errors on the proxy.

Not sure exactly why the db failed, perhaps try building and starting only that. Then once the logs indicate it is good, start up the app, then the proxy.

I’ve never seen the read_only directive on a seevice before. Is your db supposed to be read only?