karlomikus / bar-assistant

Bar assistant is a all-in-one solution for managing your home bar
https://barassistant.app
MIT License
442 stars 22 forks source link

Consider Meilisearch migration strategy for Docker instances #272

Closed augustf closed 2 months ago

augustf commented 2 months ago

I'm not sure how prevalent Docker instances are for Bar Assistant users, but there's not really a viable path for updating Meilisearch from any version to any other version (I started on 1.1, and tried to go to 1.2). Reading through the MeiliSearch documentation, upgrading any version from any other doesn't trigger any sort of data migration. Instead, you can use the migration script at https://github.com/meilisearch/meilisearch-migration/ (meant for non-Docker use cases) or mess around with the Docker invocation to export and import dumps (https://www.meilisearch.com/docs/learn/cookbooks/docker) in a way my particular Docker setup doesn't support.

A database that has to be fully re-created with each and every upgrade doesn't make me think well of it as a sustainable stack choice. It's probably too late for this codebase to consider a more robustly architected search product, but perhaps some helper scripts to assist in migrating on a Docker platform would be helpful?

augustf commented 2 months ago

After some further investigation, I concluded that the limitations of MeiliSearch really don't allow a reasonable Bar Assistant solution to the problem. So I leave this here as a note that MeiliSearch isn't a reasonably upgradeable stack component without a huge amount of manual headaches and intervention, and users should know that before wasting a lot of time, thinking that swapping Meili Docker versions will have a sane effect. Bulk exporting all the cocktails and re-importing on each Meili upgrade may be the easiest way for Docker users.

zhdenny commented 2 months ago

Have you read this? It's incredibly easy to update Meilisearch using the instructions provided here.

https://docs.barassistant.app/faq/#how-do-i-update-meilisearch

augustf commented 2 months ago

I had used that procedure in a past upgrade, but wanted to retain the MeiliSearch data in this case. Certainly, if the data there isn’t a factor, that’s a great option. An upgrade was ultimately possible, but it involved a lot of fiddling around with Docker.

karlomikus commented 2 months ago

I can see the need to backup meilisearch data if you create your custom api/client tokens, since they will get lost if you destroy the container. Or you have a huge index and reindexing takes some time, but I don't think there are a lot of users that do this.

I try to keep meilisearch indexing simple, that's why there are some built in commands like php artisan bar:refresh-search, which always syncs the data when you restart docker container.

If you really want to keep your existing meilisearch data when updating between versions then you need to follow official meilisearch guide. I agree it's not the simplest way, especially because even bugfix releases are not compatible between versions. But, unless you really need the new features, there is no reason to constantly keep up to date with meilisearch.

Hopefully they improve migration steps in the future :D