Seahub failed, manage.py process gets canceled

Hi, im runnning Seafile 6.0.7 on Windows Server 2016 Standard. I have a couple of them working, so please dont comment with suggestions to go to linux because it is possible.

What I deployed so far:

  • Installed Python 2.7 and added its installation path to the system environment
  • Initialised seafile server
  • Created 3 database as shown in the seafile manual
  • Installed Pyhton MySQL Tools
  • Executed mysql.sql script successfully on seahub-db
  • Added them to the configs

NOTE: At this point seafile was working well.

  • Installed IIS and added a Seafile Website with HTTPS on Port 443
  • Installed Application Request Rounting Proxy Server Pass Through for URL Rewrite
  • Added 2 Rules for rewriting Request to the seafhttp or the webinterface Port 8000 and 8082
  • Added a Zone in DNS for my URL which is resolving the IP of my server
  • Changed SERVICE_URL to my URL and added FILE_SERVER_ROOT

NOTE: Now when Im trying to reach my site via the URL it says BAD GATEWAY. But I noticed that my pyhton background process is not started. So it is clear that i cant reach seahub webinterface.

What I did troubleshoot so far:

  • Checking Rewrite Rules
  • Checking all Configs
  • Checking if there are already hidden python background processes
  • Try to run manage.py from Commandline and Python Commandline
  • Checking User Permission
  • Reroll the configs to before installing IIS (didn’t work)
  • Checking Firewall

I had to delete the whole seafile database. The manage.py background process did start again.

The Error Messages:

Starting manage.py from IDLE with “runserver localhost:8000”

Fun Fact this error shows up on my other seafile server too but they are working…

===== RESTART: C:\Seafile Program\seafile-server-6.0.7\seahub\manage.py =====

Traceback (most recent call last):
  File "C:\Seafile Program\seafile-server-6.0.7\seahub\manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

From Seafserv.log

created "python.exe -V", pid 5976
[12/19/17 10:57:35] seafserv/seafserv.c(63): starting ccnet-server ...
[12/19/17 10:57:35] created "ccnet-server.exe -c "D:/seafile-server\ccnet" -f "D:/seafile-server\logs\ccnet.log" -F "D:/seafile-server\conf"", pid 3912
[12/19/17 10:57:35] seafserv/seafserv.c(466): ccnet server started
[12/19/17 10:57:36] seafserv/seafserv.c(334): trying to connect to ccnet-sever...
[12/19/17 10:57:36] seafserv/seafserv.c(360): connected to ccnet server
[12/19/17 10:57:36] seafserv/seafserv.c(90): starting seaf-server ...
[12/19/17 10:57:36] created "seaf-server.exe -c "D:/seafile-server\ccnet" -d "D:/seafile-server\seafile-data" -l "D:/seafile-server\logs\seafile.log" -F "D:/seafile-server\conf"", pid 4828
[12/19/17 10:57:36] seafserv/seafserv.c(161): starting seahub ...
[12/19/17 10:57:36] created "python.exe "C:\Seafile Program\seafile-server-6.0.7\seafile\bin\..\..\seahub\manage.py" runwsgiserver host=0.0.0.0 port=8080 autoreload=False staticserve=False", pid 3964
[12/19/17 10:57:36] seafserv/seafserv.c(560): [process monitor] started.
[12/19/17 10:58:26] seafserv/seafserv.c(516): seahub has exited with code 1
[12/19/17 10:58:26] seafserv/seafserv.c(161): starting seahub ...
[12/19/17 10:58:26] created "python.exe "C:\Seafile Program\seafile-server-6.0.7\seafile\bin\..\..\seahub\manage.py" runwsgiserver host=0.0.0.0 port=8080 autoreload=False staticserve=False", pid 4296
[12/19/17 10:59:16] seafserv/seafserv.c(516): seahub has exited with code 1

Its looping over and over again that it creates the pyhton background process and the it immediatly gets shut down.

My Configs:

ccnet.conf

[General]
USER_NAME = my-seafile
ID = editedbecausesecret
NAME = my-seafile
SERVICE_URL = https://url.mydomain.de:8080

[Network]
PORT = 10001

[Client]
PORT = 13418

#MySQL Connection (Seafiledb: ccnet-db)
[Database]
ENGINE=mysql
HOST=localhost
USER=seafile
PASSWD=********
DB=ccnet-db

seafile.conf

#MySQL Connection (SeafileDb: seafile-db)
[database]
type=mysql
host=localhost
user=seafile
password=********
db_name=seafile-db

[network]
port = 12001

[fileserver]
port = 8082

[seahub]
port = 8080
fastcgi = false

seahub_settings.py

SECRET_KEY = edited because secret

#Seafile File-Server Root für Upload/Download von Daten
FILE_SERVER_ROOT = 'https://url.mydomain.de/seafhttp'

#MySQL Connection (SeafileDb: seahub-db)
DATABASES = {
	'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME' : 'seahub-db',
        'USER' : 'seafile',
        'PASSWORD' : '**********',
        'HOST' : 'localhost',
		'PORT' : '3306',
	}
}

I’ve solved it today after ages.
So there is a Problem with a Windows Update…again…which updated maybe utilities or parts of the Windows Webserver IIS.

My web.config did eliminate my python background process because it did not find a server to run manage.py because of the rewrite configuration.

If anyone is interested here is my new config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<location path="" overrideMode="Deny">
	</location>
	<system.webServer>
		<rewrite>
			<rules>
				<clear />
				<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
					<match url="(.*)" />
					<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
						<add input="{HTTPS}" pattern="^OFF$" />
					</conditions>
					<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
				</rule>
				<rule name="seafilehttp" stopProcessing="true">
					<match url="seafhttp/(.*)" />
					<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
						<action type="Rewrite" url="http://127.0.0.1:8082/{R:1}" appendQueryString="true" logRewrittenUrl="true" />
				</rule>
				<rule name="seafile" enabled="true" stopProcessing="true">
					<match url="(.*)" />
					<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
					<action type="Rewrite" url="http://localhost:8080/{R:1}" appendQueryString="true" logRewrittenUrl="true" />
				</rule>
			</rules>
			<outboundRules>
				<preConditions>
					<preCondition name="ResponseIsHtml1">
						<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
					</preCondition>
				</preConditions>
			</outboundRules>
		</rewrite>
		<httpErrors errorMode="DetailedLocalOnly" />
        <security>
            <requestFiltering allowDoubleEscaping="true">
                <requestLimits maxAllowedContentLength="4294967295" />
            </requestFiltering>
        </security>
	</system.webServer>
</configuration>
1 Like

Thanks for sharing with the community :slight_smile:

1 Like