YunoHost-Apps / seafile_ynh

Seafile package for YunoHost
https://seafile.com
MIT License
14 stars 19 forks source link

Deploying script creating database with wrong charset that causing internal error in web interface #77

Open gmalets opened 3 years ago

gmalets commented 3 years ago

Describe the bug

According to log file https://paste.yunohost.org/raw/keguceqobi a deploying script creating database with wrong charset. As a result uploading files with diacritic or cyrillic in names using the web interface causing an error {"error": "Internal error. "} Files without diacritic or cyrillic in names are not affected. Also, files uploaded using seafile client are uploaded correctly.

Context

Steps to reproduce

yunohost app install seafile or yunohost app install https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --force

or by web browser:

  1. Go to 'Applications'
  2. Click on green button 'Install'
  3. Search for 'Seafile'
  4. Click on green button 'Install'
  5. Wait until the end of the installation
  6. Open ssh connection to yunohost
  7. Type in command line su root
  8. Type mysql
  9. Type SHOW DATABASES;
  10. Find database names related to seafile installation (by default "ccnetdb, seafiledb, seahubdb")
  11. Type SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "ccnetdb";
  12. Type SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "seafiledb";
  13. Type SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "seahubdb";

Result of all 3 commands will be latin1

Expected behavior

Detailed manual by deploying seafile with mysql is located here

Logs

https://paste.yunohost.org/raw/keguceqobi

Josue-T commented 2 years ago

Hello,

Can you try the new testing ?

Thanks

gmalets commented 2 years ago

I did execute the command: sudo yunohost app install https://github.com/YunoHost-Apps/seafile_ynh/tree/testing

Command line output:

sudo yunohost app install https://github.com/YunoHost-Apps/seafile_ynh/tree/testing DANGER! This app is not part of YunoHost's app catalog. Installing third-party apps may compromise the integrity and security of your system. You should probably NOT install it unless you know what you are doing. NO SUPPORT will be provided if this app doesn't work or breaks your system… If you are willing to take that risk anyway, type 'Yes, I understand': Yes, I understand Choose the domain where this app should be installed [zcloud.local | trilium.zcloud.local] (default: zcloud.local): Choose the path where this app should be installed (default: /seafile): Choose a name (3 - 15 letters or digits) (default: Seafile): Choose an administrator user for this app [user100] (default: user100): Enter a password for the administrator: Should this app be exposed to anonymous visitors? [yes | no] (default: yes): Info: Installing seafile... Info: [....................] > Validating installation parameters... Info: [....................] > Finding available ports... Info: [+...................] > Storing installation settings... Info: [#...................] > Creating base directory... Info: [#+..................] > Configuring system user... Info: [##+++...............] > Installing dependencies... Warning: pandas 1.3.0 has requirement numpy>=1.17.3, but you'll have numpy 1.16.2 which is incompatible. Warning: networkx 2.6.1 has requirement matplotlib>=3.3, but you'll have matplotlib 3.0.2 which is incompatible. Warning: networkx 2.6.1 has requirement numpy>=1.19, but you'll have numpy 1.16.2 which is incompatible. Warning: networkx 2.6.1 has requirement scipy!=1.6.1,>=1.5, but you'll have scipy 1.1.0 which is incompatible. Warning: scikit-image 0.18.2 has requirement numpy>=1.16.5, but you'll have numpy 1.16.2 which is incompatible. Info: [#####+++............] > Installing sources files... Info: [########............] > Configuring MySQL database... Info: [########++..........] > Configuring application... Info: [##########..........] > Configuring a systemd service... Info: [##########+.........] > Configuring nginx... Info: [###########.........] > Protecting directory... Info: [###########+........] > Configuring permissions... Info: [############........] > Configuring log rotation... Info: [############+.......] > Stoping services... Info: [#############++.....] > Starting seafile services... Info: The service seafile has correctly executed the action start. Info: The service seahub has correctly executed the action start. Info: [###############++++.] > Configuring fail2ban... Warning: Packagers: using --others_var is unecessary since YunoHost 4.2 Info: The service fail2ban has correctly executed the action reload-or-restart. Info: [####################] > Installation of seafile completed Success! Installation completed

Debug output: https://paste.yunohost.org/raw/pabahaciso

After install nothing happened. Steps to reproduce still returns "latin1" encoding of databases and still causing an error {"error": "Internal error. "}

Josue-T commented 2 years ago

Hello,

What is the result of the command locale ?

gmalets commented 2 years ago

root@zcloud.local:~# locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=en_US.UTF-8

The default MySQL server character set and collation are latin1 and latin1_swedish_ci , but you have to specify character sets according to official documentation I mentioned in first post https://manual.seafile.com/deploy/using_mysql/#prepare-mysql-databases

and edit file in repo "scripts/install" https://github.com/YunoHost-Apps/seafile_ynh/blob/testing/scripts/install (line 98, 99, 100)

Josue-T commented 2 years ago

Maybe you can try to backport on your install this fix on your instance to see if it fix the issue. The file that I modified is in /usr/share/yunohost/helpers.d/mysql in your server.

Josue-T commented 1 year ago

cf: https://github.com/YunoHost/issues/issues/1868