86 lines
2.2 KiB
Bash
86 lines
2.2 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/hcengineering/huly-selfhost
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
APP="huly"
|
|
REPO_URL="https://github.com/hcengineering/huly-selfhost.git"
|
|
|
|
msg_info "Installing Dependencies"
|
|
$STD apt-get update
|
|
$STD apt-get install -y curl git ca-certificates gnupg nginx python3 python3-venv python3-pip nodejs npm jq build-essential
|
|
msg_ok "Installed Dependencies"
|
|
|
|
msg_info "Cloning Huly repository"
|
|
$STD git clone "$REPO_URL" /opt/huly-selfhost
|
|
cd /opt/huly-selfhost || exit 1
|
|
msg_ok "Cloned Huly repository"
|
|
|
|
msg_info "Setting up Python environment"
|
|
$STD python3 -m venv venv
|
|
$STD ./venv/bin/pip install --upgrade pip
|
|
if [ -f requirements.txt ]; then
|
|
$STD ./venv/bin/pip install -r requirements.txt
|
|
fi
|
|
msg_ok "Python environment ready"
|
|
|
|
msg_info "Setting up Node.js dependencies (if needed)"
|
|
if [ -f package.json ]; then
|
|
$STD npm install --omit=dev || true
|
|
fi
|
|
msg_ok "Node.js dependencies ready"
|
|
|
|
msg_info "Configuring Huly"
|
|
if [ -f config.sh ]; then
|
|
$STD ./config.sh
|
|
fi
|
|
if [ -f nginx.sh ]; then
|
|
$STD ./nginx.sh
|
|
fi
|
|
msg_ok "Huly configured"
|
|
|
|
msg_info "Configuring nginx"
|
|
$STD ln -sf /opt/huly-selfhost/nginx.conf /etc/nginx/sites-enabled/huly.conf
|
|
$STD nginx -s reload
|
|
msg_ok "nginx configured"
|
|
|
|
msg_info "Creating systemd service for Huly (example, adjust as needed)"
|
|
cat <<EOF >/etc/systemd/system/huly.service
|
|
[Unit]
|
|
Description=Huly Web Service
|
|
After=network.target
|
|
|
|
[Service]
|
|
WorkingDirectory=/opt/huly-selfhost
|
|
ExecStart=/opt/huly-selfhost/venv/bin/python main.py
|
|
Restart=always
|
|
User=root
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl daemon-reload
|
|
systemctl enable --now huly
|
|
msg_ok "Created and started Huly service"
|
|
|
|
motd_ssh
|
|
customize
|
|
|
|
msg_info "Cleaning up"
|
|
$STD apt-get -y autoremove
|
|
$STD apt-get -y autoclean
|
|
msg_ok "Cleaned"
|
|
|
|
echo -e "${INFO}${YW} Your Huly instance is now running!${CL}"
|
|
echo -e "${INFO}${YW} Access it at: http://$(hostname -I | awk '{print $1}')${CL}"
|
|
echo -e "${INFO}${YW} For additional configuration, see /opt/huly-selfhost and the official docs.${CL}"
|