92 lines
2.6 KiB
Bash
92 lines
2.6 KiB
Bash
#!/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
|
|
|
|
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 \
|
|
unzip \
|
|
build-essential
|
|
msg_ok "Installed Dependencies"
|
|
|
|
msg_info "Installing Python"
|
|
$STD apt-get install -y \
|
|
python3 \
|
|
python3-venv
|
|
msg_ok "Installed Python"
|
|
|
|
msg_info "Setup uv"
|
|
setup_uv
|
|
msg_ok "Setup uv"
|
|
|
|
msg_info "Installing Node.js"
|
|
NODE_VERSION="20" install_node_and_modules
|
|
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, 2, length($2)-3)}')
|
|
temp_file=$(mktemp)
|
|
$STD curl -fsSL -o "$temp_file" "https://github.com/Dictionarry-Hub/profilarr/archive/refs/tags/${RELEASE}.zip"
|
|
$STD unzip -q "$temp_file" -d /tmp
|
|
$STD mkdir -p /opt/${APPLICATION}
|
|
$STD mkdir -p /opt/${APPLICATION}_config
|
|
$STD mv "/tmp/profilarr-${RELEASE}/backend" /opt/${APPLICATION}/
|
|
$STD mv "/tmp/profilarr-${RELEASE}/frontend" /opt/${APPLICATION}/
|
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
|
$STD uv venv /opt/${APPLICATION}/venv
|
|
$STD uv pip install --python /opt/${APPLICATION}/venv/bin/python -r /opt/${APPLICATION}/backend/requirements.txt
|
|
$STD uv pip install --python /opt/${APPLICATION}/venv/bin/python gunicorn
|
|
msg_ok "Setup ${APPLICATION}"
|
|
|
|
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
|
|
systemctl enable -q --now ${APPLICATION}
|
|
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"
|