Merge pull request #2340 from alexbelgium/codex/migrate-photoprism-addons-to-/addon_configs

Preserve legacy Photoprism config and add `.migrate` marker during migration
This commit is contained in:
Alexandre
2026-01-09 10:04:04 +01:00
committed by GitHub
5 changed files with 44 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
## ubuntu-2025-11-30-3 (2026-01-10)
- ⚠ MAJOR CHANGE : switch to the new config logic from homeassistant. Your configuration files will have migrated from /config/addons_config/photoprism to a folder only accessible from my Filebrowser addon called /addon_configs/xxx-photoprism. This avoids the addon to mess with your homeassistant configuration folder, and allows to backup the options. Migration of data should be automatic, but update any custom paths or permissions to avoid breakage. Please be sure to update all your links however ! For more information, see here : https://developers.home-assistant.io/blog/2023/11/06/public-addon-config/
## ubuntu-2025-11-30 (2025-11-30) ## ubuntu-2025-11-30 (2025-11-30)
- Update to latest version from photoprism/photoprism - Update to latest version from photoprism/photoprism

View File

@@ -76,7 +76,6 @@ Configurations can be done through the app webUI, except for the following optio
| `IMPORT_PATH` | str | `/share/photoprism/import` | Import files path | | `IMPORT_PATH` | str | `/share/photoprism/import` | Import files path |
| `BACKUP_PATH` | str | `/share/photoprism/backup` | Backup storage path | | `BACKUP_PATH` | str | `/share/photoprism/backup` | Backup storage path |
| `UPLOAD_NSFW` | bool | `true` | Allow uploads that may be offensive | | `UPLOAD_NSFW` | bool | `true` | Allow uploads that may be offensive |
| `CONFIG_LOCATION` | str | | Location of additional config.yaml |
| `graphic_drivers` | list | | Graphics driver (mesa) | | `graphic_drivers` | list | | Graphics driver (mesa) |
| `ingress_disabled` | bool | | Disable ingress for direct IP:port access | | `ingress_disabled` | bool | | Disable ingress for direct IP:port access |
| `localdisks` | str | | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) | | `localdisks` | str | | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) |
@@ -85,6 +84,8 @@ Configurations can be done through the app webUI, except for the following optio
| `cifspassword` | str | | SMB password for network shares | | `cifspassword` | str | | SMB password for network shares |
| `cifsdomain` | str | | SMB domain for network shares | | `cifsdomain` | str | | SMB domain for network shares |
**Migration notice**: Configuration files now live under `/addon_configs/xxx-photoprism/`. The add-on will attempt to migrate files from the old `/config/addons_config/photoprism/` location automatically, but any hard-coded paths, scripts, or backups pointing at the old location will need to be updated. Make a backup before upgrading in case custom paths or permissions cause the migration to fail.
### Example Configuration ### Example Configuration
```yaml ```yaml
@@ -106,12 +107,12 @@ cifsdomain: "workgroup"
### Advanced Configuration ### Advanced Configuration
Additional options can be configured in `/config/addons_config/photoprism/config.yaml`. Additional options can be configured in `/addon_configs/xxx-photoprism/config.yaml`.
Complete list: https://github.com/photoprism/photoprism/blob/develop/docker-compose.yml Complete list: https://github.com/photoprism/photoprism/blob/develop/docker-compose.yml
### External Database Setup ### External Database Setup
For external database, add to `addons_config/photoprism/config.yaml`: For external database, add to `/addon_configs/xxx-photoprism/config.yaml`:
```yaml ```yaml
PHOTOPRISM_DATABASE_DRIVER: "mysql" PHOTOPRISM_DATABASE_DRIVER: "mysql"
@@ -146,5 +147,3 @@ You can access it via portainer addon or executing `docker exec -it <photoprism
Create an issue on github Create an issue on github
[repository]: https://github.com/alexbelgium/hassio-addons [repository]: https://github.com/alexbelgium/hassio-addons

View File

@@ -77,15 +77,16 @@ image: ghcr.io/alexbelgium/photoprism-{arch}
ingress: true ingress: true
ingress_stream: true ingress_stream: true
map: map:
- addon_config:rw
- homeassistant_config:rw
- media:rw - media:rw
- share:rw - share:rw
- config:rw
- ssl:ro - ssl:ro
name: Photoprism name: Photoprism
options: options:
env_vars: [] env_vars: []
BACKUP_PATH: /share/photoprism/backup BACKUP_PATH: /share/photoprism/backup
CONFIG_LOCATION: /config/addons_config/photoprism/config.yaml CONFIG_LOCATION: /config
DB_TYPE: sqlite DB_TYPE: sqlite
IMPORT_PATH: /share/photoprism/import IMPORT_PATH: /share/photoprism/import
ORIGINALS_PATH: /share/photoprism/originals ORIGINALS_PATH: /share/photoprism/originals
@@ -130,5 +131,5 @@ services:
slug: photoprism slug: photoprism
udev: true udev: true
url: https://github.com/alexbelgium/hassio-addons url: https://github.com/alexbelgium/hassio-addons
version: "ubuntu-2025-11-30" version: "ubuntu-2025-11-30-3"
video: true video: true

View File

@@ -12,6 +12,7 @@ fi
bashio::log.info "Preparing scripts" bashio::log.info "Preparing scripts"
echo "... creating structure" echo "... creating structure"
mkdir -p /config
mkdir -p \ mkdir -p \
/data/photoprism/originals \ /data/photoprism/originals \
/data/photoprism/import \ /data/photoprism/import \
@@ -23,6 +24,8 @@ echo "... setting permissions"
chmod -R 777 /data/photoprism chmod -R 777 /data/photoprism
chown -Rf photoprism:photoprism /data/photoprism chown -Rf photoprism:photoprism /data/photoprism
chmod -Rf a+rwx /data/photoprism chmod -Rf a+rwx /data/photoprism
chmod -R 777 /config
chown -Rf photoprism:photoprism /config
for line in BACKUP_PATH IMPORT_PATH ORIGINALS_PATH STORAGE_PATH; do for line in BACKUP_PATH IMPORT_PATH ORIGINALS_PATH STORAGE_PATH; do
mkdir -p "$line" mkdir -p "$line"
chmod -R 777 "$line" chmod -R 777 "$line"

View File

@@ -0,0 +1,31 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
slug=photoprism
new_config_location="/config"
new_config_dir="$new_config_location"
mkdir -p "$new_config_dir"
if bashio::config.has_value "CONFIG_LOCATION" && [[ "$(bashio::config "CONFIG_LOCATION")" != "/config" ]]; then
old_config_location="$(bashio::config "CONFIG_LOCATION")"
else
old_config_location="/config/addons_config/photoprism/config.yaml"
fi
old_config_dir="$(dirname "$old_config_location")"
if [ "$old_config_dir" != "$new_config_dir" ] && [ -d "$old_config_dir" ]; then
echo "Migrating $old_config_dir to /addon_configs/xxx-$slug"
cp -rnf "$old_config_dir"/. "$new_config_dir"/ || true
echo "Migrated to internal config folder accessible at /addon_configs/xxx-$slug" \
> "$old_config_dir/.migrate"
fi
if [ "$old_config_location" != "$new_config_location" ]; then
bashio::log.info "Updating CONFIG_LOCATION to $new_config_location"
bashio::addon.option "CONFIG_LOCATION" "$new_config_location"
fi
if [ -d /config/addons_config ]; then
rm -rf /config/addons_config
fi