Skip to content

Commit

Permalink
Docker (#419)
Browse files Browse the repository at this point in the history
* feat: multiple bug fixes. introduced timeout for jobs

* feat: add dockerfile for slim binary

* feat: add log level env vars

---------

Co-authored-by: Spoked <Spoked@localhost>
  • Loading branch information
dreulavelle and Spoked authored Jun 17, 2024
1 parent 38c1b75 commit 9f6c7d1
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 433 deletions.
57 changes: 57 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Application Env Settings only
RIVEN_FORCE_ENV=false

# Max Workers
OVERSEERR_MAX_WORKERS=1
PLEXWATCHLIST_MAX_WORKERS=1
LISTRR_MAX_WORKERS=1
Expand All @@ -22,6 +23,62 @@ TORBOXSCRAPER_MAX_WORKERS=1
SYMLINKER_MAX_WORKERS=1
PROWLARR_MAX_WORKERS=1

# PROGRAM log level
RIVEN_LOGGER_PROGRAM_FG=3E201D
RIVEN_LOGGER_PROGRAM_ICON=🤖

# DEBRID log level
RIVEN_LOGGER_DEBRID_FG=FE6F47
RIVEN_LOGGER_DEBRID_ICON=🔗

# SYMLINKER log level
RIVEN_LOGGER_SYMLINKER_FG=F9E79F
RIVEN_LOGGER_SYMLINKER_ICON=🔗

# SCRAPER log level
RIVEN_LOGGER_SCRAPER_FG=D299EA
RIVEN_LOGGER_SCRAPER_ICON=👻

# COMPLETED log level
RIVEN_LOGGER_COMPLETED_FG=FFFFFF
RIVEN_LOGGER_COMPLETED_ICON=🟢

# CACHE log level
RIVEN_LOGGER_CACHE_FG=527826
RIVEN_LOGGER_CACHE_ICON=📜

# NOT_FOUND log level
RIVEN_LOGGER_NOT_FOUND_FG=818589
RIVEN_LOGGER_NOT_FOUND_ICON=🤷‍

# NEW log level
RIVEN_LOGGER_NEW_FG=e63946
RIVEN_LOGGER_NEW_ICON=

# FILES log level
RIVEN_LOGGER_FILES_FG=FFFFE0
RIVEN_LOGGER_FILES_ICON=🗃️

# ITEM log level
RIVEN_LOGGER_ITEM_FG=92a1cf
RIVEN_LOGGER_ITEM_ICON=🗃️

# DISCOVERY log level
RIVEN_LOGGER_DISCOVERY_FG=e56c49
RIVEN_LOGGER_DISCOVERY_ICON=🔍

# API log level
RIVEN_LOGGER_API_FG=006989
RIVEN_LOGGER_API_ICON=👾

# PLEX log level
RIVEN_LOGGER_PLEX_FG=DAD3BE
RIVEN_LOGGER_PLEX_ICON=📽️

# TRAKT log level
RIVEN_LOGGER_TRAKT_FG=1DB954
RIVEN_LOGGER_TRAKT_ICON=🎵

# Riven Settings
RIVEN_VERSION=0.6.4
RIVEN_DEBUG=false
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLAYE/---feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
value: |
Thank you for taking the time to file a complete bug report.
Before submitting your issue, please search [issues](https://github.com/dreulavelle/iceberg/issues) to ensure this is not a duplicate.
Before submitting your issue, please search [issues](https://github.com/rivenmedia/riven/issues) to ensure this is not a duplicate.
If the issue is trivial, why not submit a pull request instead?
Expand Down Expand Up @@ -40,7 +40,7 @@ body:
attributes:
label: Impact
description: |
Please describe the motivation for this issue. Describe, as best you can, how this improves or impacts the users of Iceberg and why this is important.
Please describe the motivation for this issue. Describe, as best you can, how this improves or impacts the users of Riven and why this is important.
validations:
required: true

Expand Down
54 changes: 54 additions & 0 deletions Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Riven Backend Builder

FROM python:3.11.9-alpine3.19 as Base
LABEL name="Riven" \
description="Riven Debrid Downloader" \
url="https://github.com/rivenmedia/riven"

# Install system dependencies
RUN apk --update add --no-cache curl bash shadow gcc python3-dev musl-dev linux-headers patchelf clang ccache && \
rm -rf /var/cache/apk/*
RUN pip install --upgrade pip && pip install poetry==1.8.3

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

# Install Poetry globally
ENV POETRY_HOME="/etc/poetry"
ENV PATH="$POETRY_HOME/bin:$PATH"
#RUN curl -sSL https://install.python-poetry.org | python3 - --yes

# Setup the application directory
WORKDIR /riven

# Expose ports
EXPOSE 8080

# Set environment variable to force color output
ENV FORCE_COLOR=1
ENV TERM=xterm-256color

# Copy the Python project files
COPY pyproject.toml poetry.lock* /riven/

# Install Python dependencies
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR

# Copy backend code and other necessary files
COPY backend/ /riven/backend
COPY VERSION entrypoint.sh /riven/

RUN cd /riven/backend && poetry add nuitka && \
poetry run python3 -m nuitka --standalone --onefile --onefile-tempdir-spec=/onefile_%PID%_%TIME% --python-flag=nosite,-O --nofollow-import-to=pytest --clang --warn-implicit-exceptions --warn-unusual-code --prefer-source-code main.py

FROM scratch

COPY --from=Base /riven/backend/main.bin /main.bin
COPY VERSION /
VOLUME /data
COPY --from=Base /lib/ /lib/
# Ensure entrypoint script is executable

ENTRYPOINT ["/main.bin"]
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.0
0.7.1
7 changes: 7 additions & 0 deletions backend/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

import os
import time

if 'TZ' not in os.environ:
os.environ['TZ'] = 'UTC'
time.tzset()
1 change: 1 addition & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import contextlib
import os
import sys
import threading
import time
Expand Down
6 changes: 5 additions & 1 deletion backend/program/content/overseerr.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def run(self):
if not imdb_id or imdb_id in self.recurring_items:
continue
self.recurring_items.add(imdb_id)
yield MediaItem({"imdb_id": imdb_id, "requested_by": self.key, "overseerr_id": mediaId})
media_item = MediaItem({"imdb_id": imdb_id, "requested_by": self.key, "overseerr_id": mediaId})
if media_item:
yield media_item
else:
logger.log("NOT_FOUND", f"Failed to create media item for {imdb_id}")
except Exception as e:
logger.error(f"Error processing item {item}: {str(e)}")
continue
Expand Down
4 changes: 2 additions & 2 deletions backend/program/downloaders/realdebrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ def _is_wanted_show(self, container: dict, item: Show) -> bool:
acceptable_states = [States.Indexed, States.Scraped, States.Unknown, States.Failed]

for season in item.seasons:
if season.state in acceptable_states and season.is_released:
needed_episode_numbers = {episode.number for episode in season.episodes if episode.state in acceptable_states and episode.is_released}
if season.state in acceptable_states and season.is_released_nolog:
needed_episode_numbers = {episode.number for episode in season.episodes if episode.state in acceptable_states and episode.is_released_nolog}
if needed_episode_numbers:
needed_episodes[season.number] = needed_episode_numbers
if not needed_episodes:
Expand Down
1 change: 0 additions & 1 deletion backend/program/libraries/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .plex import PlexLibrary # noqa: F401
from .symlink import SymlinkLibrary # noqa: F401
Loading

0 comments on commit 9f6c7d1

Please sign in to comment.