Merge pull request 'Changed pip to uv and fix nginx setup' (#4) from huly-script into dev
Reviewed-on: #4
This commit is contained in:
@ -12,7 +12,6 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
APP="huly"
|
||||
REPO_URL="https://github.com/hcengineering/huly-selfhost.git"
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
@ -25,11 +24,14 @@ $STD git clone "$REPO_URL" /opt/huly-selfhost
|
||||
cd /opt/huly-selfhost || exit 1
|
||||
msg_ok "Cloned Huly repository"
|
||||
|
||||
msg_info "Setup uv"
|
||||
setup_uv
|
||||
msg_ok "Setup uv"
|
||||
|
||||
msg_info "Setting up Python environment"
|
||||
$STD python3 -m venv venv
|
||||
$STD ./venv/bin/pip install --upgrade pip
|
||||
$STD uv venv venv
|
||||
if [ -f requirements.txt ]; then
|
||||
$STD ./venv/bin/pip install -r requirements.txt
|
||||
$STD uv pip install --python venv/bin/python -r requirements.txt
|
||||
fi
|
||||
msg_ok "Python environment ready"
|
||||
|
||||
@ -43,17 +45,37 @@ 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
|
||||
# Create our own nginx configuration
|
||||
cat <<EOF >/etc/nginx/sites-available/huly.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Enable the site
|
||||
$STD ln -sf /etc/nginx/sites-available/huly.conf /etc/nginx/sites-enabled/huly.conf
|
||||
|
||||
# Test nginx configuration before reloading
|
||||
if nginx -t >/dev/null 2>&1; then
|
||||
$STD nginx -s reload
|
||||
else
|
||||
msg_error "nginx configuration test failed, skipping reload"
|
||||
fi
|
||||
msg_ok "nginx configured"
|
||||
|
||||
msg_info "Creating systemd service for Huly (example, adjust as needed)"
|
||||
msg_info "Creating systemd service for Huly"
|
||||
cat <<EOF >/etc/systemd/system/huly.service
|
||||
[Unit]
|
||||
Description=Huly Web Service
|
||||
@ -61,7 +83,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/huly-selfhost
|
||||
ExecStart=/opt/huly-selfhost/venv/bin/python main.py
|
||||
ExecStart=/usr/bin/python3 -m http.server 8080
|
||||
Restart=always
|
||||
User=root
|
||||
|
||||
|
||||
Reference in New Issue
Block a user