This commit is contained in:
MickLesk
2026-03-24 21:41:34 +01:00
parent b218d07e99
commit 5ee4a927d9
3 changed files with 37 additions and 102 deletions

View File

@@ -13,90 +13,42 @@ setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
make \
libcap2-bin
msg_ok "Installed Dependencies"
fetch_and_deploy_gh_release "godoxy" "yusing/godoxy" "singlefile" "latest" "/usr/local/bin" "godoxy-agent-linux-amd64"
GO_VERSION="1.24" setup_go
msg_info "Installing Bun"
export BUN_INSTALL="/root/.bun"
curl -fsSL https://bun.sh/install | $STD bash
ln -sf /root/.bun/bin/bun /usr/local/bin/bun
msg_ok "Installed Bun"
fetch_and_deploy_gh_release "godoxy" "yusing/godoxy" "tarball" "latest" "/opt/godoxy-src"
msg_info "Building GoDoxy (Patience)"
export PATH="/usr/local/go/bin:/root/.bun/bin:$PATH"
cd /opt/godoxy-src
sed -i '/^module github\.com\/yusing\/godoxy/!{/github\.com\/yusing\/godoxy/d}' go.mod
sed -i '/^module github\.com\/yusing\/goutils/!{/github\.com\/yusing\/goutils/d}' go.mod
$STD make build
cp /opt/godoxy-src/bin/godoxy /usr/local/bin/godoxy
msg_ok "Built GoDoxy"
msg_info "Configuring GoDoxy"
mkdir -p /opt/godoxy/{config,data/metrics,certs}
JWT_SECRET=$(openssl rand -base64 32)
GODOXY_PASS=$(openssl rand -base64 12 | tr -dc 'a-zA-Z0-9' | cut -c1-16)
cat <<EOF >/opt/godoxy/.env
TZ=UTC
GODOXY_HTTP_ADDR=:80
GODOXY_HTTPS_ADDR=:443
GODOXY_API_ADDR=0.0.0.0:8888
GODOXY_API_JWT_SECURE=false
GODOXY_API_JWT_SECRET=${JWT_SECRET}
GODOXY_API_USER=admin
GODOXY_API_PASSWORD=${GODOXY_PASS}
msg_info "Configuring GoDoxy Agent"
mkdir -p /var/lib/godoxy-agent
cat <<EOF >/etc/godoxy-agent.env
AGENT_NAME=$(hostname)
AGENT_PORT=8890
AGENT_CA_CERT=
AGENT_SSL_CERT=
DOCKER_SOCKET=/var/run/docker.sock
RUNTIME=docker
EOF
cat <<EOF >/opt/godoxy/config/config.yml
entrypoint:
support_proxy_protocol: false
defaults:
healthcheck:
interval: 5s
timeout: 15s
retries: 3
providers:
include: []
homepage:
use_default_categories: true
timeout_shutdown: 5
EOF
msg_ok "Configured GoDoxy"
chmod 600 /etc/godoxy-agent.env
msg_ok "Configured GoDoxy Agent"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/godoxy.service
cat <<EOF >/etc/systemd/system/godoxy-agent.service
[Unit]
Description=GoDoxy Reverse Proxy
Description=GoDoxy Agent
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/godoxy
EnvironmentFile=/opt/godoxy/.env
ExecStart=/usr/local/bin/godoxy
EnvironmentFile=/etc/godoxy-agent.env
WorkingDirectory=/var/lib/godoxy-agent
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now godoxy
systemctl enable -q --now godoxy-agent
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc
echo -e "${TAB}${GATEWAY}${BGN}WebUI:${CL} http://${LOCAL_IP}:8888"
echo -e "${TAB}${GATEWAY}${BGN}Username:${CL} admin"
echo -e "${TAB}${GATEWAY}${BGN}Password:${CL} ${GODOXY_PASS}"