Skip to content

Commit

Permalink
Version [3.3.0]
Browse files Browse the repository at this point in the history
  • Loading branch information
I-am-PUID-0 committed Aug 1, 2024
1 parent caaef3a commit 446dac4
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 114 deletions.
47 changes: 34 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## Version [3.2.0] - 2024-30-07 🚀
## Version [3.3.0] - 2024-08-01 🚀

### Fixed 🛠️

- [Issue #23](https://github.com/I-am-PUID-0/DMB/issues/23) Processes not properly killed during automatic updates 🐛
- [Issue #24](https://github.com/I-am-PUID-0/DMB/issues/24) Riven automatic update extracts to wrong directory 🐛
- [Issue #25](https://github.com/I-am-PUID-0/DMB/issues/25) Automatic update initiates update check multiple times for each instance 🐛
- [Issue #26](https://github.com/I-am-PUID-0/DMB/issues/26) Riven Frontend breaking change requires DIALECT=sqlite env variable 🐛

### Added ✨

- Automatic Update: Enabled automatic updates for Riven branches - expands automatic updates to include branches 🔄
- RIVEN_FRONTEND_DIALECT: Environment variable to set the Riven frontend database dialect; Default is sqlite - not required to be set in default configuration 🗃️
- Riven Frontend: Set npm max_old_space_size to 2048MB for Riven frontend build process - limits resource usage 📦
- Riven Frontend: Set vite minification to false for Riven frontend build process - speeds up build process and reduces resource usage 📦

### Changed 🔄

- healthcheck: Waits for Riven frontend setup to complete 🩺


## Version [3.2.0] - 2024-07-30 🚀

### Changed 🔄

Expand All @@ -24,14 +45,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Logging: Fixed logging for Zurg to ensure log levels are properly set 📝


## Version [3.1.0] - 2024-26-07 🚀
## Version [3.1.0] - 2024-07-26 🚀

### Added ✨

- Shutdown: Added a shutdown function to gracefully stop the DMB container; e.g., unmount the rclone mounts 🛑


## Version [3.0.0] - 2024-26-07 🚀
## Version [3.0.0] - 2024-07-26 🚀

### Breaking Changes ⚠️

Expand All @@ -58,7 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## Version [2.0.0] - 2024-25-07
## Version [2.0.0] - 2024-07-25

### Breaking Changes

Expand Down Expand Up @@ -92,44 +113,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## Version [1.2.0] - 2024-19-07
## Version [1.2.0] - 2024-07-19

### Added

- [Issue #18](https://github.com/I-am-PUID-0/DMB/issues/18): Added DMB_LOG_SIZE environment variable to set the maximum size of the log file; Default is 10MB


## Version [1.1.0] - 2024-17-07
## Version [1.1.0] - 2024-07-17

### Changed

- Rclone: WebDAV URL check for Zurg startup processes accepts any 200 status code as a valid response
- DMB: Refactored to use common functions under utils


## Version [1.0.3] - 2024-16-07
## Version [1.0.3] - 2024-07-16

### Fixed

- Rclone: Fixed WebDAV URL check for Zurg startup processes when Zurg user and password are set in config.yml


## Version [1.0.2] - 2024-16-07
## Version [1.0.2] - 2024-07-16

### Fixed

- Zurg: Fixed the removal of Zurg user and password if previously set in config.yml


## Version [1.0.1] - 2024-16-07
## Version [1.0.1] - 2024-07-16

### Fixed

- DMB: Introduced a Riven startup check for the symlinked directory to ensure the Zurg startup processes have finished before starting Riven
- DMB: Introduced a Rclone startup check for the Zurg WebDAV URL to ensure the Zurg startup processes have finished before starting Rclone


## Version [1.0.0] - 2024-25-06
## Version [1.0.0] - 2024-06-25

### Breaking Changes

Expand All @@ -153,7 +174,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Issue #2](https://github.com/I-am-PUID-0/DMB/issues/2): Removed PLEX_REFRESH environment variable


## Version [0.2.0] - 2024-22-06
## Version [0.2.0] - 2024-06-22

### Added

Expand All @@ -165,7 +186,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Zurg: PLEX_MOUNT environment variable


## Version [0.1.0] - 2024-22-06
## Version [0.1.0] - 2024-06-22

### Added

Expand All @@ -177,7 +198,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Healthcheck: Fixed healthcheck process w/ Riven


## Version [0.0.1] - 2024-21-06
## Version [0.0.1] - 2024-06-21

### Added

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ services:
# - RIVEN_LOG_LEVEL=DEBUG
# - RIVEN_BACKEND_URL=http://127.0.0.1:8080 # Default is http://127.0.0.1:8080 when not enabled
# - RIVEN_DATABASE_HOST=sqlite:////riven/backend/data/media.db # Default is sqlite:////riven/backend/data/media.db when not enabled
# - RIVEN_FRONTEND_DIALECT=sqlite
# - PLEX_TOKEN=
# - PLEX_ADDRESS=
# - SEERR_API_KEY=
Expand Down Expand Up @@ -185,6 +186,7 @@ of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
|`ORIGIN`| The origin URL for the Riven frontend | http://0.0.0.0:3000 | | :heavy_check_mark: | |
|`RIVEN_BACKEND_URL`| The URL for the Riven backend | http://127.0.0.1:8080 | | :heavy_check_mark: | |
|`RIVEN_DATABASE_HOST`| The database host for Riven | `sqlite:////riven/backend/data/media.db` | | :heavy_check_mark: | |
|`RIVEN_FRONTEND_DIALECT`| The dialect for the Riven frontend | `sqlite` | | :heavy_check_mark: | |
|`AUTO_UPDATE_INTERVAL`| Interval between automatic update checks in hours. Vaules can be any positive [whole](https://www.oxfordlearnersdictionaries.com/us/definition/english/whole-number) or [decimal](https://www.oxfordreference.com/display/10.1093/oi/authority.20110803095705740;jsessionid=3FDC96CC0D79CCE69702661D025B9E9B#:~:text=The%20separator%20used%20between%20the,number%20expressed%20in%20decimal%20representation.) point based number. Ex. a value of .5 would yield thirty minutes, and 1.5 would yield one and a half hours | `24` || :heavy_check_mark:| :heavy_check_mark:|
|`DUPLICATE_CLEANUP`| Automated cleanup of duplicate content in Plex. | `false` |
|`CLEANUP_INTERVAL`| Interval between duplicate cleanup in hours. Values can be any positive [whole](https://www.oxfordlearnersdictionaries.com/us/definition/english/whole-number) or [decimal](https://www.oxfordreference.com/display/10.1093/oi/authority.20110803095705740;jsessionid=3FDC96CC0D79CCE69702661D025B9E9B#:~:text=The%20separator%20used%20between%20the,number%20expressed%20in%20decimal%20representation.) point based number. Ex. a value of .5 would yield thirty minutes and 1.5 would yield one and a half hours | `24` || :heavy_check_mark: | :heavy_check_mark:|
Expand Down
3 changes: 2 additions & 1 deletion base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ def load_secret_or_env(secret_name, default=None):
RBVERSION = os.getenv('RIVEN_BACKEND_VERSION')
RFVERSION = os.getenv('RIVEN_FRONTEND_VERSION')
RBUPDATE = os.getenv('RIVEN_BACKEND_UPDATE')
RFUPDATE = os.getenv('RIVEN_FRONTEND_UPDATE')
RFUPDATE = os.getenv('RIVEN_FRONTEND_UPDATE')
RFDIALECT = os.getenv('RIVEN_FRONTEND_DIALECT')
12 changes: 12 additions & 0 deletions healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,22 @@ def check_processes(process_info):
"regex": re.compile(rf'rclone {mount_type} {re.escape(RCLONEMN_AD)}:'),
"error_message": f"The Rclone AD process for {RCLONEMN_AD} is not running.",
"should_run": str(ZURG).lower() == 'true' and ADAPIKEY and os.path.exists(f'/healthcheck/{RCLONEMN}')
},
"vite_build": {
"regex": re.compile(r'node --max-old-space-size=2048 /riven/frontend/node_modules/.bin/vite build'),
"error_message": "",
"should_run": True
},
"npm_install": {
"regex": re.compile(r'npm install'),
"error_message": "",
"should_run": True
}
}

process_status = check_processes(process_info)
if process_status["vite_build"] or process_status["npm_install"]:
process_info["riven_frontend"]["should_run"] = False

for process_name, info in process_info.items():
if info["should_run"] and not process_status[process_name]:
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def shutdown(signum, frame):
def main():
logger = get_logger()

version = '3.2.0'
version = '3.3.0'

ascii_art = f'''
Expand Down
8 changes: 5 additions & 3 deletions riven_/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ def set_env_variable(key, value, default=None):
'SYMLINK_RCLONE_PATH': f"/data/{RCLONEMN}/__all__",
'SYMLINK_LIBRARY_PATH': "/mnt",
'BACKEND_URL': RIVENBACKENDURL,
'DATABASE_HOST': RIVENDATABASEHOST
'DATABASE_HOST': RIVENDATABASEHOST,
'DIALECT' : RFDIALECT
}

default_env_vars = {
'DATABASE_HOST': 'sqlite:////riven/backend/data/media.db',
'BACKEND_URL': 'http://127.0.0.1:8080'
'BACKEND_URL': 'http://127.0.0.1:8080',
'DIALECT' : 'sqlite'
}

for key, value in env_vars.items():
Expand Down Expand Up @@ -114,7 +116,7 @@ def update_settings(current_settings, updated_settings, prefix=''):
def load_settings():
logger.info("Loading Riven settings")

set_env_variables()
#set_env_variables()
#set_debug_level('RIVEN_LOG_LEVEL') # An error occurred in the Riven setup: 'bool' object has no attribute 'items'
#set_debug_level('DMB_LOG_LEVEL') # An error occurred in the Riven setup: 'bool' object has no attribute 'items'

Expand Down
159 changes: 80 additions & 79 deletions riven_/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,84 +10,85 @@ def riven_setup(process_name, branch='main', release_version=None):
backend_dir= os.path.join(riven_dir, "backend")
frontend_dir = os.path.join(riven_dir, "frontend")
exclude_dirs = None
if process_name == 'Riven_backend':
repo_owner='rivenmedia'
repo_name='riven'

if RBVERSION is not None:
logger.info(f"Using {branch} branch version {RBVERSION} for {process_name}")
release_version = RBVERSION
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, backend_dir)
if not success:
logger.error(f"Failed to download the {release_version} release in {branch} branch for {process_name}: {error}")
raise Exception(f"Failed to download the {release_version} release in {branch} branch for {process_name}: {error}")
if success:
logger.info(f"Sucessfully downloaded the {release_version} release in {branch} branch for {process_name}")
elif RBBRANCH:
logger.info(f"Using {RBBRANCH} branch for {process_name}")
branch = RBBRANCH
from .download import get_branch
success, error = get_branch(repo_owner, repo_name, branch, backend_dir, exclude_dirs)
if not success:
logger.error(f"Failed to download the {branch} branch for {process_name}: {error}")
raise Exception(f"Failed to download the {branch} branch for {process_name}: {error}")
if success:
logger.info(f"Sucessfully downloaded {branch} branch for {process_name}")

else:
from .download import get_latest_release
release_version, error = get_latest_release(repo_owner, repo_name)
if not release_version:
logger.error(f"Failed to get the latest release for {process_name}: {error}")
raise Exception(f"Failed to get the latest release for {process_name}: {error}")
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, backend_dir)
if not success:
logger.error(f"Failed to download the latest release for {process_name}: {error}")
raise Exception(f"Failed to download the latest release for {process_name}: {error}")
if success:
logger.info(f"Sucessfully downloaded the latest release for {process_name}")

if process_name == 'Riven_frontend':
repo_owner='rivenmedia'
repo_name='riven-frontend'
if RFVERSION is not None:
logger.info(f"Using {branch} branch version {RFVERSION} for {process_name}")
release_version = RFVERSION
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, frontend_dir)
if not success:
logger.error(f"Failed to download the {release_version} release in {branch} branch for {process_name}: {error}")
raise Exception(f"Failed to download the {release_version} release in {branch} branch for {process_name}: {error}")
if success:
logger.info(f"Sucessfully downloaded the {release_version} release in {branch} branch for {process_name}")

elif RFBRANCH:
logger.info(f"Using {RFBRANCH} branch for {process_name}")
branch = RFBRANCH
from .download import get_branch
success, error = get_branch(repo_owner, repo_name, branch, frontend_dir, exclude_dirs)
if not success:
logger.error(f"Failed to download the {branch} branch for {process_name}: {error}")
raise Exception(f"Failed to download the {branch} branch for {process_name}: {error}")
if success:
logger.info(f"Sucessfully downloaded {branch} branch for {process_name}")

else:
from .download import get_latest_release
release_version, error = get_latest_release(repo_owner, repo_name)
if not release_version:
logger.error(f"Failed to get the latest release for {process_name}: {error}")
raise Exception(f"Failed to get the latest release for {process_name}: {error}")
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, frontend_dir)
if not success:
logger.error(f"Failed to download the latest release for {process_name}: {error}")
raise Exception(f"Failed to download the latest release for {process_name}: {error}")
if success:
logger.info(f"Sucessfully downloaded the latest release for {process_name}")
try:
if process_name == 'Riven_backend':
repo_owner='rivenmedia'
repo_name='riven'

if RBVERSION is not None:
logger.info(f"Using {branch} branch version {RBVERSION} for {process_name}")
release_version = RBVERSION
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, backend_dir)
if not success:
logger.error(f"Failed to download the {release_version} release in {branch} branch for {process_name}: {error}")
return False, error
logger.info(f"Successfully downloaded the {release_version} release in {branch} branch for {process_name}")

elif RBBRANCH:
logger.info(f"Using {RBBRANCH} branch for {process_name}")
branch = RBBRANCH
from .download import get_branch
success, error = get_branch(repo_owner, repo_name, branch, backend_dir, exclude_dirs)
if not success:
logger.error(f"Failed to download the {branch} branch for {process_name}: {error}")
return False, error
logger.info(f"Successfully downloaded {branch} branch for {process_name}")

else:
from .download import get_latest_release
release_version, error = get_latest_release(repo_owner, repo_name)
if not release_version:
logger.error(f"Failed to get the latest release for {process_name}: {error}")
return False, error
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, backend_dir)
if not success:
logger.error(f"Failed to download the latest release for {process_name}: {error}")
return False, error
logger.info(f"Successfully downloaded the latest release for {process_name}")

if process_name == 'Riven_frontend':
repo_owner='rivenmedia'
repo_name='riven-frontend'
if RFVERSION is not None:
logger.info(f"Using {branch} branch version {RFVERSION} for {process_name}")
release_version = RFVERSION
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, frontend_dir)
if not success:
logger.error(f"Failed to download the {release_version} release in {branch} branch for {process_name}: {error}")
return False, error
logger.info(f"Successfully downloaded the {release_version} release in {branch} branch for {process_name}")

elif RFBRANCH:
logger.info(f"Using {RFBRANCH} branch for {process_name}")
branch = RFBRANCH
from .download import get_branch
success, error = get_branch(repo_owner, repo_name, branch, frontend_dir, exclude_dirs)
if not success:
logger.error(f"Failed to download the {branch} branch for {process_name}: {error}")
return False, error
logger.info(f"Successfully downloaded {branch} branch for {process_name}")

else:
from .download import get_latest_release
release_version, error = get_latest_release(repo_owner, repo_name)
if not release_version:
logger.error(f"Failed to get the latest release for {process_name}: {error}")
return False, error
from .download import download_and_unzip_release
success, error = download_and_unzip_release(repo_owner, repo_name, release_version, frontend_dir)
if not success:
logger.error(f"Failed to download the latest release for {process_name}: {error}")
return False, error
logger.info(f"Successfully downloaded the latest release for {process_name}")

return True, None
except Exception as e:
logger.error(f"Exception during setup of {process_name}: {e}")
return False, str(e)

if __name__ == "__main__":
riven_setup()

Loading

0 comments on commit 446dac4

Please sign in to comment.