Bad Gateway when uploading documents

When things don't work as they should.
Post Reply
inka
Posts: 3
Joined: Thu Mar 12, 2020 10:12 pm

Bad Gateway when uploading documents

Post by inka »

Hi all,

I've just installed Mayan via Docker and trying to upload documents with the admin account. All uploads are failing after some time and when I mover the mouse pointer over the document a "Bad Gateway" pop up appears.

I created a new user but the "New document" action is disabled for him and I have no idea how to enable it. In any case I'm sure that I have create a non root user for my docker volumes to work properly.

Any idea why the "Bad Gateway"?
How can enable uploading of documents for normal user?

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Bad Gateway when uploading documents

Post by rssfed23 »

You can enable the uploading of documents for a normal user by granting them the right ACLs/permissions (either across the whole platform or for the specific document type you want them to have permissions at). Usually we'd recommend creating a group, and a role (with the right ACLs) and then add the role to the group and put the user in the group. All of that is in the settings menu, but it is a separate issue from the bad gateway error.

The bad gateway error is a bit of an odd one - I've not come across it before personally. Docker volumes need the correct permissions for the user in the docker container to read/write to them. This is usually a bit tricky as the UIDs may not match from within the container to the underlying storage, and is by far a problem unique to mayan as it applies across the docker ecosystem. Checking the permissions is a good first step. If it's a new system, you can chown the mounted folder (and all subfolders with -R) to ubuntu:ubuntu as we run Mayan with uid 1000 from memory (if there's no ubuntu user chown to user/group 1000:1000). Would be helpful if you could get us the logs from the container at the time the upload is happening/just after as well (docker logs <containername> )
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

inka
Posts: 3
Joined: Thu Mar 12, 2020 10:12 pm

Re: Bad Gateway when uploading documents

Post by inka »

@rssfed23: Thanks for the quick response!
This is what I see with systemctl:

Code: Select all

Mar 12 23:35:37 homelabos docker-compose[2290]: mayan-edms_1  | [2020-03-12 23:35:37,984: ERROR/MainProcess] beat: Connection error: [Errno 111] Connection refused. Trying again in 32.0 seconds...
Mar 12 23:35:41 homelabos docker-compose[2290]: mayan-edms_1  | [2020-03-12 23:35:41,134: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
Mar 12 23:35:41 homelabos docker-compose[2290]: mayan-edms_1  | Trying again in 32.00 seconds...
Mar 12 23:35:41 homelabos docker-compose[2290]: mayan-edms_1  |
Mar 12 23:35:42 homelabos docker-compose[2290]: mayan-edms_1  | [2020-03-12 23:35:42,785: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
Mar 12 23:35:42 homelabos docker-compose[2290]: mayan-edms_1  | Trying again in 32.00 seconds...
Mar 12 23:35:42 homelabos docker-compose[2290]: mayan-edms_1  |
Mar 12 23:35:43 homelabos docker-compose[2290]: mayan-edms_1  | [2020-03-12 23:35:43,930: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
Mar 12 23:35:43 homelabos docker-compose[2290]: mayan-edms_1  | Trying again in 32.00 seconds...
Mar 12 23:35:43 homelabos docker-compose[2290]: mayan-edms_1  |
I'll try to investigate deeper.
BTW I've installed Mayan via HomeLabOS.

inka
Posts: 3
Joined: Thu Mar 12, 2020 10:12 pm

Re: Bad Gateway when uploading documents

Post by inka »

Some more logs of one container:

Code: Select all

2020-03-13T00:19:34.453587811Z     interval = self.scheduler.tick()
2020-03-13T00:19:34.453596346Z   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/beat.py", line 312, in tick
2020-03-13T00:19:34.453605420Z     self.apply_entry(entry, producer=self.producer)
2020-03-13T00:19:34.453730148Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/utils/objects.py", line 44, in __get__
2020-03-13T00:19:34.453740181Z     value = obj.__dict__[self.__name__] = self.__get(obj)
2020-03-13T00:19:34.453748797Z   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/beat.py", line 450, in producer
2020-03-13T00:19:34.453757927Z     return self.Producer(self._ensure_connected(), auto_declare=False)
2020-03-13T00:19:34.453766662Z   File "/opt/mayan-edms/lib/python3.7/site-packages/celery/beat.py", line 434, in _ensure_connected
2020-03-13T00:19:34.453775842Z     _error_handler, self.app.conf.broker_connection_max_retries
2020-03-13T00:19:34.453784462Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 430, in ensure_connection
2020-03-13T00:19:34.453793712Z     callback, timeout=timeout)
2020-03-13T00:19:34.453802189Z   File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
2020-03-13T00:19:34.453811136Z     self.gen.throw(type, value, traceback)
2020-03-13T00:19:34.453819686Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 444, in _reraise_as_library_errors
2020-03-13T00:19:34.453829018Z     sys.exc_info()[2])
2020-03-13T00:19:34.453837546Z   File "/opt/mayan-edms/lib/python3.7/site-packages/vine/five.py", line 194, in reraise
2020-03-13T00:19:34.453846634Z     raise value.with_traceback(tb)
2020-03-13T00:19:34.453855261Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 439, in _reraise_as_library_errors
2020-03-13T00:19:34.453864501Z     yield
2020-03-13T00:19:34.453874839Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 430, in ensure_connection
2020-03-13T00:19:34.453884230Z     callback, timeout=timeout)
2020-03-13T00:19:34.453892943Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/utils/functional.py", line 344, in retry_over_time
2020-03-13T00:19:34.453902157Z     return fun(*args, **kwargs)
2020-03-13T00:19:34.453910880Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 283, in connect
2020-03-13T00:19:34.453919896Z     return self.connection
2020-03-13T00:19:34.453937032Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 839, in connection
2020-03-13T00:19:34.453946774Z     self._connection = self._establish_connection()
2020-03-13T00:19:34.453955449Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/connection.py", line 794, in _establish_connection
2020-03-13T00:19:34.453964594Z     conn = self.transport.establish_connection()
2020-03-13T00:19:34.453973261Z   File "/opt/mayan-edms/lib/python3.7/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
2020-03-13T00:19:34.453982429Z     conn.connect()
2020-03-13T00:19:34.453991058Z   File "/opt/mayan-edms/lib/python3.7/site-packages/amqp/connection.py", line 311, in connect
2020-03-13T00:19:34.454000066Z     self.transport.connect()
2020-03-13T00:19:34.454008655Z   File "/opt/mayan-edms/lib/python3.7/site-packages/amqp/transport.py", line 77, in connect
2020-03-13T00:19:34.454017734Z     self._connect(self.host, self.port, self.connect_timeout)
2020-03-13T00:19:34.454026498Z   File "/opt/mayan-edms/lib/python3.7/site-packages/amqp/transport.py", line 148, in _connect
2020-03-13T00:19:34.454035547Z     "failed to resolve broker hostname"))
2020-03-13T00:19:34.454044294Z   File "/opt/mayan-edms/lib/python3.7/site-packages/amqp/transport.py", line 161, in _connect
2020-03-13T00:19:34.454053310Z     self.sock.connect(sa)
2020-03-13T00:19:34.454061897Z kombu.exceptions.OperationalError: [Errno 111] Connection refused
2020-03-13T00:19:35.243259548Z 2020-03-13 00:19:35,242 INFO exited: mayan-celery-beat (exit status 1; not expected)
2020-03-13T00:25:22.169051149Z [2020-03-13 00:25:22 +0000] [33] [CRITICAL] WORKER TIMEOUT (pid:125)
2020-03-13T00:25:22.172868541Z [2020-03-13 00:25:22 +0000] [125] [INFO] Worker exiting (pid: 125)
2020-03-13T00:25:23.202226587Z [2020-03-13 00:25:23 +0000] [135] [INFO] Booting worker with pid: 135
2020-03-13T00:35:55.906647079Z [2020-03-13 00:35:55 +0000] [115] [INFO] Autorestarting worker after current request.
2020-03-13T00:35:56.386110269Z [2020-03-13 00:35:56 +0000] [115] [INFO] Worker exiting (pid: 115)
2020-03-13T00:35:57.561314697Z [2020-03-13 00:35:57 +0000] [145] [INFO] Booting worker with pid: 145
2020-03-13T00:54:46.039156148Z [2020-03-13 00:54:46 +0000] [33] [CRITICAL] WORKER TIMEOUT (pid:135)
2020-03-13T00:54:46.043509227Z [2020-03-13 00:54:46 +0000] [135] [INFO] Worker exiting (pid: 135)
2020-03-13T00:54:47.072534261Z [2020-03-13 00:54:47 +0000] [155] [INFO] Booting worker with pid: 155

User avatar
rssfed23
Moderator
Moderator
Posts: 213
Joined: Mon Oct 14, 2019 1:18 pm
Location: United Kingdom
Contact:

Re: Bad Gateway when uploading documents

Post by rssfed23 »

That error usually occurs because of incorrect environment variables being passed in.
Are you using RabbitMQ? - as Mayan is trying to connect to a Rabbit instance. If you're only using redis, then the BROKER_URL environment variable is likely the culprit (we see this issue a lot).

How are you starting Mayan up? Can you share your docker run command or your docker-compose.yml file.
Please bear with us during the current global situation. The team all have families and local communities to look after as well as the community here. Responses may be delayed during this time, but rest assured we will get to your query eventually.

Post Reply