mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-18 08:22:16 +00:00
Refactor: Dispatcharr (#10599)
* Refactor * Oops * add new deps * fix: add new deps --------- Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
@@ -32,6 +32,16 @@ function update_script() {
|
|||||||
setup_uv
|
setup_uv
|
||||||
NODE_VERSION="24" setup_nodejs
|
NODE_VERSION="24" setup_nodejs
|
||||||
|
|
||||||
|
# Fix for nginx not allowing large files
|
||||||
|
if ! grep -q "client_max_body_size 100M;" /etc/nginx/sites-available/dispatcharr.conf; then
|
||||||
|
sed -i '/server_name _;/a \ client_max_body_size 100M;' /etc/nginx/sites-available/dispatcharr.conf
|
||||||
|
systemctl reload nginx
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! dpkg -s vlc-bin vlc-plugin-base &>/dev/null; then
|
||||||
|
$STD apt update && $STD apt install -y vlc-bin vlc-plugin-base
|
||||||
|
fi
|
||||||
|
|
||||||
if check_for_gh_release "Dispatcharr" "Dispatcharr/Dispatcharr"; then
|
if check_for_gh_release "Dispatcharr" "Dispatcharr/Dispatcharr"; then
|
||||||
msg_info "Stopping Services"
|
msg_info "Stopping Services"
|
||||||
systemctl stop dispatcharr-celery
|
systemctl stop dispatcharr-celery
|
||||||
|
|||||||
@@ -23,32 +23,16 @@ $STD apt install -y \
|
|||||||
redis-server \
|
redis-server \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
procps \
|
procps \
|
||||||
|
vlc-bin \
|
||||||
|
vlc-plugin-base \
|
||||||
streamlink
|
streamlink
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
setup_uv
|
setup_uv
|
||||||
NODE_VERSION="24" setup_nodejs
|
NODE_VERSION="24" setup_nodejs
|
||||||
PG_VERSION="16" setup_postgresql
|
PG_VERSION="16" setup_postgresql
|
||||||
|
PG_DB_NAME="dispatcharr_db" PG_DB_USER="dispatcharr_usr" setup_postgresql_db
|
||||||
msg_info "Creating PostgreSQL Database"
|
fetch_and_deploy_gh_release "dispatcharr" "Dispatcharr/Dispatcharr" "tarball"
|
||||||
DB_NAME=dispatcharr_db
|
|
||||||
DB_USER=dispatcharr_usr
|
|
||||||
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 ENCODING 'UTF8' TEMPLATE template0;"
|
|
||||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
|
||||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
|
||||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
|
|
||||||
{
|
|
||||||
echo "Dispatcharr Credentials"
|
|
||||||
echo "Database Name: $DB_NAME"
|
|
||||||
echo "Database User: $DB_USER"
|
|
||||||
echo "Database Password: $DB_PASS"
|
|
||||||
echo ""
|
|
||||||
} >>~/dispatcharr.creds
|
|
||||||
msg_ok "Created PostgreSQL Database"
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "dispatcharr" "Dispatcharr/Dispatcharr"
|
|
||||||
|
|
||||||
msg_info "Installing Python Dependencies with uv"
|
msg_info "Installing Python Dependencies with uv"
|
||||||
cd /opt/dispatcharr
|
cd /opt/dispatcharr
|
||||||
@@ -64,19 +48,19 @@ install -d -m 755 \
|
|||||||
/data/{m3us,epgs}
|
/data/{m3us,epgs}
|
||||||
chown -R root:root /data
|
chown -R root:root /data
|
||||||
DJANGO_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
|
DJANGO_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
|
||||||
export DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
|
export DATABASE_URL="postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}"
|
||||||
export POSTGRES_DB=$DB_NAME
|
export POSTGRES_DB=$PG_DB_NAME
|
||||||
export POSTGRES_USER=$DB_USER
|
export POSTGRES_USER=$PG_DB_USER
|
||||||
export POSTGRES_PASSWORD=$DB_PASS
|
export POSTGRES_PASSWORD=$PG_DB_PASS
|
||||||
export POSTGRES_HOST=localhost
|
export POSTGRES_HOST=localhost
|
||||||
export DJANGO_SECRET_KEY=$DJANGO_SECRET
|
export DJANGO_SECRET_KEY=$DJANGO_SECRET
|
||||||
$STD uv run python manage.py migrate --noinput
|
$STD uv run python manage.py migrate --noinput
|
||||||
$STD uv run python manage.py collectstatic --noinput
|
$STD uv run python manage.py collectstatic --noinput
|
||||||
cat <<EOF >/opt/dispatcharr/.env
|
cat <<EOF >/opt/dispatcharr/.env
|
||||||
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}
|
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}
|
||||||
POSTGRES_DB=$DB_NAME
|
POSTGRES_DB=$PG_DB_NAME
|
||||||
POSTGRES_USER=$DB_USER
|
POSTGRES_USER=$PG_DB_USER
|
||||||
POSTGRES_PASSWORD=$DB_PASS
|
POSTGRES_PASSWORD=$PG_DB_PASS
|
||||||
POSTGRES_HOST=localhost
|
POSTGRES_HOST=localhost
|
||||||
CELERY_BROKER_URL=redis://localhost:6379/0
|
CELERY_BROKER_URL=redis://localhost:6379/0
|
||||||
DJANGO_SECRET_KEY=$DJANGO_SECRET
|
DJANGO_SECRET_KEY=$DJANGO_SECRET
|
||||||
@@ -89,8 +73,9 @@ msg_ok "Configured Dispatcharr"
|
|||||||
msg_info "Configuring Nginx"
|
msg_info "Configuring Nginx"
|
||||||
cat <<EOF >/etc/nginx/sites-available/dispatcharr.conf
|
cat <<EOF >/etc/nginx/sites-available/dispatcharr.conf
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 9191;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
# Serve static assets with correct MIME types
|
# Serve static assets with correct MIME types
|
||||||
location /assets/ {
|
location /assets/ {
|
||||||
|
|||||||
Reference in New Issue
Block a user