Add MediaManager files

This commit is contained in:
vhsdream 2025-07-27 11:06:05 -04:00
parent 422be7cab3
commit 09f32293f1
3 changed files with 214 additions and 0 deletions

60
ct/mediamanager.sh Normal file
View File

@ -0,0 +1,60 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: vhsdream
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/maxdorninger/MediaManager
APP="MediaManager"
var_tags="${var_tags:-arr}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/mediamanager ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/maxdorninger/MediaManager/releases/latest | yq '.tag_name' | sed 's/^v//')
if [[ "${RELEASE}" != "$(cat ~/.mediamanager 2>/dev/null)" ]] || [[ ! -f ~/.tududi ]]; then
msg_info "Stopping Service"
systemctl stop mediamanager
msg_ok "Stopped Service"
msg_info "Updating ${APP}"
fetch_and_deploy_gh_release "MediaManager" "maxdorninger/MediaManager" "latest" "tarball" "/opt/mediamanager"
msg_ok "Updated $APP"
msg_info "Starting Service"
systemctl start mediamanager
msg_ok "Started Service"
msg_ok "Updated Successfully"
else
msg_ok "Already up to date"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}"

View File

@ -0,0 +1,41 @@
{
"name": "MediaManager",
"slug": "mediamanager",
"categories": [
14,
13
],
"date_created": "2025-07-22",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 8000,
"documentation": "https://maxdorninger.github.io/MediaManager/introduction.html",
"config_path": "/opt/mm_data/config.toml",
"website": "https://github.com/maxdorninger/MediaManager",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/mediamanager.webp",
"description": "A modern selfhosted media management system for your media library",
"install_methods": [
{
"type": "default",
"script": "ct/mediamanager.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 4,
"os": "Debian",
"version": "12"
}
}
],
"default_credentials": {
"username": "<email address>",
"password": "admin"
},
"notes": [
{
"text": "During the installation, provide the email address of the first admin user",
"type": "info"
}
]
}

View File

@ -0,0 +1,113 @@
#!/usr/bin/env bash
# Copyright (c) 2025 Community Scripts ORG
# Author: vhsdream
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/maxdorninger/MediaManager
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing dependencies"
$STD apt-get install -y yq
msg_ok "Installed dependencies"
NODE_VERSION="24" setup_nodejs
PYTHON_VERSION="3.13" setup_uv
PG_VERSION="17" setup_postgresql
msg_info "Setting up PostgreSQL"
DB_NAME="MediaManager"
DB_USER="MediaManager"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
{
echo "MediaManager Credentials"
echo "MediaManager Database User: $DB_USER"
echo "MediaManager Database Password: $DB_PASS"
echo "MediaManager Database Name: $DB_NAME"
} >>~/mediamanager.creds
msg_ok "Set up PostgreSQL"
fetch_and_deploy_gh_release "MediaManager" "maxdorninger/MediaManager" "tarball" "latest" "/opt/mediamanager"
msg_info "Configuring MediaManager"
export CONFIG_DIR="/opt/mm_data/"
export FRONTEND_FILES_DIR="/opt/mm_data/web/build"
export BASE_PATH=""
export PUBLIC_VERSION=""
export PUBLIC_API_URL="${BASE_PATH}/api/v1"
export BASE_PATH="${BASE_PATH}/web"
cd /opt/mediamanager/web
$STD npm ci
$STD npm run build
mkdir -p "$CONFIG_DIR"/web
cp -r build "$FRONTEND_FILES_DIR"
export BASE_PATH=""
export VIRTUAL_ENV="/opt/mm_data/venv"
cd /opt/mediamanager
$STD /usr/local/bin/uv venv "$VIRTUAL_ENV"
$STD /usr/local/bin/uv sync --locked --active
msg_ok "Configured MediaManager"
read -r -p "Enter the email address of your first admin user: " admin_email
if [[ "$admin_email" ]]; then
EMAIL="$admin_email"
fi
msg_info "Creating config and start script"
LOCAL_IP="$(hostname -I | awk '{print $1}')"
SECRET="$(openssl rand -hex 32)"
sed -e "s/localhost:8/$LOCAL_IP:8/g" \
-e "s|/data/|$CONFIG_DIR|g" \
-e 's/"db"/"localhost"/' \
-e "s/password = \"MediaManager\"/password = \"$DB_PASS\"/" \
-e "/^token_secret/s/=.*/= \"$SECRET\"/" \
-e "s/admin@example.com/$EMAIL/" \
/opt/mediamanager/config.example.toml >/opt/mm_data/config.toml
mkdir -p "$CONFIG_DIR"/{images,tv,movies,torrents}
cat <<EOF >/opt/mm_data/start.sh
#!/usr/bin/env bash
export CONFIG_DIR="$CONFIG_DIR"
export FRONTEND_FILES_DIR="$FRONTEND_FILES_DIR"
cd /opt/mediamanager
/usr/local/bin/uv run alembic upgrade head
/usr/local/bin/uv run fastapi run ./media_manager/main.py --port 8000
EOF
msg_ok "Created config and start script"
msg_info "Creating service"
cat <<EOF >/etc/systemd/system/mediamanager.service
[Unit]
Description=MediaManager Backend Service
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/mm_data
ExecStart=/usr/bin/bash start.sh
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now mediamanager
msg_ok "Created service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"