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

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

Hello,

Is there any working being done on the sqlite3 script to fix the clear issues present?

Any news about your CDN issue? Or an alternative mirror…

The link in the download page has been updated now.

2 Likes

The pro version of 7.1.0 is still missing? Is 7.1.0 required for centOS 8 or can I use a lower version?

A new minor version will be marked as beta for about 2 weeks. When no important bugs are found, we will remove the beta mark and consider it as production ready.

A new minor version of pro edition will be released after the corresponding community edition is production ready. And it will be marked as beta for 2 weeks. It will be tested on our online server seacloud.cc. When no important bugs are found, we will remove the beta mark and consider it as production ready.

source: https://www.seafile.com/en/roadmap/

1 Like

I am also receiving:

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

I’m not using the upgrade script, I have done a fully fresh install of 7.1.0 using the beta download on the downloads page.

Anyway, similarly to @rickenwing I tried making some edits, specifically to seahub.sh - changed the config file name from gunicorn.conf to gunicorn.conf.py (and copied the actual config file to that filename as well) - the error went away and I did not get the same error that rickenwing got afterwards.

Hub still would not start but it didn’t give me any info besides:

Error:Seahub failed to start.
Please try to run “./seahub.sh start” again

No further details.

I am doing this with the SQLITE3 version.