Files
ProxmoxVE/install/headscale-install.sh

64 lines
1.4 KiB
Bash
Raw Permalink Normal View History

2024-05-13 05:28:18 -04:00
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
2024-05-13 05:28:18 -04:00
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/juanfont/headscale
2024-05-13 05:28:18 -04:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2024-05-13 05:28:18 -04:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
2025-07-24 12:43:32 +02:00
fetch_and_deploy_gh_release "headscale" "juanfont/headscale" "binary"
read -r -p "${TAB3}Would you like to add headscale-admin UI? <y/N> " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
fetch_and_deploy_gh_release "headscale-admin" "GoodiesHQ/headscale-admin" "prebuild" "latest" "/opt/headscale-admin" "admin.zip"
msg_info "Configuring headscale-admin"
$STD apt-get install -y caddy
$STD caddy stop
rm /etc/caddy/Caddyfile
2025-07-25 08:24:12 +02:00
cat <<'EOF' >/etc/caddy/Caddyfile
:80
redir /admin /admin/
handle_path /admin* {
root * /opt/headscale-admin
encode gzip zstd
header {
X-Content-Type-Options nosniff
}
try_files {path} {path}/ /opt/headscale-admin/index.html
file_server
}
handle /api/* {
reverse_proxy localhost:8080
}
EOF
caddy fmt --overwrite /etc/caddy/Caddyfile
systemctl start caddy
msg_ok "Configured headscale-admin"
fi
2025-07-24 12:43:32 +02:00
msg_info "Starting service"
2024-05-13 05:28:18 -04:00
systemctl enable -q --now headscale
2025-07-24 12:43:32 +02:00
msg_ok "Service started"
2024-05-13 05:28:18 -04:00
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"