Skip to content

Commit ac0500d

Browse files
committed
Version [5.4.0]
1 parent 6e9247d commit ac0500d

13 files changed

+774
-415
lines changed

CHANGELOG.md

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

88

99

10+
## Version [5.4.0] - 2024-10-25 🚀
11+
12+
### Fixed 🛠️
13+
14+
- [Issue #14](https://github.com/I-am-PUID-0/DMB/issues/14) Add Riven build process to Dockerfile ✨
15+
- [Issue #65](https://github.com/I-am-PUID-0/DMB/issues/65) Zilean Enabled when ZILEAN_ENABLED=false 🐛
16+
- [Issue #66](https://github.com/I-am-PUID-0/DMB/issues/66) Dockerfile pulls from Riven Frontend main branch vs. latest release 🐛
17+
- [Issue #67](https://github.com/I-am-PUID-0/DMB/issues/67) Future releases for Riven Frontend and Backend will require an API Key 🐛
18+
19+
### Added ✨
20+
21+
- Riven Backend: Added the Riven backend build process to the Dockerfile 📦
22+
- Riven Frontend: Added the server-config.json to the be saved in /config and transferred to the Riven Frontend when using the API key 📦
23+
- Zilean: Added the Zilean build process to the Dockerfile 📦
24+
25+
### Changed 🔄
26+
27+
- Riven Backend: Settings are now loaded with or without the API key depending on the version of Riven used 🔄
28+
- Refactor: Refactored the utils and version checks 🔄
29+
- Utils: Added description to reaped processes 🔄
30+
- Logging: Added thread lock to rollover 🔄
31+
32+
33+
### Notes 📝
34+
35+
- Future releases for Riven Frontend and Backend will require an API Key to be set 🚨
36+
- With these changes, you can now use the latest development versions of Riven Frontend and Backend 🌙
37+
- Use the RIVEN_BACKEND_BRANCH=release-please--branches--main and RIVEN_FRONTEND_BRANCH=release-please--branches--main environment variables to test the current development versions of Riven 🌙
38+
39+
1040
## Version [5.3.2] - 2024-10-18 🚀
1141

1242
### Fixed 🛠️

Dockerfile

+62-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LABEL name="DMB" \
3434
url="https://github.com/I-am-PUID-0/DMB"
3535

3636
RUN apk add --update --no-cache gcompat libstdc++ libxml2-utils curl tzdata nano ca-certificates wget fuse3 build-base \
37-
boost-filesystem boost-thread linux-headers py3-cffi libffi-dev rust cargo openssl openssl-dev pkgconfig git npm \
37+
boost-filesystem boost-thread linux-headers py3-cffi libffi-dev rust cargo jq openssl openssl-dev pkgconfig git npm \
3838
ffmpeg postgresql-dev postgresql-client postgresql dotnet-sdk-8.0 postgresql-contrib postgresql-client postgresql \
3939
dotnet-sdk-8.0 postgresql-contrib
4040

@@ -48,27 +48,79 @@ WORKDIR /
4848

4949
ADD https://raw.githubusercontent.com/debridmediamanager/zurg-testing/main/config.yml /zurg/
5050
ADD https://raw.githubusercontent.com/debridmediamanager/zurg-testing/main/plex_update.sh /zurg/
51-
ADD https://github.com/rivenmedia/riven-frontend/archive/refs/heads/main.zip /riven-frontend-main.zip
51+
52+
RUN RELEASE_TAG=$(curl -s https://api.github.com/repos/rivenmedia/riven-frontend/releases/latest | jq -r .tag_name) && \
53+
curl -L https://github.com/rivenmedia/riven-frontend/archive/refs/tags/$RELEASE_TAG.zip -o /riven-frontend-latest.zip
5254

5355
RUN \
54-
mkdir -p /log /riven /riven/frontend /pgadmin/venv /pgadmin/data && \
55-
if [ -f /riven-frontend-main.zip ]; then echo "File exists"; else echo "File does not exist"; fi && \
56-
unzip /riven-frontend-main.zip -d /riven && \
57-
mv /riven/riven-frontend-main/* /riven/frontend && \
58-
rm -rf /riven/riven-frontend-main
56+
mkdir -p /log /config /riven /riven/frontend /riven/backend /zilean /pgadmin/venv /pgadmin/data && \
57+
if [ -f /riven-frontend-latest.zip ]; then echo "File exists"; else echo "File does not exist"; fi && \
58+
unzip /riven-frontend-latest.zip -d /riven && \
59+
mv /riven/riven-frontend-*/* /riven/frontend && \
60+
rm -rf /riven/riven-frontend-* && \
61+
rm -rf /riven-frontend-latest.zip
5962

6063
RUN sed -i '/export default defineConfig({/a\ build: {\n minify: false\n },' /riven/frontend/vite.config.ts
61-
6264
RUN sed -i "s#/riven/version.txt#/riven/frontend/version.txt#g" /riven/frontend/src/routes/settings/about/+page.server.ts
6365
RUN sed -i "s/export const prerender = true;/export const prerender = false;/g" /riven/frontend/src/routes/settings/about/+page.server.ts
6466

65-
6667
WORKDIR /riven/frontend
6768

6869
RUN npm install -g pnpm && pnpm install && pnpm run build && pnpm prune --prod
6970

7071
WORKDIR /
7172

73+
RUN RELEASE_TAG=$(curl -s https://api.github.com/repos/rivenmedia/riven/releases/latest | jq -r .tag_name) && \
74+
curl -L https://github.com/rivenmedia/riven/archive/refs/tags/$RELEASE_TAG.zip -o /riven-latest.zip
75+
76+
RUN \
77+
if [ -f /riven-latest.zip ]; then echo "File exists"; else echo "File does not exist"; fi && \
78+
unzip /riven-latest.zip -d /riven && \
79+
mv /riven/riven-*/* /riven/backend && \
80+
rm -rf /riven/riven-* && \
81+
rm -rf /riven-latest.zip
82+
83+
WORKDIR /riven/backend
84+
85+
RUN python3 -m venv /riven/backend/venv && \
86+
source /riven/backend/venv/bin/activate && \
87+
pip install --upgrade pip && \
88+
pip install poetry && \
89+
poetry config virtualenvs.create false && \
90+
poetry install --no-root --without dev
91+
92+
WORKDIR /
93+
94+
RUN RELEASE_TAG=$(curl -s https://api.github.com/repos/iPromKnight/zilean/releases/latest | jq -r .tag_name) && \
95+
curl -L https://github.com/iPromKnight/zilean/archive/refs/tags/$RELEASE_TAG.zip -o /zilean-latest.zip && \
96+
echo $RELEASE_TAG > /zilean/version.txt
97+
98+
99+
RUN \
100+
if [ -f /zilean-latest.zip ]; then echo "File exists"; else echo "File does not exist"; fi && \
101+
unzip /zilean-latest.zip && \
102+
mv zilean-*/* /zilean/ && \
103+
rm -rf zilean-* /zilean-latest.zip
104+
105+
WORKDIR /zilean
106+
107+
RUN \
108+
python3 -m venv /zilean/venv && \
109+
source /zilean/venv/bin/activate && \
110+
pip install --upgrade pip && \
111+
pip install -r /zilean/requirements.txt && \
112+
dotnet restore
113+
114+
WORKDIR /zilean/src/Zilean.ApiService
115+
116+
RUN dotnet publish -c Release --no-restore -o /zilean/app/
117+
118+
WORKDIR /zilean/src/Zilean.DmmScraper
119+
120+
RUN dotnet publish -c Release --no-restore -o /zilean/app/
121+
122+
WORKDIR /
123+
72124
COPY . /./
73125

74126
RUN \
@@ -88,6 +140,7 @@ ENV \
88140
XDG_CONFIG_HOME=/config \
89141
TERM=xterm
90142

143+
91144
HEALTHCHECK --interval=60s --timeout=10s \
92145
CMD ["/bin/sh", "-c", "source /venv/bin/activate && python /healthcheck.py"]
93146

main.py

+10-56
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,9 @@
1212
process_handler = ProcessHandler(logger)
1313

1414

15-
def shutdown(signum=None, frame=None, exit_code=0):
16-
logger.info("Shutdown signal received. Cleaning up...")
17-
18-
def stop_process(process_name):
19-
try:
20-
process_handler.stop_process(process_name)
21-
except Exception as e:
22-
logger.error(f"Exception occurred while stopping {process_name}: {str(e)}")
23-
24-
def unmount_all():
25-
for mount_point in os.listdir(f"{RCLONEDIR}"):
26-
full_path = os.path.join(f"{RCLONEDIR}", mount_point)
27-
if os.path.ismount(full_path):
28-
logger.info(f"Unmounting {full_path}...")
29-
umount = subprocess.run(
30-
["umount", full_path], capture_output=True, text=True
31-
)
32-
if umount.returncode == 0:
33-
logger.info(f"Successfully unmounted {full_path}")
34-
else:
35-
logger.error(
36-
f"Failed to unmount {full_path}: {umount.stderr.strip()}"
37-
)
38-
39-
processes = [
40-
"riven_frontend",
41-
"riven_backend",
42-
"Zilean",
43-
"PostgreSQL",
44-
"Zurg",
45-
"rclone",
46-
"pgAdmin",
47-
"pgAgent",
48-
]
49-
for process in processes:
50-
stop_process(process)
51-
52-
unmount_all()
53-
54-
logger.info("Shutdown complete.")
55-
sys.exit(exit_code)
56-
57-
5815
def main():
5916

60-
version = "5.3.2"
17+
version = "5.4.0"
6118

6219
ascii_art = f"""
6320
@@ -78,7 +35,6 @@ def main():
7835
D::::::::::::DDD M::::::M M::::::MB::::::::::::::::B
7936
DDDDDDDDDDDDD MMMMMMMM MMMMMMMMBBBBBBBBBBBBBBBBB
8037
81-
8238
Version: {version}
8339
"""
8440

@@ -106,7 +62,7 @@ def healthcheck():
10662
user_management.create_system_user()
10763
except Exception as e:
10864
logger.error(f"An error occurred while creating system user: {e}")
109-
shutdown(exit_code=1)
65+
process_handler.shutdown(exit_code=1)
11066

11167
try:
11268
if ZURG is None or str(ZURG).lower() == "false":
@@ -144,10 +100,10 @@ def healthcheck():
144100
raise MissingAPIKeyException()
145101
except Exception as e:
146102
logger.error(f"An error occurred in the Zurg setup: {e}")
147-
shutdown(exit_code=1)
103+
process_handler.shutdown(exit_code=1)
148104
except Exception as e:
149105
logger.error(e)
150-
shutdown(exit_code=1)
106+
process_handler.shutdown(exit_code=1)
151107

152108
try:
153109
if (RIVENBACKEND is not None and str(RIVENBACKEND).lower() == "true") or (
@@ -157,9 +113,9 @@ def healthcheck():
157113
postgres.postgres_setup(process_handler)
158114
except Exception as e:
159115
logger.error(f"An error occurred in the PostgreSQL setup: {e}")
160-
shutdown(exit_code=1)
116+
process_handler.shutdown(exit_code=1)
161117
try:
162-
if ZILEAN is not None or str(ZILEAN).lower() == "true":
118+
if ZILEAN is not None and str(ZILEAN).lower() == "true":
163119
try:
164120
zilean.setup.zilean_setup(process_handler, "Zilean")
165121
except Exception as e:
@@ -176,7 +132,7 @@ def healthcheck():
176132
zilean_updater.auto_update("Zilean", False)
177133
except Exception as e:
178134
logger.error(f"An error occurred in the Zilean setup: {e}")
179-
shutdown(exit_code=1)
135+
process_handler.shutdown(exit_code=1)
180136
try:
181137
try:
182138
r.setup.riven_setup(process_handler, "riven_backend")
@@ -190,10 +146,10 @@ def healthcheck():
190146
r_updater.auto_update("riven_backend", False)
191147
except Exception as e:
192148
logger.error(f"An error occurred in the Riven backend setup: {e}")
193-
shutdown(exit_code=1)
149+
process_handler.shutdown(exit_code=1)
194150
except Exception as e:
195151
logger.error(e)
196-
shutdown(exit_code=1)
152+
process_handler.shutdown(exit_code=1)
197153

198154
try:
199155
if (RIVENFRONTEND is not None and str(RIVENFRONTEND).lower() == "true") or (
@@ -213,7 +169,7 @@ def healthcheck():
213169
r_updater.auto_update("riven_frontend", False)
214170
except Exception as e:
215171
logger.error(f"An error occurred in the Riven frontend setup: {e}")
216-
shutdown(exit_code=1)
172+
process_handler.shutdown(exit_code=1)
217173

218174
def perpetual_wait():
219175
stop_event = threading.Event()
@@ -223,6 +179,4 @@ def perpetual_wait():
223179

224180

225181
if __name__ == "__main__":
226-
signal.signal(signal.SIGTERM, shutdown)
227-
signal.signal(signal.SIGINT, shutdown)
228182
main()

0 commit comments

Comments
 (0)