diff --git a/install/debian-install.sh b/install/debian-install.sh index 9cc15138..8c836c9f 100644 --- a/install/debian-install.sh +++ b/install/debian-install.sh @@ -17,43 +17,7 @@ msg_info "Installing Dependencies" #$STD apt-get install -y gnup msg_ok "Installed Dependencies" -msg_info "Setup K3s" -cat </etc/rc.local -#!/bin/sh -e -if [ ! -e /dev/kmsg ]; then - ln -s /dev/console /dev/kmsg -fi -mount --make-rshared / -EOF - -chmod +x /etc/rc.local -/etc/rc.local - -curl -sfL https://get.k3s.io | sh -s - --disable=traefik --disable=servicelb --node-name control.k8s - -# Setup kubectl for non-root user access -echo 'export KUBECONFIG=~/.kube/config' >>~/.bashrc -echo 'source <(kubectl completion bash)' >>~/.bashrc -echo 'alias k=kubectl' >>~/.bashrc -echo 'complete -o default -F __start_kubectl k' >>~/.bashrc -source ~/.bashrc -mkdir ~/.kube 2>/dev/null -sudo k3s kubectl config view --raw >"$KUBECONFIG" -chmod 600 "$KUBECONFIG" -# Test to make sure non-root kubectl is working -kubectl get nodes - -msg_ok "Setup K3s" - -msg_info "Setup Helm" -# Install Helm -curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg >/dev/null -sudo apt-get install apt-transport-https --yes -echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list -sudo apt-get update -sudo apt-get install helm -helm version -msg_ok "Setup Helm" +PYTHON_VERSION="3.12" setup_uv #echo -e "fetching healthchecks" #fetch_and_deploy_gh_release "healthchecks" "healthchecks/healthchecks" "tarball" "latest" "/opt/healthchecks" diff --git a/install/nimbus-install.sh b/install/nimbus-install.sh new file mode 100644 index 00000000..9cbeead4 --- /dev/null +++ b/install/nimbus-install.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/arunavo4/gitea-mirror + +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 \ + build-essential \ + openssl \ + git +msg_ok "Installed Dependencies" + +msg_info "Installing Bun" +export BUN_INSTALL=/opt/bun +curl -fsSL https://bun.sh/install | $STD bash +ln -sf /opt/bun/bin/bun /usr/local/bin/bun +ln -sf /opt/bun/bin/bun /usr/local/bin/bunx +msg_ok "Installed Bun" + +msg_info "Setting up PostgreSQL Database" +DB_NAME=nimbus +DB_USER=nimbus +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +APP_SECRET=$(openssl rand -base64 32) +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +{ + echo "Nimbus-Credentials" + echo "Nimbus Database User: $DB_USER" + echo "Nimbus Database Password: $DB_PASS" + echo "Nimbus Database Name: $DB_NAME" +} >>~/nimbus.creds +msg_ok "Set up PostgreSQL Database" + +msg_info "Installing nimbus" +cd /opt +git clone https://github.com/logscore/Nimbus.git +cd /opt/Nimbus +$STD bun install +$STD bun run build +$STD bun run manage-db init +msg_ok "Installed gitea-mirror" + +msg_info "Creating Services" +JWT_SECRET=$(openssl rand -hex 32) +cat </etc/systemd/system/gitea-mirror.service +[Unit] +Description=Gitea Mirror +After=network.target +[Service] +Type=simple +WorkingDirectory=/opt/gitea-mirror +ExecStart=/usr/local/bin/bun dist/server/entry.mjs +Restart=on-failure +RestartSec=10 +Environment=NODE_ENV=production +Environment=HOST=0.0.0.0 +Environment=PORT=4321 +Environment=DATABASE_URL=file:/opt/gitea-mirror/data/gitea-mirror.db +Environment=JWT_SECRET=${JWT_SECRET} +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gitea-mirror +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"