Upload unknown error: ERR_NAME_NOT_RESOLVED

So I’ve been working on getting Seafile up and running on a Raspberry Pi for the first time for like 7 hours now, starting with the outdated manual instructions, then starting over with the latest built package, and now, after installing everything I need and getting Seafile and Seahub started, I can get to the server via IP address, not the domain name I tried to set up, and when I go to upload, I get an unknown error and in the console “ERR_NAME_NOT_RESOLVED”

  • Raspberry Pi Model A Revision 2
  • Raspbian 9.4
  • Python 2.7.13
  • PHP 7.0.30
  • MySQL 10.1.23 (MariaDB)
  • nginx 1.10.3
  • Seafile 6.3.2

I did have to install Seafile and everything with sudo because MySQL wouldn’t work without it (couldn’t log in without sudo). I followed the instructions to deploy with MySQL and configure with nginx. I’ve set up hosts to point 127.0.0.1 to seafile.test.com. The error I get in seahub.error.log is the following:

2018/10/13 08:49:00 [error] 12048#12046: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.37, server: seafile.test.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "192.168.0.13"

Sometimes the number is 11876#11876.

Let me know if I can provide anything else. Any help would be appreciated. At this point, I’m wondering if the sudo installation is a problem, but I don’t know how to install mysql so it runs without sudo. I tried adding skip-grant-tables to my.cnf but that does nothing but throw an error that that option isn’t recognized.

  1. Why PHP? Seafile luckily doesn’t need it.
  1. What about changing back to a normal user after installation? Change the file permissions with chown.
  1. How did you manage your DNS Record? Are you using a CNAME one?

If you have the server with an interface attached to a LAN you might want to try adding the entry seafile.artlyticalmedia.com to the DNS server for that lan, pointing to the address of the rpi. That way you can debug without needing to worry about the common networking problems. If that does work then there’s a problem with packets.

I think you issue might be related to the server components not being able to communicate with themselves. NGINX serves as a proxy for seahub, and it most often routes traffic to localhost. I advise you to look at the component model for seafile as it might shed more light into this. https://manual.seafile.com/develop/server-components.html and https://manual.seafile.com/overview/components.html .

This won’t solve it.

bionade24, your questions were incredibly helpful! It was really tricky to get to where I was before without help and you really put the wind back in my sails with your inquisition!

So first of all, if PHP isn’t necessary, that is great. If I have it installed, will it cause any issues?

As for changing ownership, I think is a good idea because using sudo all the time doesn’t make sense; plus I couldn’t get the start on boot script to work and perhaps that had something to do with it. However, before I changed the ownership (and after I fixed the DNS, which your third question prompted me to do), I was able to get the server up and running, but I would get timeouts on both downloading and uploading files (trivial file sizes like 0.02KB and ~300KB). Now that I’ve changed the ownership, I get a connection refused error, so a step backwards. Do have any tips or questions on how I can get out of this now? Should I change the ownership back to root?

That’s why if you keep reading the post you’ll encounter the phrase “That way you can debug without needing to worry about the common networking problems”, common networking problems being DNS and client-server basic reachability.

Please post the content for the seafile configuration files ccnet.conf gunicorn.conf seafile.conf seahub_settings.py and your nginx site config. Remove any sensitive information, like database passwords. It’s hard to diagnose the issue without having undebatable context.

ccnet.conf:

[General]
USER_NAME = test
ID = ************************************
NAME = test
SERVICE_URL = http://seafile.test.com

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = ********
DB = ccnet-db
CONNECTION_CHARSET = utf8

gunicorn.conf:

import os

daemon = True
workers = 5

# default localhost:8000
bind = "0.0.0.0:8000"

# Pid
pids_dir = '/home/pi/test/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')

# Logging
logs_dir = '/home/pi/test/logs'
errorlog = os.path.join(logs_dir, 'gunicorn_error.log')
accesslog = os.path.join(logs_dir, 'gunicorn_access.log')

# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200

limit_request_line = 8190

seafile.conf:

[fileserver]
port = 8082

[database]
type = mysql
host = 127.0.0.1
port = 3306
user = seafile
password = *******
db_name = seafile-db
connection_charset = utf8

seahub_settings.py:

# -*- coding: utf-8 -*-
SECRET_KEY = "***************************"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': '************',
        'HOST': '127.0.0.1',
        'PORT': '3306'
    }
}

FILE_SERVER_ROOT = 'http://seafile.test.com/seafhttp'

sites-enabled/seafile.conf:

server {
    listen 80;
    server_name seafile.test.com;

    proxy_set_header X-Forwarded-For $remote_addr;

    location / {
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $host;
         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_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

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

        send_timeout  36000s;
        proxy_request_buffering off;
    }
    
    location /media {
        root /home/pi/test/seafile-server-latest/seahub;
    }
}

Don’t you want to use https? You have to check your SERVICE_URL and FILE_SERVER_ROOT in your database, you can do this on the web ui under system admindistration -> preferences.

Oh I definitely want to use https, but until I can simply get http working, I feel like https configuration will add complexity to this debugging. Not to mention, I can’t even get into the web UI at the moment.

do you have a fixed IP address where you go through a router

[General]
USER_NAME = cloud-bou1111
ID = 2f9c415bd721111111111111111111111111111a2b5b74
NAME = cloud-boubou

SERVICE_URL = http://look.at.me:8000

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = …
DB = ccnet-db
CONNECTION_CHARSET = utf8

this line is incorrect
do you use an SSL certificate?

FILE_SERVER_ROOT = ’ https://seafile.test.com/seafhttp

the listening port is missing
SERVICE_URL = http://XXX.YYYYY.ZZ:8000

replace all the instances of seafile.test.com with the hostname/ip of the interface the server should be accessed through, set up port forwarding and NAT loopback if you server is behind a NAT firewall (a home router).

Yes I fixed the IP address across the network and I can ssh into the device using that IP address plus I looked it up on the router and it is the same.

I haven’t setup an SSL certificate yet; I will, but I think it will obfuscate the issue further and make debugging even more difficult. Is it necessary? It looks like seafile can run without one, regardless of whether it is bad practice or not, given there are later instructions for moving it to SSL besides the basic nginx setup instructions.

I tried this before and again just now and I get the same issue. I’m forwarding the ports from 80 to 8000, so I don’t believe I should use 8000 for the service url. I also tried forwarding 8000 to 8000 (which wouldn’t do anything) and to the IP address of the device and I still get the issue, so I’m not sure this is the issue.

I tried this and it doesn’t seem to work. I would be perplexed if everything is getting directed through an IP address yet the URL is always seafile.test.com why that would work over when all the settings work.

I will try maybe changing the IP addresses and domain names completely to see if maybe some part of the configuration is persisting over all my attempted changes.

Every time I go to stop seahub, it says “seahub not running”, does that mean it isn’t starting properly?