From 030682c754f3d2c182ab87e13a5a80e910bc0a05 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Fri, 7 Feb 2025 14:32:10 +0100 Subject: [PATCH] New Script: Cosmos (#2120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * New Script: Cosmos * update cosmos.json * update cosmos.sh and cosmos.json --------- Co-authored-by: Rögl-Brunner Michel --- ct/cosmos.sh | 45 ++++++++++++++++++++ install/cosmos-install.sh | 86 +++++++++++++++++++++++++++++++++++++++ json/cosmos.json | 35 ++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 ct/cosmos.sh create mode 100644 install/cosmos-install.sh create mode 100644 json/cosmos.json diff --git a/ct/cosmos.sh b/ct/cosmos.sh new file mode 100644 index 00000000..92fd6474 --- /dev/null +++ b/ct/cosmos.sh @@ -0,0 +1,45 @@ +#!/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: Michel Roegl-Brunner (michelroegl-brunner) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://https://cosmos-cloud.io/ + +# App Default Values +APP="cosmos" +var_tags="os,docker" +var_cpu="2" +var_ram="2048" +var_disk="8" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/cosmos ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_ok "${APP} updates itself automatically!" +} + +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}${CL}" diff --git a/install/cosmos-install.sh b/install/cosmos-install.sh new file mode 100644 index 00000000..cda9a121 --- /dev/null +++ b/install/cosmos-install.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + + +#Copyright (c) 2021-2025 community-scripts ORG +# Author: Michel Roegl-Brunner (michelroegl-brunner) +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + + +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 \ + mc \ + sudo \ + snapraid \ + avahi-daemon \ + fdisk +msg_ok "Installed Dependencies" + +msg_info "Install mergerfs" +MERGERFS_VERSION="2.40.2" +wget -q "https://github.com/trapexit/mergerfs/releases/download/${MERGERFS_VERSION}/mergerfs_${MERGERFS_VERSION}.debian-bullseye_amd64.deb" +$STD dpkg -i "mergerfs_${MERGERFS_VERSION}.debian-bullseye_amd64.deb" || $STD apt-get install -f -y +rm "mergerfs_${MERGERFS_VERSION}.debian-bullseye_amd64.deb" +msg_ok "Installed mergerfs" + +msg_info "Install Docker" +curl -fsSL https://get.docker.com -o get-docker.sh +$STD sh get-docker.sh +rm get-docker.sh +msg_ok "Installed Docker" + +msg_info "Install Cosmos" +mkdir -p /opt/cosmos +LATEST_RELEASE=$(curl -s https://api.github.com/repos/azukaar/Cosmos-Server/releases/latest | grep "tag_name" | cut -d '"' -f 4) +ZIP_FILE="cosmos-cloud-${LATEST_RELEASE#v}-amd64.zip" +curl -sL "https://github.com/azukaar/Cosmos-Server/releases/download/${LATEST_RELEASE}/${ZIP_FILE}" -o "/opt/cosmos/${ZIP_FILE}" +cd /opt/cosmos +unzip -o -q "${ZIP_FILE}" +LATEST_RELEASE_NO_V=${LATEST_RELEASE#v} +mv /opt/cosmos/cosmos-cloud-${LATEST_RELEASE_NO_V}/* /opt/cosmos/ +rmdir /opt/cosmos/cosmos-cloud-${LATEST_RELEASE_NO_V} +chmod +x /opt/cosmos/cosmos +msg_ok "Installed Cosmos" + +msg_info "Creating Service" +cat < /etc/systemd/system/cosmos.service +[Unit] +Description=Cosmos Cloud service +ConditionFileIsExecutable=/opt/cosmos/start.sh + +[Service] +StartLimitInterval=10 +StartLimitBurst=5 +ExecStart=/opt/cosmos/start.sh + +WorkingDirectory=/opt/cosmos + +Restart=always + +RestartSec=2 +EnvironmentFile=-/etc/sysconfig/CosmosCloud + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable -q --now cosmos.service +msg_info "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -f "/opt/cosmos/cosmos-cloud-${LATEST_RELEASE#v}-amd64.zip" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/cosmos.json b/json/cosmos.json new file mode 100644 index 00000000..9c6c5b0b --- /dev/null +++ b/json/cosmos.json @@ -0,0 +1,35 @@ +{ + "name": "Cosmos", + "slug": "cosmos", + "categories": [ + 2, + 3 + ], + "date_created": "2025-02-07", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://cosmos-cloud.io/doc/1%20index/", + "website": "https://cosmos-cloud.io/", + "logo": "https://github.com/azukaar/Cosmos-Server/blob/master/Logo.png", + "description": "Selfhosting your own cloud and web services is so satisfying, but it's also very time consuming, and dangerous. With Cosmos, take the chore out of selfhosting, with automated maintenance and fully secured setup out of the box. It even integrates to your existing setup.", + "install_methods": [ + { + "type": "default", + "script": "ct/cosmos.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 8, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +}