Closed poperigby closed 2 weeks ago
Do you have a simple config to repro? Seems like services.mealie.enable = true;
wasn't enough
edit: nvm, my issue was due to https://github.com/mealie-recipes/mealie/issues/3852
@eclairevoyant where you able to reproduce after dealing with that issue? I don't have anything in my config that could be causing this, but I'll post it anyway: https://codeberg.org/PopeRigby/nixos/src/commit/706444f10ff494483954c3d6ef838da56e9201b4/systems/x86_64-linux/haddock/services/mealie.nix
Yes, I could repro after patching the package to get around the /run/secrets issue. I only set .enable and .package.
services.mealie = {
enable = true;
package = pkgs.mealie.overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
(pkgs.fetchpatch {
url = "https://github.com/mealie-recipes/mealie/commit/445754c5d844ccf098f3678bc4f3cc9642bdaad6.patch";
hash = "sha256-ZdATmSYxhGSjoyrni+b5b8a30xQPlUeyp3VAc8OBmDY=";
revert = true;
})
];
});
};
I don't understand how it's able to work even when the /run/secret
patch revert is not applied...
Anyway, found a problem and created a PR in upstream: https://github.com/mealie-recipes/mealie/pull/3882
Not really sure it's the problem, but was a low hanging fruit.
Could you add https://patch-diff.githubusercontent.com/raw/mealie-recipes/mealie/pull/3882.patch
to your patches and try again ?
I tried that patch and it sadly still didn't work. I confirmed the variable was set with systemctl show mealie
:
ALEMBIC_CONFIG_FILE=/nix/store/ks7di8rg60p6v4liw7fxrrgp4k0m4rfv-python3.11-mealie-1.9.0/config/alembic.ini
I also wiped Mealie's data directory and database and recreated them before starting.
@litchipi do you have any other ideas?
@poperigby It's caused because of the ugly PROJECT_DIR = Path(__file__).parent.parent.parent
lines.
I'm working on a PR that will substitute all of these for the installation path in the nix store, this should do the trick hopefully.
@poperigby Could you try now, using the master
branch for nixpkgs ?
@litchipi It still doesn't work, same error. I have no idea what's going on here.
@poperigby Is it the same error ?
Yeah, it still seems to be the same error:
Aug 14 19:41:01 haddock mealie[2543954]: INFO 2024-08-14T19:41:01 - initializing backup restore
Aug 14 19:41:01 haddock mealie[2543954]: INFO 2024-08-14T19:41:01 - dropping all database tables
Aug 14 19:41:02 haddock mealie[2543954]: INFO 2024-08-14T19:41:02 - importing database tables
Aug 14 19:41:02 haddock mealie[2543954]: ERROR 2024-08-14T19:41:02 - Path doesn't exist: '/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/alembic'. Please use the 'init' command to create a new scripts folder.
Aug 14 19:41:02 haddock mealie[2543954]: Traceback (most recent call last):
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/lib/python3.12/site-packages/mealie/routes/admin/admin_backups.py", line 105, in import_one
Aug 14 19:41:02 haddock mealie[2543954]: backup.restore(file)
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/lib/python3.12/site-packages/mealie/services/backups_v2/backup_v2.py", line 101, in restore
Aug 14 19:41:02 haddock mealie[2543954]: self.db_exporter.restore(database_json)
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/lib/python3.12/site-packages/mealie/services/backups_v2/alchemy_exporter.py", line 164, in restore
Aug 14 19:41:02 haddock mealie[2543954]: command.upgrade(alembic_cfg, alembic_version)
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/78sps7nkzmii8k6l9plwqj2c9lcs0qiz-python3.12-alembic-1.13.1/lib/python3.12/site-packages/alembic/command.py", line 383, in upgrade
Aug 14 19:41:02 haddock mealie[2543954]: script = ScriptDirectory.from_config(config)
Aug 14 19:41:02 haddock mealie[2543954]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/78sps7nkzmii8k6l9plwqj2c9lcs0qiz-python3.12-alembic-1.13.1/lib/python3.12/site-packages/alembic/script/base.py", line 226, in from_config
Aug 14 19:41:02 haddock mealie[2543954]: return ScriptDirectory(
Aug 14 19:41:02 haddock mealie[2543954]: ^^^^^^^^^^^^^^^^
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/78sps7nkzmii8k6l9plwqj2c9lcs0qiz-python3.12-alembic-1.13.1/lib/python3.12/site-packages/alembic/script/base.py", line 107, in __init__
Aug 14 19:41:02 haddock mealie[2543954]: raise util.CommandError(
Aug 14 19:41:02 haddock mealie[2543954]: alembic.util.exc.CommandError: Path doesn't exist: '/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/alembic'. Please use the 'init' command to create a new scripts folder.
Aug 14 19:41:02 haddock mealie[2543954]: ERROR 2024-08-14T19:41:02 - Path doesn't exist: '/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/alembic'. Please use the 'init' command to create a new scripts folder.
Aug 14 19:41:02 haddock mealie[2543954]: Traceback (most recent call last):
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/lib/python3.12/site-packages/mealie/routes/admin/admin_backups.py", line 105, in import_one
Aug 14 19:41:02 haddock mealie[2543954]: backup.restore(file)
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/lib/python3.12/site-packages/mealie/services/backups_v2/backup_v2.py", line 101, in restore
Aug 14 19:41:02 haddock mealie[2543954]: self.db_exporter.restore(database_json)
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/lib/python3.12/site-packages/mealie/services/backups_v2/alchemy_exporter.py", line 164, in restore
Aug 14 19:41:02 haddock mealie[2543954]: command.upgrade(alembic_cfg, alembic_version)
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/78sps7nkzmii8k6l9plwqj2c9lcs0qiz-python3.12-alembic-1.13.1/lib/python3.12/site-packages/alembic/command.py", line 383, in upgrade
Aug 14 19:41:02 haddock mealie[2543954]: script = ScriptDirectory.from_config(config)
Aug 14 19:41:02 haddock mealie[2543954]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/78sps7nkzmii8k6l9plwqj2c9lcs0qiz-python3.12-alembic-1.13.1/lib/python3.12/site-packages/alembic/script/base.py", line 226, in from_config
Aug 14 19:41:02 haddock mealie[2543954]: return ScriptDirectory(
Aug 14 19:41:02 haddock mealie[2543954]: ^^^^^^^^^^^^^^^^
Aug 14 19:41:02 haddock mealie[2543954]: File "/nix/store/78sps7nkzmii8k6l9plwqj2c9lcs0qiz-python3.12-alembic-1.13.1/lib/python3.12/site-packages/alembic/script/base.py", line 107, in __init__
Aug 14 19:41:02 haddock mealie[2543954]: raise util.CommandError(
Aug 14 19:41:02 haddock mealie[2543954]: alembic.util.exc.CommandError: Path doesn't exist: '/nix/store/z9a8pij846xx0yh29ygc6lk2m9iq6ch1-mealie-1.11.0/alembic'. Please use the 'init' command to create a new scripts folder.
Aug 14 19:41:02 haddock mealie[2543954]: INFO 2024-08-14T19:41:02 - [192.168.1.1:0] 500 Internal Server Error "POST /api/admin/backups/mealie_2024.06.10.22.49.23.zip/restore HTTP/1.1"
Performing this operation actually borks the Mealie install too. Presumably because it's dropping the database before performing the backup :grimacing:.
Alright I got something.
On the NixOS package, we configure the alembic.ini
configuration to the folder where the scripts are located
This config is ignored in the backup_v2/alchemy_exporter.py
script, as it uses a blank config to setup the restoration.
Substituting to the good path should fix the alchemy scripts path error
Try with:
package = pkgs.mealie.overrideAttrs (o: {
postPatch = o.postPatch + ''
substituteInPlace mealie/services/backups_v2/alchemy_exporter.py \
--replace-fail '"script_location", path.join(PROJECT_DIR, "alembic")' '"script_location", "${o.src}/alembic"'
'';
});
Let me know if that fixes the issue, I may open a PR in upstream for this if that resolves the issue
@litchipi That totally worked! Thanks so much!
@litchipi I'll close this now. I think an upstream PR would be a good idea :slightly_smiling_face:.
Describe the bug
I'm attempting to restore a backup of Mealie using the built-in restore tool, but I'm running into an error:
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
The restore succeeds
Notify maintainers
@litchipi
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.