502 Bad Gateway, seahub doesn't run

seafile 6.2.3 on ubuntu 18.04

When I visit the website from my seafile server, only “502 Bad Gateway nginx/1.14.0 (Ubuntu)” is shown. I have checked the server and found out that seahub does not start anymore. In syslog the following information for “(seafile|seahub)” is shown (after a reboot):

Oct 28 16:42:25 Seafile seafile.sh[1021]: [10/28/19 16:42:25] …/common/session.c(132): using config file /opt/seafile/conf/ccnet.conf
Oct 28 16:42:25 Seafile seafile.sh[1021]: Starting seafile server, please wait …
Oct 28 16:42:25 Seafile seafile-controller[1058]: seafile-controller.c(154): starting ccnet-server …
Oct 28 16:42:25 Seafile seafile-controller[1058]: seafile-controller.c(73): spawn_process: ccnet-server -F /opt/seafile/conf -c /opt/seafile/ccnet -f /opt/seafile/logs/ccnet.log -d -P /opt/seafile/pids/cc
Oct 28 16:42:25 Seafile seafile-controller[1058]: seafile-controller.c(88): spawned ccnet-server, pid 1059
Oct 28 16:42:26 Seafile seafile-controller[1060]: seafile-controller.c(555): ccnet daemon connected.
Oct 28 16:42:26 Seafile seafile-controller[1060]: seafile-controller.c(186): starting seaf-server …
Oct 28 16:42:26 Seafile seafile-controller[1060]: seafile-controller.c(73): spawn_process: seaf-server -F /opt/seafile/conf -c /opt/seafile/ccnet -d /opt/seafile/seafile-data -l /opt/seafile/logs/seafile.
Oct 28 16:42:26 Seafile seafile-controller[1060]: seafile-controller.c(88): spawned seaf-server, pid 1063
Oct 28 16:42:26 Seafile seafile-controller[1060]: seafile-controller.c(528): seafdav not enabled.
Oct 28 16:42:26 Seafile seaf-server[1064]: …/common/mq-mgr.c(54): [mq client] mq cilent is started
Oct 28 16:42:26 Seafile seaf-server[1064]: listen-mgr.c(120): listen on port 12001 for block tranfer
Oct 28 16:42:27 Seafile seaf-server[1064]: size-sched.c(96): Repo size compute queue size is 0
Oct 28 16:42:28 Seafile seafile.sh[1021]: Seafile server started
Oct 28 16:42:28 Seafile seafile.sh[1021]: Done.
Oct 28 16:42:28 Seafile seahub.sh[1079]: LC_ALL is not set in ENV, set to en_US.UTF-8
Oct 28 16:42:28 Seafile seahub.sh[1079]: Starting seahub at port 8000 …
Oct 28 16:42:33 Seafile seahub.sh[1079]: #033[33mError:Seahub failed to start.#033[m
Oct 28 16:42:33 Seafile seahub.sh[1079]: Please try to run “./seahub.sh start” again
Oct 28 16:42:33 Seafile systemd[1]: seahub.service: Main process exited, code=exited, status=1/FAILURE
Oct 28 16:42:33 Seafile systemd[1]: seahub.service: Failed with result ‘exit-code’.

This is /etc/nginx/sites-enabled/seafile.conf:

server {
listen 8443;
server_name seafile.mydomain;

proxy_set_header X-Forwarded-For $remote_addr;

location / {
     proxy_pass         http://127.0.0.1:8000;
     proxy_set_header   Host $host:$server_port;
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Host $server_name;
     proxy_read_timeout  1200s;

     # used for view/edit office file via Office Online Server
     client_max_body_size 0;

     access_log      /var/log/nginx/seahub.access.log;
     error_log       /var/log/nginx/seahub.error.log;
}


location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass http://127.0.0.1:8082;
    client_max_body_size 0;

    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;

    send_timeout  36000s;
}
location /media {
    root /opt/seafile/seafile-server-latest/seahub;
}

}

I have upgraded ubuntu on this server from 16.04 to 18.04 ten days ago, but I didn’t realize that seafile didn’t work. Maybe the upgrade isn’t the reason.

Can somebody help?

Peter

What am I supposed to look at? Is it nginx which is broken or what might be the reason?

It doesn’t look like a problem with nginx as it already fails to start. Try looking into logs/seahub.log.

I configured seahub_settings.py for the syslog integration of seahub (syslog integration). So there is no file logs/seahub.log. These lines from syslog and systemd’s journalctl are the only information for seahub which I can find:

syslog:
Oct 31 12:32:20 Seafile systemd[1]: Starting Seafile hub...
Oct 31 12:32:20 Seafile seahub.sh[12889]: LC_ALL is not set in ENV, set to en_US.UTF-8
Oct 31 12:32:20 Seafile seahub.sh[12889]: Starting seahub at port 8000 ...
Oct 31 12:32:26 Seafile seahub.sh[12889]: #033[33mError:Seahub failed to start.#033[m
Oct 31 12:32:26 Seafile seahub.sh[12889]: Please try to run "./seahub.sh start" again
Oct 31 12:32:26 Seafile systemd[1]: seahub.service: Main process exited, code=exited, status=1/FAILURE
Oct 31 12:32:26 Seafile systemd[1]: seahub.service: Failed with result 'exit-code'.
Oct 31 12:32:26 Seafile systemd[1]: Failed to start Seafile hub.

journalctl -xe:
Okt 31 12:32:16 Seafile polkitd(authority=local)[861]: Registered Authentication Agent for unix-process:12880:24419901 (system bus name :1.160 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale de_DE.UTF-8)
Okt 31 12:32:20 Seafile polkitd(authority=local)[861]: Operator of unix-process:12880:24419901 successfully authenticated as unix-user:sfadmin to gain ONE-SHOT authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.161 [systemctl start seahub.service] (owned by unix-user:sfadmin)
Okt 31 12:32:20 Seafile systemd[1]: Starting Seafile hub...
-- Subject: Unit seahub.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit seahub.service has begun starting up.
Okt 31 12:32:20 Seafile seahub.sh[12889]: LC_ALL is not set in ENV, set to en_US.UTF-8
Okt 31 12:32:20 Seafile seahub.sh[12889]: Starting seahub at port 8000 ...
Okt 31 12:32:26 Seafile seahub.sh[12889]: Error:Seahub failed to start.
Okt 31 12:32:26 Seafile seahub.sh[12889]: Please try to run "./seahub.sh start" again
Okt 31 12:32:26 Seafile systemd[1]: seahub.service: Main process exited, code=exited, status=1/FAILURE
Okt 31 12:32:26 Seafile systemd[1]: seahub.service: Failed with result 'exit-code'.
Okt 31 12:32:26 Seafile systemd[1]: Failed to start Seafile hub.
-- Subject: Unit seahub.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit seahub.service has failed.
-- 
-- The result is RESULT.
Okt 31 12:32:26 Seafile polkitd(authority=local)[861]: Unregistered Authentication Agent for unix-process:12880:24419901 (system bus name :1.160, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale de_DE.UTF-8) (disconnected from bus)

Btw when I undo the changes for syslog integraton in seahub_settings.py there is no logs/seahub.log created, but the information still is shown in syslog.

Can anybody help?

Unfortunately I can’t show more information. No logs are saved, when I try to start seahub. Syslog shows only information for seahub’s systemd service. But it’s same info as if I start seahub manually.

/opt/seafile/seafile-server-latest$ sudo ./seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

I have installed Ubuntu 18.04.3 LTS.

Peter

Hi,
if seahub log no much information then maybe your seahub_setting.py config wrongly.
i always have that error if i have any typo issue the seahub can not start.

you may want to share your seahub_setting.py here

also you enable the debug mode in seahub already… maybe can try and i am able to see more things after enable it
can refer to here

Unfortunately no log is generated even after activating the DEBUG mode. Also I don’t get any more information when starting seahub with DEBUG activated.

$ cat conf/seahub_settings.py
SECRET_KEY = "blablabla"
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'root',
        'PASSWORD': 'mysql_pw',
        'HOST': '127.0.0.1',
        'PORT': '3306',
        'OPTIONS': {
            'init_command': 'SET default_storage_engine=INNODB',
        }
    }
}

# I know it's http, but 8443 indicates https
FILE_SERVER_ROOT = 'http://seafile.mydomain:8443/seafhttp'
DEBUG = True