Seafile server 7.1.0 is ready for testing! Migrate to Python 3

We are pleased to announce that Seafile server 7.1.0 is ready for testing. This is a release for Python 3. Other changes include:

  • Rewrite the admin interface with React
  • Add a feature library API Token for integrate with other applications.
  • Add a feature abuse report for reporting abuse for download links.

Please note that PostgreSQL support is dropped.

You can follow our upgrade notes to upgrade to 7.1.0.

https://download.seafile.com/published/seafile-manual/upgrade/upgrade_notes_for_7.1.x.md

8 Likes

While I am welcoming the changes python 3 and the rewritten admin interface,
I am not so much the removal of postgres support.
Is this gone for good or as in former case will come back in the future?

After upgrade from 7.0.5 CE to 7.1.0, Seahub fails to start with

Starting seahub at port 8000 ...
!!!
!!! WARNING: configuration file should have a valid Python extension.
!!!

Seafile server on the other hand is up and running.

Python3 is installed:

seafile@mysrv:~/seafile-server-latest$ python3 -V
Python 3.5.3

What should I do?

Could you elaborate? I was not aware that Seafile Server - CE or PE - has supported PostgreSQL.

It is only a warning by the gunicorn library. We will write an instruction on how to resolve it soon.

Thanks for your quick response. But a warning shouldn’t result in a failed start, should it? :thinking:

Error:Seahub failed to start.

Apologies, now I see what you mean. Your comment refers to the first comment in the change log.

My initial response to your comment was linked to this statement made earlier by Jonathan Xu, Seafile’s CTO.

PostgreSQL is never officially supported before. There is no official upgrade scripts for it either. It’s not easy support one more database backend given that Seafile is written in C. Given that there is no many users using it with Seafile, we decided to drop the support from our code base.

as said not that happy, however even if not “supported” there is some documenation for this;

if you no longer plan to support this, any obsolete postgres references in documentation should be marked obsolete,mainly this:
https://download.seafile.com/published/seafile-manual/deploy/using_postgresql.md
there It says still beta, but not removed and not a warning that it will be removed.

there were from community (not me) scripts to setup and upgrade postgres (version 4 to 6.3)
https://github.com/caniwi/seafile-postgres-updates

Hey Martin,

please try to start seahub with: “seahub.sh start-fastcgi”. I know this is not supported anymore but normally this shows more errors. In my case the error is:
“cannot import Image” or
“cannot import _imaging”

I am still figuring out, why python3 can not import this.
Best regards
Christoph

Hi Christoph,

thanks for the hint. Now I can see that I got the very same error. But that’s to deep into Python for me. :laughing:

When updating from 7.0.5 I ran into a few errors:

==================================
Updating seafile/seahub database ...

[INFO] You are using SQLite3
[INFO] updating seahub database...
Traceback (most recent call last):
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/db_update_helper.py", line 384, in <module>
    main()
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/db_update_helper.py", line 379, in main
    db_updater.update_db()
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/db_update_helper.py", line 275, in update_db
    super(SQLiteDBUpdater, self).update_db()
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/db_update_helper.py", line 129, in update_db
    self.update_seahub_sql(seahub_sql)
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/db_update_helper.py", line 299, in update_seahub_sql
    self.apply_sqls(self.seahub_db, sql_path)
  File "/home/<user>/<seafilefolder>/seafile-server-7.1.0/upgrade/db_update_helper.py", line 289, in apply_sqls
    conn.execute(line)
sqlite3.IntegrityError: UNIQUE constraint failed: constance_config.constance_key

Failed to upgrade your database
==================================

Checking my sqlite3 db I see the table is configured as such:

sqlite> select * from constance_config_old;
id|key|value
1|LOGIN_REMEMBER_DAYS|<value>
2|SITE_TITLE|<value>
3|FREEZE_USER_ON_LOGIN_FAILED|<value>
4|LOGIN_ATTEMPT_LIMIT|<value>

From the script for 7.1.0 upgrade:

ALTER TABLE "constance_config" RENAME TO "constance_config_old";
CREATE TABLE "constance_config" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "constance_key" varchar(255) NOT NULL UNIQUE, "value" text NULL);
INSERT INTO "constance_config" ("id", "constance_key", "value") SELECT "id", "constance_key", "value" FROM "constance_config_old";
DROP TABLE "constance_config_old";

Here it is trying to insert constance_key 4 times since the column name is “key” not “constance_key” and thus fails with the UNIQUE constraint.

I had to drop the empty constance_key table, alter the name of constance_key_old back to constance_key and edit the seahub.sql to change the column it is pulling from for the constance_key_old table.

This allows that step to proceed but then I get:
sqlite3.OperationalError: near “ON”: syntax error

The problematic line is:
DROP INDEX IF EXISTS "drafts_draft_origin_file_uuid_7c003c98_uniq" ON "drafts_draft";

I ended up removing ON "drafts_draft" and that proceeded the upgrade again (having reverted prior to a backup db before upgrade).

then unfortunately ran into a third issue:

sqlite3.OperationalError: near “CONSTRAINT”: syntax error

This is right on the next line:
ALTER TABLE "drafts_draft" ADD CONSTRAINT "drafts_draft_origin_file_uuid_7c003c98_uniq" UNIQUE ("origin_file_uuid");

Where here, this is a limitation being hit on sqlite:
https://www.sqlite.org/omitted.html

“Only the RENAME TABLE, ADD COLUMN, and RENAME COLUMN variants of the ALTER TABLE command are supported. Other kinds of ALTER TABLE operations such as DROP COLUMN, ALTER COLUMN, ADD CONSTRAINT, and so forth are omitted.”

Seems like the same steps for the first table need to be done here to add this constraint on drafts_draft, aka rename current table to _old, create new table with this unique constraint and add back any data.

Can you please provide an updated sql script that fixes these issues?

For reference, my version of sqlite3 is:
sqlite> select sqlite_version();
3.27.2

edit, for the last issue this seems to be what is needed:

DROP INDEX IF EXISTS “drafts_draft_origin_file_uuid_7c003c98”;
ALTER TABLE “drafts_draft” RENAME TO “drafts_draft_old”;
CREATE TABLE IF NOT EXISTS “drafts_draft” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “created_at” datetime NOT NULL, “updated_at” datetime NOT NULL, “username” varchar(255) NOT NULL, “origin_repo_id” varchar(36) NOT NULL UNIQUE, “origin_file_version” varchar(100) NOT NULL, “draft_file_path” varchar(1024) NOT NULL, “publish_file_version” varchar(100) NULL, “status” varchar(20) NOT NULL, “origin_file_uuid” char(32) NOT NULL);
INSERT INTO “drafts_draft” (“id”, “created_at”, “updated_at”, “username”,“origin_repo_id”,“origin_file_version”,“draft_file_path”,“publish_file_version”,“status”,“origin_file_uuid”) SELECT “id”, “created_at”, “updated_at”, “username”,“origin_repo_id”,“origin_file_version”,“draft_file_path”,“publish_file_version”,“status”,“origin_file_uuid” FROM “drafts_draft_old”;
DROP TABLE “drafts_draft_old”;
CREATE INDEX “drafts_draft_created_at_e9f4523f” ON “drafts_draft” (“created_at”);
CREATE INDEX “drafts_draft_updated_at_0a144b05” ON “drafts_draft” (“updated_at”);
CREATE INDEX “drafts_draft_username_73e6738b” ON “drafts_draft” (“username”);
CREATE INDEX IF NOT EXISTS “drafts_draft_origin_repo_id_8978ca2c” ON “drafts_draft” (“origin_repo_id”);

I unfortunately do not have data in drafts_draft to confirm.

Edit 2: the upgrade script completed after making the above changes. Unfortunately I hit more issues trying to start the server, seahub fails to start, the only indication of anything is:

!!!
!!! WARNING: configuration file should have a valid Python extension.
!!!

Here (seahub/thirdpart/gunicorn/app/base.py) it seems to be loading gunicorn.conf and then explicitly checking for it’s extension of .py or .pyc and seems to be failing since it obviously doesn’t match.
Not sure what is wrong here, but I’ve run into too many problems and will just revert to 7.0.5.

Edit 3: To provide at least some info, I had modified base.py and added .conf to the extension check, starting seahub again threw this error:

Failed to read config file: /home/user/server/conf/gunicorn.conf
Traceback (most recent call last):
  File "/home/user/server/seafile-server-7.1.0/seahub/thirdpart/gunicorn/app/base.py", line 111, in get_config_from_filename
    mod = importlib.util.module_from_spec(spec)
  File "<frozen importlib._bootstrap>", line 580, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'

After this I successfully reverted back to 7.0.5 by restoring backup of the DB and running the minor upgrade script in the 7.0.5 upgrade folder.

final edit: I hadn’t read the other responses but the last issue I had is similar. I am on Debian Buster as well with python 3.7.3.

3 Likes

I see you silently removed the page in the published area, but in GitHub it is still there.

I have the same issue with the failed import.
I am on Debian Buster with Python 3.7.3 (amd64 platform)

The Seafile beta shipped with Pillow 6.2.1, which should be compatible with Python 3.7 :thinking:

Starting seahub (fastcgi) at 127.0.0.1:8000 ...
Traceback (most recent call last):
  File "/data/seafile/seafile-server-7.1.0/seahub/seahub/avatar/models.py", line 23, in <module>
    from PIL import Image
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/PIL/Image.py", line 90, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/data/seafile/seafile-server-7.1.0/seahub/thirdpart/PIL/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/seafile/seafile-server-7.1.0/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/data/seafile/seafile-server-7.1.0/seahub/thirdpart/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/data/seafile/seafile-server-7.1.0/seahub/seahub/avatar/models.py", line 26, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'
Error:Seahub failed to start.
2 Likes

Looks like 7.1 has been removed from the download server. Can anyone give it to me?

Upload link: https://home.hoeper.me/u/d/d89b8fc1239647efa89c/

thanks @DerDanilo

Done. Downloading works fine for me.

1 Like

I can still see it on seafile.com/en/download
Link: https://download.seadrive.org/seafile-server_7.1.0_x86-64.tar.gz

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>seafile-server_7.1.0_x86-64.tar.gz</Key>
<RequestId>03D9FAF4A2741506</RequestId>
<HostId>
YPvBPMDzlnFwP4V4mlqP89y+D345BdRJ44IhDE6l0cHFRqbPgWfwnt3knsl8POFEJ8bfhFel744=
</HostId>
</Error>

And going to https://download.seadrive.org/ there is no such key.

This is a CDN issue. We will see how to solve the problem.

1 Like

Hey Manuel,

I had ubuntu 16.04 lts. After an upgrade to ubuntu 18.04, seafile community 7.1 started without any issues.

Best regards
Christoph