OnlyOffice 502 Bad Gateway when attempting to connect to documentserver docker from Nextcloud

I’m running Nextcloud (31.0.0) and documentserver as docker containers. Both on my LAN (192.168.x.xxx:port) and on the open internet (https://documentserver.my.domain), I can connect to the /welcome subfolder, but not the /healthcheck subfolder.

I’m getting a very similar error to OnlyOffice 502 Bad Gateway error when attempting to connect from Nextcloud reported in Nextcloud:

 ServerException Server error: `GET https://documentserver.vibraphone.one/healthcheck` resulted in a `502 Bad Gateway` response: <html> <head><title>502 Bad Gateway</title></head> <body> <center><h1>502 Bad Gateway</h1></center> <hr><center>ngin (truncated...)
healthcheckRequest on check error 
  1. Logs: https://www.mediafire.com/file/8pxk4kc40a8vwwr/logs.zip/file
  2. default.json and local.json: https://www.mediafire.com/file/d3tji1v2cbse1nq/local.json/file https://www.mediafire.com/file/fgkrsomebwv444o/default.json/file

My documentserver stack in Portainer:

---
version: "2"
services:
    documentserver:
        image: onlyoffice/documentserver
        container_name: documentserver
        environment:
          - JWT_SECRET=redacted
          - PUID=1000
          - PGID=100
          - TZ=Europe/Berlin
          - LANG=en_GB.UTF-8
          - LANGUAGE=en_GB:en
          - LC_ALL=en_GB.UTF-8

        restart: always
        ports:
            - 5025:80
        labels:
            - deunhealth.restart.on.unhealthy=true
        volumes:
            - /srv/redacted/config1/onlyoffice/logs:/var/log/onlyoffice
            - /srv/redacted/config1/onlyoffice/Data:/var/www/onlyoffice/Data
            - /srv/redacted/config1/onlyoffice/lib:/var/lib/onlyoffice
            - /srv/redacted/config1/onlyoffice/db:/var/lib/postgresql
            - /srv/redacted/config1/onlyoffice/redis:/var/lib/redis
            - /srv/redacted/config1/onlyoffice/font:/usr/share/fonts/truetype/custom:rw
            - /srv/redacted/config1/onlyoffice/rabbitmq:/var/lib/rabbitmq

networks:
  default:
    name: redacted_default
    external: true

Hello @user-of-file,
Please do the following:

  1. Check the status of PostgreSQL with a command service postgresql status (inside the container)
  2. Try to connect to the database from inside the container using the default ‘onlyoffice’ password (psql -u onlyoffice), check if the password works
    The issue seems to be connected with Postgresql database password

Thank you - here you go:

root@75c82f68874a:/# service postgresql status
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_GB:en",
	LC_ALL = "en_GB.UTF-8",
	LC_TIME = "",
	LC_CTYPE = "",
	LC_MONETARY = "",
	LC_COLLATE = "",
	LC_ADDRESS = "",
	LC_TELEPHONE = "",
	LC_MESSAGES = "",
	LC_NAME = "",
	LC_MEASUREMENT = "",
	LC_IDENTIFICATION = "",
	LC_NUMERIC = "",
	LC_PAPER = "",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
16/main (port 5432): online
root@75c82f68874a:/# 

Do you mean i should run psql -u onlyoffice directly from inside the documentserver container? It returns a syntax error:

root@75c82f68874a:/# psql -u onlyoffice 
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_GB:en",
	LC_ALL = "en_GB.UTF-8",
	LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/usr/lib/postgresql/16/bin/psql: invalid option -- 'u'
psql: hint: Try "psql --help" for more information.