New Script: Cosmos (#2120)

* New Script: Cosmos

* update cosmos.json

* update cosmos.sh and cosmos.json

---------

Co-authored-by: Rögl-Brunner Michel <Michel.Roegl-brunner@htl-braunau.int>
This commit is contained in:
Michel Roegl-Brunner 2025-02-07 14:32:10 +01:00 committed by GitHub
parent 3029e69767
commit 030682c754
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 166 additions and 0 deletions

45
ct/cosmos.sh Normal file
View File

@ -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}"

86
install/cosmos-install.sh Normal file
View File

@ -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 <<EOF > /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"

35
json/cosmos.json Normal file
View File

@ -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": []
}