mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-12 05:16:25 +03:00
Merge pull request #314294 from james-atkins/mealie-update
mealie: 1.2.0 -> 1.7.0
This commit is contained in:
commit
080af6461e
5 changed files with 12 additions and 142 deletions
|
@ -28,8 +28,6 @@ in
|
||||||
Configuration of the Mealie service.
|
Configuration of the Mealie service.
|
||||||
|
|
||||||
See [the mealie documentation](https://nightly.mealie.io/documentation/getting-started/installation/backend-config/) for available options and default values.
|
See [the mealie documentation](https://nightly.mealie.io/documentation/getting-started/installation/backend-config/) for available options and default values.
|
||||||
|
|
||||||
In addition to the official documentation, you can set {env}`MEALIE_LOG_FILE`.
|
|
||||||
'';
|
'';
|
||||||
example = {
|
example = {
|
||||||
ALLOW_SIGNUP = "false";
|
ALLOW_SIGNUP = "false";
|
||||||
|
@ -61,6 +59,7 @@ in
|
||||||
PRODUCTION = "true";
|
PRODUCTION = "true";
|
||||||
ALEMBIC_CONFIG_FILE="${pkg}/config/alembic.ini";
|
ALEMBIC_CONFIG_FILE="${pkg}/config/alembic.ini";
|
||||||
API_PORT = toString cfg.port;
|
API_PORT = toString cfg.port;
|
||||||
|
BASE_URL = "http://localhost:${cfg.port}";
|
||||||
DATA_DIR = "/var/lib/mealie";
|
DATA_DIR = "/var/lib/mealie";
|
||||||
CRF_MODEL_PATH = "/var/lib/mealie/model.crfmodel";
|
CRF_MODEL_PATH = "/var/lib/mealie/model.crfmodel";
|
||||||
} // (builtins.mapAttrs (_: val: toString val) cfg.settings);
|
} // (builtins.mapAttrs (_: val: toString val) cfg.settings);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import ./make-test-python.nix ({ pkgs, ...} :
|
||||||
{
|
{
|
||||||
name = "mealie";
|
name = "mealie";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
maintainers = [ litchipi ];
|
maintainers = [ litchipi anoa ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
|
|
@ -6,7 +6,7 @@ src: version:
|
||||||
|
|
||||||
yarnOfflineCache = fetchYarnDeps {
|
yarnOfflineCache = fetchYarnDeps {
|
||||||
yarnLock = "${src}/frontend/yarn.lock";
|
yarnLock = "${src}/frontend/yarn.lock";
|
||||||
hash = "sha256-zQUD/PQWzp2Q6fiVmLicvSusXffu6s9q3x/aAUnCN38=";
|
hash = "sha256-a2kIOQHaMzaMWId6+SSYN+SPQM2Ipa+F1ztFZgo3R6A=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
diff --git a/mealie/core/root_logger.py b/mealie/core/root_logger.py
|
|
||||||
index 29db504f..3da5ef84 100644
|
|
||||||
--- a/mealie/core/root_logger.py
|
|
||||||
+++ b/mealie/core/root_logger.py
|
|
||||||
@@ -9,7 +9,6 @@ DATA_DIR = determine_data_dir()
|
|
||||||
|
|
||||||
from .config import get_app_settings # noqa E402
|
|
||||||
|
|
||||||
-LOGGER_FILE = DATA_DIR.joinpath("mealie.log")
|
|
||||||
DATE_FORMAT = "%d-%b-%y %H:%M:%S"
|
|
||||||
LOGGER_FORMAT = "%(levelname)s: %(asctime)s \t%(message)s"
|
|
||||||
|
|
||||||
@@ -40,19 +39,17 @@ def get_logger_config():
|
|
||||||
level=log_level,
|
|
||||||
)
|
|
||||||
|
|
||||||
- output_file_handler = logging.FileHandler(LOGGER_FILE)
|
|
||||||
handler_format = logging.Formatter(LOGGER_FORMAT, datefmt=DATE_FORMAT)
|
|
||||||
- output_file_handler.setFormatter(handler_format)
|
|
||||||
|
|
||||||
# Stdout
|
|
||||||
stdout_handler = logging.StreamHandler(sys.stdout)
|
|
||||||
stdout_handler.setFormatter(handler_format)
|
|
||||||
|
|
||||||
return LoggerConfig(
|
|
||||||
- handlers=[output_file_handler, stdout_handler],
|
|
||||||
+ handlers=[stdout_handler],
|
|
||||||
format="%(levelname)s: %(asctime)s \t%(message)s",
|
|
||||||
date_format="%d-%b-%y %H:%M:%S",
|
|
||||||
- logger_file=LOGGER_FILE,
|
|
||||||
+ logger_file=None,
|
|
||||||
level=log_level,
|
|
||||||
)
|
|
||||||
|
|
||||||
diff --git a/mealie/routes/admin/admin_log.py b/mealie/routes/admin/admin_log.py
|
|
||||||
index ac12c12e..0de98b99 100644
|
|
||||||
--- a/mealie/routes/admin/admin_log.py
|
|
||||||
+++ b/mealie/routes/admin/admin_log.py
|
|
||||||
@@ -1,6 +1,5 @@
|
|
||||||
from fastapi import APIRouter
|
|
||||||
|
|
||||||
-from mealie.core.root_logger import LOGGER_FILE
|
|
||||||
from mealie.core.security import create_file_token
|
|
||||||
|
|
||||||
router = APIRouter(prefix="/logs")
|
|
||||||
@@ -9,15 +8,13 @@ router = APIRouter(prefix="/logs")
|
|
||||||
@router.get("/{num}")
|
|
||||||
async def get_log(num: int):
|
|
||||||
"""Doc Str"""
|
|
||||||
- with open(LOGGER_FILE, "rb") as f:
|
|
||||||
- log_text = tail(f, num)
|
|
||||||
- return log_text
|
|
||||||
+ return ""
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("")
|
|
||||||
async def get_log_file():
|
|
||||||
"""Returns a token to download a file"""
|
|
||||||
- return {"fileToken": create_file_token(LOGGER_FILE)}
|
|
||||||
+ return {"fileToken": create_file_token("nofile")}
|
|
||||||
|
|
||||||
|
|
||||||
def tail(f, lines=20):
|
|
||||||
diff --git a/mealie/routes/admin/admin_maintenance.py b/mealie/routes/admin/admin_maintenance.py
|
|
||||||
index 23ef8369..322b580f 100644
|
|
||||||
--- a/mealie/routes/admin/admin_maintenance.py
|
|
||||||
+++ b/mealie/routes/admin/admin_maintenance.py
|
|
||||||
@@ -6,7 +6,6 @@ from pathlib import Path
|
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException
|
|
||||||
|
|
||||||
-from mealie.core.root_logger import LOGGER_FILE
|
|
||||||
from mealie.pkgs.stats import fs_stats
|
|
||||||
from mealie.routes._base import BaseAdminController, controller
|
|
||||||
from mealie.schema.admin import MaintenanceSummary
|
|
||||||
@@ -73,8 +72,6 @@ class AdminMaintenanceController(BaseAdminController):
|
|
||||||
Get the maintenance summary
|
|
||||||
"""
|
|
||||||
log_file_size = 0
|
|
||||||
- with contextlib.suppress(FileNotFoundError):
|
|
||||||
- log_file_size = os.path.getsize(LOGGER_FILE)
|
|
||||||
|
|
||||||
return MaintenanceSummary(
|
|
||||||
data_dir_size=fs_stats.pretty_size(fs_stats.get_dir_size(self.folders.DATA_DIR)),
|
|
||||||
@@ -85,7 +82,7 @@ class AdminMaintenanceController(BaseAdminController):
|
|
||||||
|
|
||||||
@router.get("/logs", response_model=MaintenanceLogs)
|
|
||||||
def get_logs(self, lines: int = 200):
|
|
||||||
- return MaintenanceLogs(logs=tail_log(LOGGER_FILE, lines))
|
|
||||||
+ return MaintenanceLogs(logs="")
|
|
||||||
|
|
||||||
@router.get("/storage", response_model=MaintenanceStorageDetails)
|
|
||||||
def get_storage_details(self):
|
|
||||||
@@ -137,9 +134,6 @@ class AdminMaintenanceController(BaseAdminController):
|
|
||||||
Purges the logs
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
- with contextlib.suppress(FileNotFoundError):
|
|
||||||
- os.remove(LOGGER_FILE)
|
|
||||||
- LOGGER_FILE.touch()
|
|
||||||
return SuccessResponse.respond("Logs cleaned")
|
|
||||||
except Exception as e:
|
|
||||||
raise HTTPException(status_code=500, detail=ErrorResponse.respond("Failed to clean logs")) from e
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ lib
|
{ lib
|
||||||
, callPackage
|
, callPackage
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchpatch
|
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, nixosTests
|
, nixosTests
|
||||||
, python3Packages
|
, python3Packages
|
||||||
|
@ -10,21 +9,17 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "1.2.0";
|
version = "1.7.0";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "mealie-recipes";
|
owner = "mealie-recipes";
|
||||||
repo = "mealie";
|
repo = "mealie";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-Kc49XDWcZLeJaYgiAO2/mHeVSOLMeiPr3U32e0IYfdU=";
|
hash = "sha256-z7kLBDzvzPWY7XmpROMpw3LcDpsl+hA+w1SdhrD/yNU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
frontend = callPackage (import ./mealie-frontend.nix src version) { };
|
frontend = callPackage (import ./mealie-frontend.nix src version) { };
|
||||||
|
|
||||||
pythonpkgs = python3Packages.override {
|
pythonpkgs = python3Packages;
|
||||||
overrides = self: super: {
|
|
||||||
pydantic = python3Packages.pydantic_1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
python = pythonpkgs.python;
|
python = pythonpkgs.python;
|
||||||
|
|
||||||
crfpp = stdenv.mkDerivation {
|
crfpp = stdenv.mkDerivation {
|
||||||
|
@ -37,34 +32,11 @@ let
|
||||||
hash = "sha256-XNps3ZApU8m07bfPEnvip1w+3hLajdn9+L5+IpEaP0c=";
|
hash = "sha256-XNps3ZApU8m07bfPEnvip1w+3hLajdn9+L5+IpEaP0c=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mealie_patch = { name, commit, hash }: fetchpatch {
|
|
||||||
inherit name hash;
|
|
||||||
url = "https://github.com/mealie-recipes/mealie/commit/${commit}.patch";
|
|
||||||
};
|
|
||||||
|
|
||||||
in pythonpkgs.buildPythonPackage rec {
|
in pythonpkgs.buildPythonPackage rec {
|
||||||
pname = "mealie";
|
pname = "mealie";
|
||||||
inherit version src;
|
inherit version src;
|
||||||
pyproject = true;
|
pyproject = true;
|
||||||
|
|
||||||
patches = [
|
|
||||||
# See https://github.com/mealie-recipes/mealie/pull/3102
|
|
||||||
# Replace hardcoded paths in code with environment variables (meant for inside Docker only)
|
|
||||||
# So we can configure easily where the data is stored on the server
|
|
||||||
(mealie_patch {
|
|
||||||
name = "model-path.patch";
|
|
||||||
commit = "e445705c5d26b895d806b96b2f330d4e9aac3723";
|
|
||||||
hash = "sha256-cf0MwvT81lNBTjvag8UUEbXkBu8Jyi/LFwUcs4lBVcY=";
|
|
||||||
})
|
|
||||||
(mealie_patch {
|
|
||||||
name = "alembic-cfg-path.patch";
|
|
||||||
commit = "06c528bfac0708af66aa0629f2e2232ddf07768f";
|
|
||||||
hash = "sha256-IOgdZK7dmWeX2ox16J9v+bOS7nHgCMvCJy6RNJLj0p8=";
|
|
||||||
})
|
|
||||||
./mealie-logs-to-stdout.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pythonpkgs.poetry-core
|
pythonpkgs.poetry-core
|
||||||
pythonpkgs.pythonRelaxDepsHook
|
pythonpkgs.pythonRelaxDepsHook
|
||||||
|
@ -82,6 +54,7 @@ in pythonpkgs.buildPythonPackage rec {
|
||||||
aniso8601
|
aniso8601
|
||||||
appdirs
|
appdirs
|
||||||
apprise
|
apprise
|
||||||
|
authlib
|
||||||
bcrypt
|
bcrypt
|
||||||
extruct
|
extruct
|
||||||
fastapi
|
fastapi
|
||||||
|
@ -90,15 +63,16 @@ in pythonpkgs.buildPythonPackage rec {
|
||||||
httpx
|
httpx
|
||||||
jinja2
|
jinja2
|
||||||
lxml
|
lxml
|
||||||
|
openai
|
||||||
orjson
|
orjson
|
||||||
paho-mqtt
|
paho-mqtt
|
||||||
passlib
|
|
||||||
pillow
|
pillow
|
||||||
|
pillow-heif
|
||||||
psycopg2
|
psycopg2
|
||||||
|
pydantic-settings
|
||||||
pyhumps
|
pyhumps
|
||||||
pytesseract
|
pyjwt
|
||||||
python-dotenv
|
python-dotenv
|
||||||
python-jose
|
|
||||||
python-ldap
|
python-ldap
|
||||||
python-multipart
|
python-multipart
|
||||||
python-slugify
|
python-slugify
|
||||||
|
@ -160,7 +134,7 @@ in pythonpkgs.buildPythonPackage rec {
|
||||||
homepage = "https://mealie.io";
|
homepage = "https://mealie.io";
|
||||||
changelog = "https://github.com/mealie-recipes/mealie/releases/tag/${src.rev}";
|
changelog = "https://github.com/mealie-recipes/mealie/releases/tag/${src.rev}";
|
||||||
license = licenses.agpl3Only;
|
license = licenses.agpl3Only;
|
||||||
maintainers = with maintainers; [ litchipi ];
|
maintainers = with maintainers; [ litchipi anoa ];
|
||||||
mainProgram = "mealie";
|
mainProgram = "mealie";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue