Merge pull request #230 from edoardop13/feature/cloudflare-ddns
Cloudflare-DDNS
This commit is contained in:
commit
32402cbd80
37
ct/cloudflare-ddns.sh
Normal file
37
ct/cloudflare-ddns.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: edoardop13
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/favonia/cloudflare-ddns
|
||||
|
||||
APP="Cloudflare-DDNS"
|
||||
var_tags=""
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_disk="2"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -f /etc/systemd/system/cloudflare-ddns.service ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_error "There is no update function for ${APP}."
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
msg_ok "Completed Successfully!\n"
|
44
frontend/public/json/cloudflare-ddns.json
Normal file
44
frontend/public/json/cloudflare-ddns.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "Cloudflare-DDNS",
|
||||
"slug": "cloudflare-ddns",
|
||||
"categories": [
|
||||
4
|
||||
],
|
||||
"date_created": "2025-04-23",
|
||||
"type": "ct",
|
||||
"updateable": false,
|
||||
"privileged": false,
|
||||
"interface_port": null,
|
||||
"documentation": "https://github.com/favonia/cloudflare-ddns/blob/main/README.markdown",
|
||||
"config_path": "/etc/systemd/system/cloudflare-ddns.service",
|
||||
"website": "https://github.com/favonia/cloudflare-ddns",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/cloudflare.svg",
|
||||
"description": "A feature-rich and robust Cloudflare DDNS updater with a small footprint. The program will detect your machine’s public IP addresses and update DNS records using the Cloudflare API",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/cloudflare-ddns.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 512,
|
||||
"hdd": 2,
|
||||
"os": "Debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "To setup the updater you must have the Cloudflare Token and the domains, please read the Github documentation at \"Step 1: Updating the Compose File\" (only the expandable section)",
|
||||
"type": "warning"
|
||||
},
|
||||
{
|
||||
"text": "To update the configuration edit `/etc/systemd/system/cloudflare-ddns.service`. After edit please restard with `sudo systemctl restart cloudflare-ddns.service`",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
93
install/cloudflare-ddns-install.sh
Normal file
93
install/cloudflare-ddns-install.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: edoardop13
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/favonia/cloudflare-ddns
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing dependencies"
|
||||
$STD apt-get install -y curl systemd
|
||||
msg_ok "Installed dependencies"
|
||||
|
||||
msg_info "Installing Go"
|
||||
GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | grep -m1 '^go')
|
||||
GO_TARBALL="${GO_VERSION}.linux-amd64.tar.gz"
|
||||
GO_URL="https://go.dev/dl/${GO_TARBALL}"
|
||||
INSTALL_DIR="/usr/bin"
|
||||
rm -rf "${INSTALL_DIR}/go"
|
||||
curl -LO "$GO_URL"
|
||||
tar -C "$INSTALL_DIR" -xzf "$GO_TARBALL"
|
||||
echo 'export PATH=$PATH:/usr/bin/go/bin' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
msg_ok "Installed Go"
|
||||
|
||||
msg_info "Configure Application"
|
||||
var_cf_api_token="default"
|
||||
read -rp "Enter the Cloudflare API token: " var_cf_api_token
|
||||
|
||||
var_cf_domains="default"
|
||||
read -rp "Enter the domains separated with a comma (*.example.org,www.example.org) " var_cf_domains
|
||||
|
||||
var_cf_proxied="false"
|
||||
while true; do
|
||||
read -rp "Proxied? (y/n): " answer
|
||||
case "$answer" in
|
||||
[Yy]* ) var_cf_proxied="true"; break;;
|
||||
[Nn]* ) var_cf_proxied="false"; break;;
|
||||
* ) echo "Please answer y or n.";;
|
||||
esac
|
||||
done
|
||||
var_cf_ip6_provider="none"
|
||||
while true; do
|
||||
read -rp "Enable IPv6 support? (y/n): " answer
|
||||
case "$answer" in
|
||||
[Yy]* ) var_cf_ip6_provider="auto"; break;;
|
||||
[Nn]* ) var_cf_ip6_provider="none"; break;;
|
||||
* ) echo "Please answer y or n.";;
|
||||
esac
|
||||
done
|
||||
msg_ok "Configured Application"
|
||||
|
||||
msg_info "Setting up service"
|
||||
mkdir -p /root/go
|
||||
cat <<EOF >/etc/systemd/system/cloudflare-ddns.service
|
||||
[Unit]
|
||||
Description=Cloudflare DDNS Service (Go run)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Environment="CLOUDFLARE_API_TOKEN=${var_cf_api_token}"
|
||||
Environment="DOMAINS=${var_cf_domains}"
|
||||
Environment="PROXIED=${var_cf_proxied}"
|
||||
Environment="IP6_PROVIDER=${var_cf_ip6_provider}"
|
||||
Environment="GOPATH=/root/go"
|
||||
Environment="GOCACHE=/tmp/go-build"
|
||||
ExecStart=/usr/bin/go/bin/go run github.com/favonia/cloudflare-ddns/cmd/ddns@latest
|
||||
Restart=always
|
||||
RestartSec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
msg_ok "Systemd service configured"
|
||||
|
||||
msg_info "Enabling and starting service"
|
||||
systemctl enable -q --now cloudflare-ddns.service
|
||||
msg_ok "Cloudflare DDNS service started"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
rm -f "$GO_TARBALL"
|
||||
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user