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

Migrate database and config from Home Assistant /config to addon's /config #16334

Open
felipecrs opened this issue Feb 5, 2025 · 6 comments
Open
Labels
enhancement New feature or request

Comments

@felipecrs
Copy link
Contributor

Describe what you are trying to accomplish and why in non technical terms

Home Assistant introduced support for add-on specific /config last year.

This is great because it lets add-ons persist data across reinstallations without having to pollute Home Assistant's /config.

This fixes the inconsistency of when backing up Home Assistant, which would end up also backing up Frigate's database which is often huge in size.

Also, it fixes the inconsistency of when you tick the backup option when upgrading Frigate add-on, but it won't actually backup the config and the database, given its outside of the addon's backup scope.

Describe the solution you'd like
Maybe starting with the next version, the addon should request mount both the addon config and Home Assistant config, and then, during initialization it should check for the presence of the config and database at /homeassistant and migrate it to the addon's /config.

Describe alternatives you've considered
There is none. Users cannot do this on their own as it would at least require addon changes to mount both config dirs.

Additional context
One good feature of storing the database in homeassistant's config dir is that it will be retained across reinstallations and even across switching from the stable to beta version of the add-on.

The new addon config can also be retained during reinstallation, all it takes is to not tick the Delete permanently addon data option during the uninstall (which comes unticked by default anyway).

But, in order to retain the same config and backup across switching from Stable to Beta, users require a manual step using the Terminal add-on or the VS Code add-on, which is to rename the directory in /addon_configs from the Frigate Stable addon slug to the Beta addon slug. Not big deal.

I'd say very few people would need it anyway, documenting it would be very acceptable.

What do you guys think?

Remember when in the release notes there's a reminder like Backup your database before upgrading? That will come for free basically, as long as people don't untick the Backup add-on before upgrade option which comes even ticked by default. Then, restoring it in case things go wrong would be as simple as restoring any Home Assistant backup.

@felipecrs felipecrs added the enhancement New feature or request label Feb 5, 2025
@NickM-27
Copy link
Collaborator

NickM-27 commented Feb 5, 2025

I don't think this is a feature request for frigate, most likely just requires changes in the addon repo

@felipecrs
Copy link
Contributor Author

felipecrs commented Feb 5, 2025

Not only there. The migration script would reside here.

@felipecrs
Copy link
Contributor Author

I can help implementing this if you accept. How much time do we have before 0.15 is out? :D

@hawkeye217
Copy link
Collaborator

We're already in RC for 0.15, we're not looking to add features at this point. Any changes would go into 0.16.

@NickM-27
Copy link
Collaborator

NickM-27 commented Feb 5, 2025

This definitely won't happen for 0.15. In my opinion it is best to keep the frigate code unaware of if it is installed as an addon or not. If the changes are restricted to just S6 that seems fine, but we'd need to think about exactly how this will work.

@felipecrs
Copy link
Contributor Author

Yes, the changes would be restricted to the S6 initialization scripts. We already have some quirks that only works when running as add-on.

I believe you'll find the implementation clean. Let me give it a try.

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

No branches or pull requests

3 participants