Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [webtrees] Auto-update from 2.2.1 to 2.2.1-4 - site error and unexpected user experience #1707

Open
arsenyspb opened this issue Jan 9, 2025 · 6 comments
Labels
bug Something isn't working stale Element will be closed automatically

Comments

@arsenyspb
Copy link

arsenyspb commented Jan 9, 2025

Description

I wish we collaborated in staging before pushing this update 🤣 Looks like you changed a few configs, paths and also deprecated (or omitted) passing quite a few add-on env variables that were there before.

It looks like the root cause is around not picking up some symlinks (...from logs: [04:26:29] WARNING: Data location was changed from /share/webtrees to /config/data, migrating files and ... creating symlinks )?.. - were they supposed to be created?..

Here's the full log of my User Experience.

  1. Had auto-update so ended up with panic attack from unexpectedly being forced in to setup wizard, but using phpmyadmin add-on checked that I got the database more or less current and immediately backed it up.
  2. Found auto-detection of MariaDB in logs of the add-on and instructions on what hostname and login/password pair to use. Trying them.
  3. I'm forced to create another administrator user. As I'm on gmail, I've reused my existing email with +trick to continue.
  4. Couldn't open Control Panel now, getting Unable to create a directory at /share/webtrees/data/.
    image . Quickly grep-ed through the SQL backup from (1) and with phpmyadmin fixed:
UPDATE wt_site_setting
SET setting_value = '/config/data/'
WHERE setting_name = 'INDEX_DIRECTORY';
  1. Webtrees expects the files to be in /config/data/media/ but migration left them in /config/data/data/media , and not sure what's 33 owner:
image

But in /config/data/data/media I had:

image

So I had to copy them once more preserving the -p ownership for photos to work:

root@db21ed7f-webtrees:/config/data# cp -rp data/media/ media/
root@db21ed7f-webtrees:/config/data# pwd
/config/data

Reproduction steps

1. Existing 2.2.1
1. Auto-update on
1. Updated Home Assistant and rebooted
1. Add-on update led to webtrees set-up, database not connected, config is not picked up.

Addon Logs

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Webtrees
 web's leading on-line collaborative genealogy application
-----------------------------------------------------------
 Add-on version: 2.2.1-4
 You are running the latest version of this add-on.
 System: Home Assistant OS 14.1  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2025.1.1
 Home Assistant Supervisor: 2024.12.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
BASE_URL='https://<hostname>'
DATA_LOCATION='/config/data'
certfile='certs/ECC-cert.pem'
cifsdomain='<hostname>'
cifspassword=******
cifsusername='webtrees'
keyfile='certs/ECC-privkey.pem'
networkdisks='//<hostname>/2_uploads'
ssl='true'
Timezone set from Etc/UTC to Asia/Singapore
/etc/cont-init.d/00-local_mounts.sh: executing
/etc/cont-init.d/00-smb_mounts.sh: executing
Mounting smb share(s)...
... using domain /<hostname>
... mounting ///<hostname>/2_uploads
[04:26:25] INFO: ...... //<hostname>/2_uploads successfully mounted to /mnt/2_uploads with options rw,file_mode=0775,dir_mode=0775,username=<username>,password=XXXXXXXXXX,nobrl,uid=0,gid=0,iocharset=utf8,domain=<hostname>
/etc/cont-init.d/01-config_yaml.sh: executing
Migrating config.yaml to new config location
Setting permissions for the config.yaml directory
Load environment variables from /config/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f_webtrees/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables
... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /addon_configs/db21ed7f_webtrees/webtrees.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/02-mariadb_discovery.sh: executing
---
MariaDB addon discovered on your system. If you want to use it, you need to use those values when doing the initial startup wizard, or modify manually the config.ini.php file in /config/data (mapped to /addon_configs/xxx-webtrees/data when accessing using a third party tool)
Host-name : core-mariadb
Port : 3306
Database user : service
Database password : <password>
Database name : webtrees
Database prefix : wt_
---
/etc/cont-init.d/99-run.sh: executing
[04:26:29] INFO: Data is stored in /config/data
[04:26:29] WARNING: Data location was changed from /share/webtrees to /config/data, migrating files
... using data folder /config/data
... creating symlinks
... update permissions
[04:26:35] INFO: Ssl enabled. If webui don't work, check if the port 443 was opened in the addon options, disable ssl or check your certificate paths
... align base url with latest addon value
[04:26:36] INFO: Launching app, please wait
Adapting start script
[04:26:36] INFO: Starting docker-entrypoint.py
[NV_INIT] PRETTY_URLS found in environment variables
[NV_INIT] HTTPS found in environment variables
[NV_INIT] HTTPS_REDIRECT found in environment variables
[NV_INIT] SSL_CERT_FILE found in environment variables
[NV_INIT] SSL_CERT_KEY_FILE found in environment variables
[NV_INIT] BASE_URL found in environment variables
[NV_INIT] LANG found in environment variables
[NV_INIT] DB_TYPE NOT found in environment variables, using default: mysql
[NV_INIT] DB_HOST NOT found in environment variables, using default: None
[NV_INIT] DB_PORT NOT found in environment variables, using default: 3306
[NV_INIT] MYSQL_USER NOT found in environment variables, using default: None
[NV_INIT] MARIADB_USER NOT found in environment variables, using default: None
[NV_INIT] POSTGRES_USER NOT found in environment variables, using default: None
[NV_INIT] DB_USER NOT found in environment variables, using default: webtrees
[NV_INIT] MYSQL_PASSWORD NOT found in environment variables, using default: None
[NV_INIT] MARIADB_PASSWORD NOT found in environment variables, using default: None
[NV_INIT] POSTGRES_PASSWORD NOT found in environment variables, using default: None
[NV_INIT] DB_PASS NOT found in environment variables, using default: None
[NV_INIT] MYSQL_DATABASE NOT found in environment variables, using default: None
[NV_INIT] MARIADB_DATABASE NOT found in environment variables, using default: None
[NV_INIT] POSTGRES_DB NOT found in environment variables, using default: None
[NV_INIT] DB_NAME NOT found in environment variables, using default: webtrees
[NV_INIT] DB_PREFIX NOT found in environment variables, using default: wt_
[NV_INIT] WT_USER NOT found in environment variables, using default: None
[NV_INIT] WT_NAME NOT found in environment variables, using default: None
[NV_INIT] WT_PASS NOT found in environment variables, using default: None
[NV_INIT] WT_EMAIL NOT found in environment variables, using default: None
[NV_INIT] DB_KEY NOT found in environment variables, using default: None
[NV_INIT] DB_CERT NOT found in environment variables, using default: None
[NV_INIT] DB_CA NOT found in environment variables, using default: None
[NV_INIT] DB_VERIFY NOT found in environment variables, using default: None
[NV_INIT] PHP_MEMORY_LIMIT NOT found in environment variables, using default: 1024M
[NV_INIT] PHP_MAX_EXECUTION_TIME NOT found in environment variables, using default: 90
[NV_INIT] PHP_POST_MAX_SIZE NOT found in environment variables, using default: 50M
[NV_INIT] PHP_UPLOAD_MAX_FILE_SIZE NOT found in environment variables, using default: 50M
[NV_INIT] PUID found in environment variables
[NV_INIT] PGID found in environment variables
[NV_INIT] Setting up folder permissions for uploads
[NV_INIT] Updating php.ini
[NV_INIT] Creating php.ini
[NV_INIT] Setting value for memory_limit in php.ini
[NV_INIT] Setting value for max_execution_time in php.ini
[NV_INIT] Setting value for post_max_size in php.ini
[NV_INIT] Setting value for upload_max_filesize in php.ini
[NV_INIT] Attempting to automate setup wizard
[NV_INIT] WARNING: Not all database variables are set
[NV_INIT] Updating config file
[NV_INIT] Config file not found at /config/data/config.ini.php. Nothing to update.
[NV_INIT] Configuring HTTPS
[NV_INIT] Adding HTTPS, with HTTPS redirect
[NV_INIT] Disabling site webtrees
[NV_INIT] Enabling site webtrees-ssl
[NV_INIT] Enabling site webtrees-redir
[NV_INIT] Setting up folder permissions for uploads
usermod: no changes
[NV_INIT] Starting Apache
---
[04:26:39] INFO: First boot : open the UI at https://<hostname>:5443 to access the start-up wizard
[04:26:40] INFO: MariaDB is available, if you want to use it please fill the values below
Host-name : core-mariadb
Port : 3306
Database user : service
Database password : <password>
Database name : webtrees
Database prefix : wt_
---

Architecture

aarch64

OS

HAos

@alexbelgium
Copy link
Owner

Hi, thanks very much! Indeed it seems it caused lots of issues - good thing that you are so tech-savy and were able to fix it easily for your system!! Thanks for your patience

Indeed now all ENV variables defined by default were removed (they caused issues with manual programmation anyway such as not building the correct MariaDB structure as you had shown), allowing to use the startup wizard for initial configuration. This should in theory not have affected existing installations, as the config.php.ini contains the different database values (and therefore the same content as those ENV). However indeed as you pointed out the migration script did not work, and added another subfolder /data which meant that the config.php.ini was not seen anymore, triggering Config file not found at /config/data/config.ini.php and a "new startup" wizard. This should be easily fixed by the new version ; for people that had the same issue as you I've added a line to copy content of /config/data/data/* in /config/data/ which should fix the link with the database directly

Owner 33 is the default PUID/PGID of the upstream webtrees script - in theory it should have been 1000:1000 for www-data I'll have to change this indeed

I am a bit more concerned by the fact that the hard path was stored in the database though - I though it was all relative paths to the root directory. However in my own MariaDB database under the table wt_site_setting I only see :
image so no INDEX_DIRECTORY ? I wonder if it is needed only when the data folder is not a subfolder of the root directory. In that case it might be easier for me to create a symlink between the new data folder location and the previous, so that webtrees still see the default path. This would solve the issue for other people. I still don't understand where it gets its /share/webtrees path as in your example - normally this path should only have been in the config.php.ini which was re-created in your case when you had again the startup wizard...

Data location folder was modified for two reasons actually (causing a bit this mayhem) : align with HA standard practices of using /config, which allows backups (people would think that backuping the Webtrees addon was saving their files - which is was not previously) ; and allow to use external disks like in your case. So in theory you should be able to change /config/data in the addon options with /mnt/2_uploads/webtrees/data, for example, to mount all files in your external disk.

I'll look at it a bit more this weekend!

@alexbelgium
Copy link
Owner

This is strange - I just did a test changing the path from /config/data to /config/data2 in my addon options. The code executed correctly : the /config/data folder was renamed to /config/data_migrated, all data went into /config/data2, and everything started up exactly as expected

@alexbelgium
Copy link
Owner

With version 2.2.1-4 I even set my DATA_LOCATION to a mounted external drive and everything worked as expected !

So apart from the issue of nested folders /data/data that you encountered, on my system everything is working as expected. I wonder if the variable INDEX_DIRECTORY in your MariaDB is not interferring in an unwanted manner with your system.

@arsenyspb
Copy link
Author

@alexbelgium what's your take on the vision / roadmap with additional details surfacing in webtrees/issues/5101? Feel free to continue there.

I've not yet continued testing (will do this week) to isolate NAS level permissions, still think they might be the culprit, despite full permissions granted at mount time.

@alexbelgium
Copy link
Owner

Hi, thanks for having made this thread. In terms of user experience simplicity, the easiest is to use the current system based on symlink that I put in place for the data folder. This means that INDEX_DIRECTORY should be overlooked - of course it should not exist in the first place unless it is specifically specified by the user.

In terms of robustness, indeed having a CLI to define data_folder would be a solution which would be much better in a programmation sense. This is for example how the nextcloud addon works : I have some script executing prior to the app being loaded, then I use their cli once the app is loaded to use their own functions to update configuration.

For your specific issue, have you tried setting the data folder to your nas drive from the addon options? This will migrate all your existing elements too

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Element will be closed automatically label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Element will be closed automatically
Projects
None yet
Development

No branches or pull requests

2 participants