From 42b175144af0b884e6e32db43671231c992395f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:29:49 +0100 Subject: [PATCH] New Script: seelf (#2023) * add seelf script * changed number of cores for LXC * Update install/seelf-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> * Update install/seelf-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --------- Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/seelf.sh | 77 ++++++++++++++++++++++++++++++++++++++ install/seelf-install.sh | 80 ++++++++++++++++++++++++++++++++++++++++ json/seelf.json | 39 ++++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 ct/seelf.sh create mode 100644 install/seelf-install.sh create mode 100644 json/seelf.json diff --git a/ct/seelf.sh b/ct/seelf.sh new file mode 100644 index 00000000..a1bb677d --- /dev/null +++ b/ct/seelf.sh @@ -0,0 +1,77 @@ +#!/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/YuukanOO/seelf + +APP="seelf" +TAGS="server;docker" +var_cpu="2" +var_ram="4096" +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 [[ ! -d /opt/seelf ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/YuukanOO/seelf/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 "Updating $APP" + + msg_info "Stopping $APP" + systemctl stop seelf + msg_ok "Stopped $APP" + + msg_info "Updating $APP to v${RELEASE}. Patience" + export PATH=$PATH:/usr/local/go/bin + source ~/.bashrc + wget -q "https://github.com/YuukanOO/seelf/archive/refs/tags/v${RELEASE}.tar.gz" + tar -xzf v${RELEASE}.tar.gz + cp -r seelf-${RELEASE}/ /opt/seelf + cd /opt/seelf + make build &> /dev/null + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start seelf + msg_ok "Started $APP" + + # Cleaning up + msg_info "Cleaning Up" + rm -f ~/*.tar.gz + rm -rf ~/seelf-${RELEASE} + msg_ok "Cleanup Completed" + + echo "${RELEASE}" >/opt/${APP}_version.txt + 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}:8080${CL}" \ No newline at end of file diff --git a/install/seelf-install.sh b/install/seelf-install.sh new file mode 100644 index 00000000..ddc16057 --- /dev/null +++ b/install/seelf-install.sh @@ -0,0 +1,80 @@ +#!/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/YuukanOO/seelf + +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 \ + make \ + gcc +wget -q https://go.dev/dl/go1.23.5.linux-amd64.tar.gz +curl -s -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash &> /dev/null +tar -C /usr/local -xzf go1.23.5.linux-amd64.tar.gz +export PATH=$PATH:/usr/local/go/bin +source ~/.bashrc +$STD nvm install node +msg_ok "Installed Dependencies" + +msg_info "Setting up seelf. Patience" +RELEASE=$(curl -s https://api.github.com/repos/YuukanOO/seelf/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q "https://github.com/YuukanOO/seelf/archive/refs/tags/v${RELEASE}.tar.gz" +tar -xzf v${RELEASE}.tar.gz +mv seelf-${RELEASE}/ /opt/seelf +cd /opt/seelf +$STD make build +PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +{ + echo "ADMIN_EMAIL=admin@example.com" + echo "ADMIN_PASSWORD=$PASS" +} | tee .env ~/seelf.creds > /dev/null + +echo "${RELEASE}" >/opt/seelf_version.txt +SEELF_ADMIN_EMAIL=admin@example.com SEELF_ADMIN_PASSWORD=$PASS ./seelf serve &> /dev/null & sleep 5 ; kill $! +msg_ok "Done setting up seelf" + +msg_info "Creating Service" +cat </etc/systemd/system/seelf.service +[Unit] +Description=seelf Service +After=network.target + +[Service] +Type=simple +User=root +Group=root +WorkingDirectory=/opt/seelf +ExecStart=/opt/seelf/./seelf serve +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now seelf +msg_ok "Created Service" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +rm -f ~/v${RELEASE}.tar.gz +rm -f ~/go1.23.5.linux-amd64.tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize \ No newline at end of file diff --git a/json/seelf.json b/json/seelf.json new file mode 100644 index 00000000..2ceb461d --- /dev/null +++ b/json/seelf.json @@ -0,0 +1,39 @@ +{ + "name": "seelf", + "slug": "seelf", + "categories": [ + 4 + ], + "date_created": "2025-02-04", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8080, + "documentation": "https://yuukanoo.github.io/seelf/guide/quickstart.html", + "website": "https://yuukanoo.github.io/seelf/", + "logo": "https://yuukanoo.github.io/seelf/logo-dark.svg", + "description": "seelf is a self-hosted software which makes it easy to deploy your own applications on your own hardware using an easy to use interface.", + "install_methods": [ + { + "type": "default", + "script": "ct/seelf.sh", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 10, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Initial admin email and password: `cat ~/seelf.creds`", + "type": "info" + } + ] +} \ No newline at end of file