From 48db08192aead83da90005b6bdc901a7780c0ee2 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 15:26:39 +0200 Subject: [PATCH] cloudflare-ddns (#4647) * 'Add new script' * Update cloudflare-ddns.json --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com> --- ct/cloudflare-ddns.sh | 37 ++++++++++ ct/headers/cloudflare-ddns | 6 ++ frontend/public/json/cloudflare-ddns.json | 44 ++++++++++++ install/cloudflare-ddns-install.sh | 87 +++++++++++++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 ct/cloudflare-ddns.sh create mode 100644 ct/headers/cloudflare-ddns create mode 100644 frontend/public/json/cloudflare-ddns.json create mode 100644 install/cloudflare-ddns-install.sh diff --git a/ct/cloudflare-ddns.sh b/ct/cloudflare-ddns.sh new file mode 100644 index 000000000..7a3b5a059 --- /dev/null +++ b/ct/cloudflare-ddns.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/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_tags:-network}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-3}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${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" diff --git a/ct/headers/cloudflare-ddns b/ct/headers/cloudflare-ddns new file mode 100644 index 000000000..df08fe8db --- /dev/null +++ b/ct/headers/cloudflare-ddns @@ -0,0 +1,6 @@ + ________ ________ ____ ____ _ _______ + / ____/ /___ __ ______/ / __/ /___ _________ / __ \/ __ \/ | / / ___/ + / / / / __ \/ / / / __ / /_/ / __ `/ ___/ _ \______/ / / / / / / |/ /\__ \ +/ /___/ / /_/ / /_/ / /_/ / __/ / /_/ / / / __/_____/ /_/ / /_/ / /| /___/ / +\____/_/\____/\__,_/\__,_/_/ /_/\__,_/_/ \___/ /_____/_____/_/ |_//____/ + diff --git a/frontend/public/json/cloudflare-ddns.json b/frontend/public/json/cloudflare-ddns.json new file mode 100644 index 000000000..d867a9dbb --- /dev/null +++ b/frontend/public/json/cloudflare-ddns.json @@ -0,0 +1,44 @@ +{ + "name": "Cloudflare-DDNS", + "slug": "cloudflare-ddns", + "categories": [ + 4 + ], + "date_created": "2025-05-22", + "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/webp/cloudflare.webp", + "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 `https://github.com/favonia/cloudflare-ddns?tab=readme-ov-file#-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 `systemctl restart cloudflare-ddns`", + "type": "info" + } + ] +} diff --git a/install/cloudflare-ddns-install.sh b/install/cloudflare-ddns-install.sh new file mode 100644 index 000000000..f4268d117 --- /dev/null +++ b/install/cloudflare-ddns-install.sh @@ -0,0 +1,87 @@ +#!/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 + +install_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 </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 +systemctl enable -q --now cloudflare-ddns +msg_ok "Setup Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"