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

[Feature Request] Deprecate storing config path in database #5101

Closed
arsenyspb opened this issue Jan 10, 2025 · 5 comments
Closed

[Feature Request] Deprecate storing config path in database #5101

arsenyspb opened this issue Jan 10, 2025 · 5 comments

Comments

@arsenyspb
Copy link

Hi @fisharebest ,

What would be the impact of deprecating the wt_site_setting's INDEX_DIRECTORY on schema in upcoming releases, and e.g. moving it strictly to config.ini.php?

It would've allowed a more stateless architecture with datastore decoupled that would allow easier underlying migrations with scripts that move files (e.g. from local storage to a NAS or FUSE-based object store) without the need to hook back in to the DB and do updates like:

UPDATE wt_site_setting
SET setting_value = '/new/path/to/'
WHERE setting_name = 'INDEX_DIRECTORY';

We're discussing this as part of issues/1707 with @alexbelgium who is doing amazing job for both webtrees and Home Assistant communities: he is maintaining and innovating on Hassio Webtrees add-on. It's a fantastic wrapper on top of dockerized webtrees from @NathanVaughn 's builds, which from your main.

Making webtrees maintainance more decoupled with focal area in config.ini.php only would've opened up a very good avenue for Hassio owners to manage add-on upgrades with minimal maintenance.

@fisharebest
Copy link
Owner

webtrees has a folder for system data /data, used for cache, temp files, etc.

webtrees also needs to store user data such as media files, GEDCOM files.

By default this also goes in /data, but it can be configured to use any other folder with read/write permission, aka the INDEX_DIRECTORY setting.

The roadmap in webtrees is to allow the user data to be stored in other locations. The internal changes have been made -we use the flysystem abstraction layer internally and can easily store data in cloud storage, remote filesystems, etc.

The only thing outstanding is the configuration. Instead of INDEX_DIRECTORY I anticipate a number of modules, such as DropBox, GoogleDrive, SFTP, etc.

So, I'm not sure that moving this option to config.ini.php fits in with this roadmap.

If I understand correctly, you are using symlinks to some other storage. Might it be better to specify the desired location directly. This could be done with a (very) simple module that selects whatever local filesystem you like - including reading a location from config.ini.php directly.

On a related note, I have just started writing a CLI interface for configuring webtrees. Creating users/trees, updating config, etc. Would this be another solution for you - a CLI script that updates this setting?

@alexbelgium
Copy link

Hi, thanks for this feedback and clear explanations.

Regarding the homeassistant addon, it is globally a shell around NathanVaughn's container. The key difference is that most options are defined through the HA interface (base url ; ssl certificates ...) and a serie of scripts propagates those options to the webtree app itself (for example through environment variables ; direct scripts modification using sed ; symlinks...). This allows consistency with other addons way of working to simplify user experience, and use HA's systems for backups ; mysql availability... As HA doesn't allow to use volumes mapping, I've symlinked /data and /modules_v4 to a folder that is accessible for the user. Up until now it works very fine - but indeed arsernyspb has identified that the mapping of the data_location is not very robust.

A cli would be great to allow to modify by script some options in a much more robust manner. I have other addons working with this type of logic, such as one based on Nextcloud.

Btw congrats on your incredible app. I'm also a geneaology enthusiast and have been using it for a long time.

@fisharebest
Copy link
Owner

There is already a CLI interface - though it's not documented and the syntax/commands are still liable to change.
When finished, it will allow a fully-scripted setup, without needing the GUI.

Commit 0683965 adds a site-setting command.

$ php index.php site-setting --help
Description:
  Configure site settings

Usage:
  site-setting [options] [--] [<setting-name> [<setting-value>]]

Arguments:
  setting-name          The setting to update
  setting-value         The new value of the setting.

Options:
  -l, --list            List site settings (optionally filtered by setting name)
  -d, --delete          Delete a site setting
  -h, --help            Display help for the given command. When no command is given display help for the list command
      --silent          Do not output any message
  -q, --quiet           Only errors are displayed. All other output is suppressed
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
$ php index.php site-setting --list DIR
+-----------------+---------------------------------------+
| Setting name    | Setting value                         |
+-----------------+---------------------------------------+
| INDEX_DIRECTORY | /Users/gr4376/Projects/webtrees/data/ |
+-----------------+---------------------------------------+
$ php index.php site-setting INDEX_DIRECTORY /foo/bar

                                                                                                                        
 [OK] Site setting ‘INDEX_DIRECTORY’ was changed from ‘/Users/gr4376/Projects/webtrees/data/’ to ‘/foo/bar’.            
                                                                                                                        

@NathanVaughn
Copy link

NathanVaughn commented Jan 14, 2025

I know this issue is marked as closed, but I would love to hear about it when this CLI is ready. I (try to) maintain one of the two most popular Docker images for webtrees, and I've created a pretty gnarly Python script to automate the setup wizard and configure webtrees on startup. An officially supported CLI would do wonders for making webtrees easier to Dockerize.

@fisharebest
Copy link
Owner

Some CLI commands are pretty much complete:

  • creating/updating data/config.ini.php
  • updating site/tree/user settings
  • site on/off-line

Others are still in progress:

  • creating/updating users and trees
  • import/export GEDCOM files
  • database migrations

I hope to have these ready for the next release.

If you want to experiment with the latest dev code, use php index.php to see a list of commands. Feedback welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants