Skip to content

Commit 78c0d1d

Browse files
committed
Version [5.3.2]
1 parent ceb770d commit 78c0d1d

28 files changed

+1926
-950
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88

99

10+
## Version [5.3.2] - 2024-10-18 🚀
11+
12+
### Fixed 🛠️
13+
14+
- [Issue #60](https://github.com/I-am-PUID-0/DMB/issues/60) Does not correctly handle deleted files in new Riven releases 🐛
15+
- [Issue #61](https://github.com/I-am-PUID-0/DMB/issues/61) Riven Backend v0.16.0 Broke Settings Update 🐛
16+
- [Issue #62](https://github.com/I-am-PUID-0/DMB/issues/62) Riven Frontend v0.14.0 Broke VersionFilePath 🐛
17+
- [Issue #63](https://github.com/I-am-PUID-0/DMB/issues/63) Riven Frontend v0.16.0 Broke Frontend Build 🐛 - This may be a temporary fix...
18+
19+
1020
## Version [5.3.1] - 2024-10-15 🚀
1121

1222
### Fixed 🛠️

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ RUN \
6060
RUN sed -i '/export default defineConfig({/a\ build: {\n minify: false\n },' /riven/frontend/vite.config.ts
6161

6262
RUN sed -i "s#/riven/version.txt#/riven/frontend/version.txt#g" /riven/frontend/src/routes/settings/about/+page.server.ts
63+
RUN sed -i "s/export const prerender = true;/export const prerender = false;/g" /riven/frontend/src/routes/settings/about/+page.server.ts
64+
6365

6466
WORKDIR /riven/frontend
6567

base/__init__.py

+61-54
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
from dotenv import load_dotenv, find_dotenv
44
from datetime import datetime, timedelta
55
import logging
6-
from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler, BaseRotatingHandler
6+
from logging.handlers import (
7+
RotatingFileHandler,
8+
TimedRotatingFileHandler,
9+
BaseRotatingHandler,
10+
)
711
from packaging.version import Version, parse as parse_version
812
import time
913
import os
@@ -31,16 +35,18 @@
3135
from ruamel.yaml import YAML
3236

3337

34-
load_dotenv(find_dotenv('./config/.env'))
35-
38+
load_dotenv(find_dotenv("./config/.env"))
39+
40+
3641
def load_secret_or_env(secret_name, default=None):
37-
secret_file = f'/run/secrets/{secret_name}'
42+
secret_file = f"/run/secrets/{secret_name}"
3843
try:
39-
with open(secret_file, 'r') as file:
44+
with open(secret_file, "r") as file:
4045
return file.read().strip()
4146
except IOError:
4247
return os.getenv(secret_name.upper(), default)
4348

49+
4450
def get_valid_env(env_var, default):
4551
value = os.getenv(env_var)
4652
if value is None or value.strip() == "":
@@ -51,65 +57,66 @@ def get_valid_env(env_var, default):
5157
elif isinstance(default, float):
5258
return float(value)
5359
elif isinstance(default, bool):
54-
return value.lower() in ['true', '1', 'yes']
60+
return value.lower() in ["true", "1", "yes"]
5561
else:
5662
return value
5763
except ValueError:
5864
return default
5965

60-
PLEXTOKEN = load_secret_or_env('plex_token')
61-
PLEXADD = load_secret_or_env('plex_address')
62-
RDAPIKEY = load_secret_or_env('rd_api_key')
63-
ADAPIKEY = load_secret_or_env('ad_api_key')
64-
ZURGUSER = load_secret_or_env('zurg_user')
65-
ZURGPASS = load_secret_or_env('zurg_pass')
66-
GHTOKEN = load_secret_or_env('github_token')
67-
SEERRAPIKEY = load_secret_or_env('seerr_api_key')
68-
SEERRADD = load_secret_or_env('seerr_address')
69-
PGADMINEMAIL = load_secret_or_env('pgadmin_setup_email')
70-
PGADMINPASS = load_secret_or_env('pgadmin_setup_password')
71-
DUPECLEAN = os.getenv('DUPLICATE_CLEANUP')
72-
CLEANUPINT = os.getenv('CLEANUP_INTERVAL')
66+
67+
PLEXTOKEN = load_secret_or_env("plex_token")
68+
PLEXADD = load_secret_or_env("plex_address")
69+
RDAPIKEY = load_secret_or_env("rd_api_key")
70+
ADAPIKEY = load_secret_or_env("ad_api_key")
71+
ZURGUSER = load_secret_or_env("zurg_user")
72+
ZURGPASS = load_secret_or_env("zurg_pass")
73+
GHTOKEN = load_secret_or_env("github_token")
74+
SEERRAPIKEY = load_secret_or_env("seerr_api_key")
75+
SEERRADD = load_secret_or_env("seerr_address")
76+
PGADMINEMAIL = load_secret_or_env("pgadmin_setup_email")
77+
PGADMINPASS = load_secret_or_env("pgadmin_setup_password")
78+
DUPECLEAN = os.getenv("DUPLICATE_CLEANUP")
79+
CLEANUPINT = os.getenv("CLEANUP_INTERVAL")
7380
RCLONEMN = os.getenv("RCLONE_MOUNT_NAME")
7481
RCLONELOGLEVEL = os.getenv("RCLONE_LOG_LEVEL")
7582
ZURG = os.getenv("ZURG_ENABLED")
7683
ZURGVERSION = os.getenv("ZURG_VERSION")
7784
ZURGLOGLEVEL = os.getenv("ZURG_LOG_LEVEL")
78-
ZURGUPDATE = os.getenv('ZURG_UPDATE')
79-
NFSMOUNT = os.getenv('NFS_ENABLED')
80-
NFSPORT = os.getenv('NFS_PORT')
81-
ZURGPORT = os.getenv('ZURG_PORT')
85+
ZURGUPDATE = os.getenv("ZURG_UPDATE")
86+
NFSMOUNT = os.getenv("NFS_ENABLED")
87+
NFSPORT = os.getenv("NFS_PORT")
88+
ZURGPORT = os.getenv("ZURG_PORT")
8289
RIVENBACKEND = os.getenv("RIVEN_BACKEND_ENABLED")
8390
RIVENFRONTEND = os.getenv("RIVEN_FRONTEND_ENABLED")
8491
RIVEN = os.getenv("RIVEN_ENABLED")
85-
RUPDATE = os.getenv('RIVEN_UPDATE')
86-
RIVENLOGLEVEL = os.getenv('RIVEN_LOG_LEVEL')
87-
FRONTENDLOGS = os.getenv('FRONTEND_LOGS')
88-
BACKENDLOGS = os.getenv('BACKEND_LOGS')
89-
RIVENBACKENDURL = os.getenv('RIVEN_BACKEND_URL')
90-
RIVENDATABASEHOST = os.getenv('RIVEN_DATABASE_HOST')
91-
RIVENDATABASEURL = os.getenv('RIVEN_DATABASE_URL')
92-
RBBRANCH = os.getenv('RIVEN_BACKEND_BRANCH')
93-
RFBRANCH = os.getenv('RIVEN_FRONTEND_BRANCH')
94-
RFOWNER = os.getenv('RIVEN_FRONTEND_OWNER')
95-
RBVERSION = os.getenv('RIVEN_BACKEND_VERSION')
96-
RFVERSION = os.getenv('RIVEN_FRONTEND_VERSION')
97-
RBUPDATE = os.getenv('RIVEN_BACKEND_UPDATE')
98-
RFUPDATE = os.getenv('RIVEN_FRONTEND_UPDATE')
99-
RFDIALECT = os.getenv('RIVEN_FRONTEND_DIALECT')
100-
SYMLINKLIBRARYPATH = os.getenv('SYMLINK_LIBRARY_PATH')
101-
SYMLINKRCLONEPATH = os.getenv('SYMLINK_RCLONE_PATH')
102-
RCLONELOGS = os.getenv('RCLONE_LOGS')
103-
db_host = '127.0.0.1'
104-
user_id = get_valid_env('PUID', 1001)
105-
group_id = get_valid_env('PGID', 1001)
106-
postgres_data = get_valid_env('POSTGRES_DATA', '/postgres_data')
107-
postgres_user = get_valid_env('POSTGRES_USER', 'DMB')
108-
postgres_password = get_valid_env('POSTGRES_PASSWORD', 'postgres')
109-
postgres_db = get_valid_env('POSTGRES_DB', 'riven')
110-
RCLONEDIR = get_valid_env('RCLONE_DIR', '/data')
111-
ZILEAN = os.getenv('ZILEAN_ENABLED')
112-
ZILEANBRANCH = os.getenv('ZILEAN_BRANCH')
113-
ZILEANVERSION = get_valid_env('ZILEAN_VERSION', None)
114-
ZILEANUPDATE = os.getenv('ZILEAN_UPDATE')
115-
ZILEANLOGS = os.getenv('ZILEAN_LOGS')
92+
RUPDATE = os.getenv("RIVEN_UPDATE")
93+
RIVENLOGLEVEL = os.getenv("RIVEN_LOG_LEVEL")
94+
FRONTENDLOGS = os.getenv("FRONTEND_LOGS")
95+
BACKENDLOGS = os.getenv("BACKEND_LOGS")
96+
RIVENBACKENDURL = os.getenv("RIVEN_BACKEND_URL")
97+
RIVENDATABASEHOST = os.getenv("RIVEN_DATABASE_HOST")
98+
RIVENDATABASEURL = os.getenv("RIVEN_DATABASE_URL")
99+
RBBRANCH = os.getenv("RIVEN_BACKEND_BRANCH")
100+
RFBRANCH = os.getenv("RIVEN_FRONTEND_BRANCH")
101+
RFOWNER = os.getenv("RIVEN_FRONTEND_OWNER")
102+
RBVERSION = os.getenv("RIVEN_BACKEND_VERSION")
103+
RFVERSION = os.getenv("RIVEN_FRONTEND_VERSION")
104+
RBUPDATE = os.getenv("RIVEN_BACKEND_UPDATE")
105+
RFUPDATE = os.getenv("RIVEN_FRONTEND_UPDATE")
106+
RFDIALECT = os.getenv("RIVEN_FRONTEND_DIALECT")
107+
SYMLINKLIBRARYPATH = os.getenv("SYMLINK_LIBRARY_PATH")
108+
SYMLINKRCLONEPATH = os.getenv("SYMLINK_RCLONE_PATH")
109+
RCLONELOGS = os.getenv("RCLONE_LOGS")
110+
db_host = "127.0.0.1"
111+
user_id = get_valid_env("PUID", 1001)
112+
group_id = get_valid_env("PGID", 1001)
113+
postgres_data = get_valid_env("POSTGRES_DATA", "/postgres_data")
114+
postgres_user = get_valid_env("POSTGRES_USER", "DMB")
115+
postgres_password = get_valid_env("POSTGRES_PASSWORD", "postgres")
116+
postgres_db = get_valid_env("POSTGRES_DB", "riven")
117+
RCLONEDIR = get_valid_env("RCLONE_DIR", "/data")
118+
ZILEAN = os.getenv("ZILEAN_ENABLED")
119+
ZILEANBRANCH = os.getenv("ZILEAN_BRANCH")
120+
ZILEANVERSION = get_valid_env("ZILEAN_VERSION", None)
121+
ZILEANUPDATE = os.getenv("ZILEAN_UPDATE")
122+
ZILEANLOGS = os.getenv("ZILEAN_LOGS")

healthcheck.py

+47-31
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
from base import *
22
from utils.logger import *
33

4+
45
def check_processes(process_info, skip_conditions):
56
found_processes = {key: False for key in process_info.keys()}
67

78
for proc in psutil.process_iter():
89
try:
9-
cmdline = ' '.join(proc.cmdline())
10+
cmdline = " ".join(proc.cmdline())
1011
for process_name, info in process_info.items():
11-
if info['regex'].search(cmdline):
12+
if info["regex"].search(cmdline):
1213
found_processes[process_name] = True
1314
for condition in skip_conditions:
14-
if condition['regex'].search(cmdline):
15-
condition['found'] = True
15+
if condition["regex"].search(cmdline):
16+
condition["found"] = True
1617
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
1718
pass
1819

1920
return found_processes
2021

22+
2123
try:
2224
error_messages = []
2325

@@ -27,70 +29,84 @@ def check_processes(process_info, skip_conditions):
2729
else:
2830
RCLONEMN_RD = RCLONEMN_AD = RCLONEMN
2931

30-
mount_type = "serve nfs" if not NFSMOUNT is None and str(NFSMOUNT).lower() == 'true' else "mount"
31-
32+
mount_type = (
33+
"serve nfs"
34+
if not NFSMOUNT is None and str(NFSMOUNT).lower() == "true"
35+
else "mount"
36+
)
37+
3238
process_info = {
3339
"zurg_rd": {
34-
"regex": re.compile(rf'/zurg/RD/zurg.*--preload', re.IGNORECASE),
40+
"regex": re.compile(rf"/zurg/RD/zurg.*--preload", re.IGNORECASE),
3541
"error_message": "The Zurg RD process is not running.",
36-
"should_run": str(ZURG).lower() == 'true' and RDAPIKEY
42+
"should_run": str(ZURG).lower() == "true" and RDAPIKEY,
3743
},
3844
"zurg_ad": {
39-
"regex": re.compile(rf'/zurg/AD/zurg.*--preload', re.IGNORECASE),
45+
"regex": re.compile(rf"/zurg/AD/zurg.*--preload", re.IGNORECASE),
4046
"error_message": "The Zurg AD process is not running.",
41-
"should_run": str(ZURG).lower() == 'true' and ADAPIKEY
47+
"should_run": str(ZURG).lower() == "true" and ADAPIKEY,
4248
},
4349
"riven_frontend": {
44-
"regex": re.compile(r'node build'),
50+
"regex": re.compile(r"node build"),
4551
"error_message": "The Riven frontend process is not running.",
46-
"should_run": str(RIVENFRONTEND).lower() == 'true' or str(RIVEN).lower() == 'true' and os.path.exists(f'{RCLONEDIR}/{RCLONEMN}/__all__')
52+
"should_run": str(RIVENFRONTEND).lower() == "true"
53+
or str(RIVEN).lower() == "true"
54+
and os.path.exists(f"{RCLONEDIR}/{RCLONEMN}/__all__"),
4755
},
4856
"riven_backend": {
49-
"regex": re.compile(r'/riven/backend/venv/bin/python src/main.py'),
57+
"regex": re.compile(r"/riven/backend/venv/bin/python src/main.py"),
5058
"error_message": "The Riven backend process is not running.",
51-
"should_run": str(RIVENBACKEND).lower() == 'true' or str(RIVEN).lower() == 'true' and os.path.exists(f'{RCLONEDIR}/{RCLONEMN}/__all__')
59+
"should_run": str(RIVENBACKEND).lower() == "true"
60+
or str(RIVEN).lower() == "true"
61+
and os.path.exists(f"{RCLONEDIR}/{RCLONEMN}/__all__"),
5262
},
5363
"rclonemn_rd": {
54-
"regex": re.compile(rf'rclone {mount_type} {re.escape(RCLONEMN_RD)}:'),
64+
"regex": re.compile(rf"rclone {mount_type} {re.escape(RCLONEMN_RD)}:"),
5565
"error_message": f"The Rclone RD process for {RCLONEMN_RD} is not running.",
56-
"should_run": str(ZURG).lower() == 'true' and RDAPIKEY and os.path.exists(f'/healthcheck/{RCLONEMN}')
66+
"should_run": str(ZURG).lower() == "true"
67+
and RDAPIKEY
68+
and os.path.exists(f"/healthcheck/{RCLONEMN}"),
5769
},
5870
"rclonemn_ad": {
59-
"regex": re.compile(rf'rclone {mount_type} {re.escape(RCLONEMN_AD)}:'),
71+
"regex": re.compile(rf"rclone {mount_type} {re.escape(RCLONEMN_AD)}:"),
6072
"error_message": f"The Rclone AD process for {RCLONEMN_AD} is not running.",
61-
"should_run": str(ZURG).lower() == 'true' and ADAPIKEY and os.path.exists(f'/healthcheck/{RCLONEMN}')
73+
"should_run": str(ZURG).lower() == "true"
74+
and ADAPIKEY
75+
and os.path.exists(f"/healthcheck/{RCLONEMN}"),
6276
},
6377
"PostgreSQL": {
64-
"regex": re.compile(r'postgres -D'),
78+
"regex": re.compile(r"postgres -D"),
6579
"error_message": f"The PostgreSQL process is not running.",
66-
"should_run": str(RIVENBACKEND).lower() == 'true' or str(RIVEN).lower() == 'true' and os.path.exists(f'{RCLONEDIR}/{RCLONEMN}/__all__')
80+
"should_run": str(RIVENBACKEND).lower() == "true"
81+
or str(RIVEN).lower() == "true"
82+
and os.path.exists(f"{RCLONEDIR}/{RCLONEMN}/__all__"),
6783
},
6884
"Zilean": {
69-
"regex": re.compile(r'/zilean-api'),
85+
"regex": re.compile(r"/zilean-api"),
7086
"error_message": f"The Zilean process is not running.",
71-
"should_run": str(ZILEAN).lower() == 'true' and os.path.exists(f'{RCLONEDIR}/{RCLONEMN}/__all__')
72-
}
87+
"should_run": str(ZILEAN).lower() == "true"
88+
and os.path.exists(f"{RCLONEDIR}/{RCLONEMN}/__all__"),
89+
},
7390
}
7491

7592
skip_conditions = [
93+
{"regex": re.compile(r"npm install"), "found": False},
7694
{
77-
"regex": re.compile(r'npm install'),
78-
"found": False
95+
"regex": re.compile(
96+
r"node --max-old-space-size=2048 ./node_modules/.bin/vite build"
97+
),
98+
"found": False,
7999
},
80-
{
81-
"regex": re.compile(r'node --max-old-space-size=2048 ./node_modules/.bin/vite build'),
82-
"found": False
83-
}
84100
]
85101

86102
process_status = check_processes(process_info, skip_conditions)
87103

88-
skip_riven_frontend = any(condition['found'] for condition in skip_conditions)
104+
skip_riven_frontend = any(condition["found"] for condition in skip_conditions)
89105

90106
for process_name, info in process_info.items():
91107
if info["should_run"] and not process_status[process_name]:
92108
if process_name == "riven_frontend" and skip_riven_frontend:
93-
continue
109+
continue
94110
error_messages.append(info["error_message"])
95111

96112
if error_messages:

0 commit comments

Comments
 (0)