diff --git a/ct/duplicati.sh b/ct/duplicati.sh new file mode 100644 index 00000000..ec68cb5e --- /dev/null +++ b/ct/duplicati.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: tremor021 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/duplicati/duplicati/ + +APP="Duplicati" +TAGS="backup" +var_cpu="1" +var_ram="1024" +var_disk="10" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +base_settings + +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /usr/bin/duplicati-server ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/duplicati/duplicati/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop duplicati + msg_ok "Stopped $APP" + msg_info "Updating $APP to v${RELEASE}" + wget -q "https://github.com/duplicati/duplicati/releases/download/v${RELEASE}/duplicati-${RELEASE}-linux-x64-gui.deb" + $STD dpkg -i duplicati-${RELEASE}-linux-x64-gui.deb + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start duplicati + msg_ok "Started $APP" + + msg_info "Cleaning Up" + rm -rf ~/duplicati-${RELEASE}-linux-x64-gui.deb + msg_ok "Cleanup Completed" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8200${CL}" diff --git a/install/duplicati-install.sh b/install/duplicati-install.sh new file mode 100644 index 00000000..cd7863f1 --- /dev/null +++ b/install/duplicati-install.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: tremor021 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/duplicati/duplicati + +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 \ + sudo \ + mc \ + libice6 \ + libsm6 \ + libfontconfig1 +msg_ok "Installed Dependencies" + +msg_info "Setting up Duplicati" +RELEASE=$(curl -s https://api.github.com/repos/duplicati/duplicati/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') +wget -q "https://github.com/duplicati/duplicati/releases/download/v${RELEASE}/duplicati-${RELEASE}-linux-x64-gui.deb" +$STD dpkg -i duplicati-${RELEASE}-linux-x64-gui.deb +echo "${RELEASE}" >/opt/Duplicati_version.txt +msg_ok "Finished setting up Duplicati" + +DECRYPTKEY=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +ADMINPASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +{ + echo "Admin password = ${ADMINPASS}" + echo "Database encryption key = ${DECRYPTKEY}" +} >> ~/duplicati.creds + +msg_info "Creating Service" +cat </etc/systemd/system/duplicati.service +[Unit] +Description=Duplicati Service +After=network.target + +[Service] +ExecStart=/usr/bin/duplicati-server --webservice-interface=any --webservice-password=$ADMINPASS --settings-encryption-key=$DECRYPTKEY +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now duplicati +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -f duplicati-${RELEASE}-linux-x64-gui.deb +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize diff --git a/json/duplicati.json b/json/duplicati.json new file mode 100644 index 00000000..57f3972d --- /dev/null +++ b/json/duplicati.json @@ -0,0 +1,39 @@ +{ + "name": "Duplicati", + "slug": "duplicati", + "categories": [ + 7 + ], + "date_created": "2025-02-06", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8200, + "documentation": "https://docs.duplicati.com/", + "website": "https://duplicati.com/", + "logo": "https://framerusercontent.com/images/LezF3gmqYkyAgrNprSShLYIsw.png", + "description": "Duplicati is a free, open-source backup solution that offers zero-trust, fully encrypted backups for your data.", + "install_methods": [ + { + "type": "default", + "script": "ct/duplicati.sh", + "resources": { + "cpu": 1, + "ram": 1048, + "hdd": 10, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Admin password and database encryption key: `cat ~/duplicati.creds`", + "type": "info" + } + ] +} \ No newline at end of file