new script: profilarr
This commit is contained in:
104
ct/profilarr.sh
Normal file
104
ct/profilarr.sh
Normal file
@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: GitHub Copilot
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/Dictionarry-Hub/profilarr
|
||||
|
||||
# Import Functions and Setup
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
APPLICATION="profilarr"
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
unzip \
|
||||
build-essential \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
ca-certificates \
|
||||
gnupg
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Node.js"
|
||||
$STD mkdir -p /etc/apt/keyrings
|
||||
$STD curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
$STD echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
msg_ok "Installed Node.js"
|
||||
|
||||
msg_info "Setup ${APPLICATION}"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
||||
temp_file=$(mktemp)
|
||||
$STD curl -fsSL -o "$temp_file" "https://github.com/Dictionarry-Hub/profilarr/archive/refs/tags/v${RELEASE}.zip"
|
||||
cd /tmp
|
||||
$STD unzip -q "$temp_file"
|
||||
$STD mkdir -p /opt/${APPLICATION}
|
||||
$STD mkdir -p /opt/${APPLICATION}_config
|
||||
$STD mv "profilarr-${RELEASE}/backend" /opt/${APPLICATION}/
|
||||
$STD mv "profilarr-${RELEASE}/frontend" /opt/${APPLICATION}/
|
||||
$STD chown -R root:root /opt/${APPLICATION}
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Setup ${APPLICATION}"
|
||||
|
||||
msg_info "Setting up Python Virtual Environment"
|
||||
$STD python3 -m venv /opt/${APPLICATION}/venv
|
||||
$STD /opt/${APPLICATION}/venv/bin/pip install --upgrade pip
|
||||
cd /opt/${APPLICATION}/backend
|
||||
$STD /opt/${APPLICATION}/venv/bin/pip install -r requirements.txt
|
||||
$STD /opt/${APPLICATION}/venv/bin/pip install gunicorn
|
||||
msg_ok "Setup Python Environment"
|
||||
|
||||
msg_info "Building Frontend"
|
||||
cd /opt/${APPLICATION}/frontend
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
$STD mkdir -p /opt/${APPLICATION}/backend/app/static
|
||||
$STD cp -r dist/* /opt/${APPLICATION}/backend/app/static/
|
||||
msg_ok "Built Frontend"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
|
||||
[Unit]
|
||||
Description=Profilarr Profile Manager
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/${APPLICATION}/backend
|
||||
Environment=PATH=/opt/${APPLICATION}/venv/bin
|
||||
Environment=CONFIG_PATH=/opt/${APPLICATION}_config
|
||||
ExecStart=/opt/${APPLICATION}/venv/bin/gunicorn --bind 0.0.0.0:6868 --workers 2 --timeout 120 app.main:create_app()
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
$STD systemctl daemon-reload
|
||||
$STD systemctl enable ${APPLICATION}.service
|
||||
$STD systemctl start ${APPLICATION}.service
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f "$temp_file"
|
||||
rm -rf "/tmp/profilarr-${RELEASE}"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
Reference in New Issue
Block a user