mediabox-cl / nextcloud-user-ispconfig-api

This Backend allows users to sign in with their email or custom login name using the ISPConfig 3 Control Panel API.
GNU Affero General Public License v3.0
3 stars 1 forks source link

Migration from "nextcloud-user-ispconfig" #1

Open ivoruetsche opened 2 weeks ago

ivoruetsche commented 2 weeks ago

Hi

Thank you for this solution, to bring ISPConfig and NextCloud together, which we do actually with "nextcloud-user-ispconfig". Because this plugin works only up to NextCloud 27,our team have to find a solution for newer NC versions, so we would like to update to 30.

Is there someone with the same problem and tried to migrate to nextcloud-user-ispconfig-api?

Thanks for any hints

gruss ivo

mediabox-cl commented 2 weeks ago

Hi @ivoruetsche, Three things... 1- This backend have his own users table (ispconfig_api_users) with this rows:

uid > User email with the last @ replaced with a dot (.)
displayname > Display name
mailuser > Mail user
maildomain > Mail domain

Note: If the length of the uid string is greater than 64 chars, it is converted to a sha256 (64 hexadecimal characters)

2- This backend have his own groups table (ispconfig_api_groups) with this rows:

gid > Computed group id: id + (ISPConfig server, domain or user id + . + ISPConfig section (server, domain or user)
rid > ISPConfig id for server, domain or user
sid > ISPConfig section (server, domain or user)
displayname > Group name

Note: If the length of the gid string is greater than 64 chars, it is converted to a sha256 (64 hexadecimal characters)

3- This plugin store the users data inside the "data" folder in this format:

datadirectory/data/maildomain/mailuser

Note: The storage path is going to be configurable in the plugin in future versions.

You can parse your old data and insert the new one in the plugin tables. I don't see any problem with users and the data folder, but with groups this is more complex because there is other nextcloud tables that manage user permissions.

To resume.

The user_ispconfig plugin uses the ispconfig_users table for users and the groups table for groups from the nextcloud database backend.

The user_ispconfig_api plugin uses the ispconfig_api_users table for users and the ispconfig_api_groups table for groups.

ivoruetsche commented 2 weeks ago

Okay, thank a lot for the explanation. We have to try it out on preProd environment in the next time and we will give a feedback, maybe we write a migration script.

ivoruetsche commented 2 weeks ago

We configured today out preProd env. with the plugins.

Our environment contains a multiserver installation:

If we enable NextCloud (we did it on 1, 3 and 4), we have the new nc_xxx-fields in the mail_user table on the first server, but not on the 3 and 4. It end's with a queue where stuck after we enabled the first user and on the 3 and 4 we got

"ERROR - Replication of datalog_id: 5149 failed. Error: (mail_user) in MySQL server: (localhost) Unknown column 'nc_enabled' in 'field list' # SQL: REPLACE INTO ?? (??,...) VALUES (?, ...)"

where we solved after we copied the nc_ filelds from 1, the queue is empty.

But on the NC host, the tables are still empty (ispconfig_api_users and ispconfig_api_groups) - we just want to try to test the basics, without changing anything on the databases for the user migration.

gruss ivo