cleanup
This commit is contained in:
parent
7587b22344
commit
3cdc54eddc
84
ct/gomft.sh
84
ct/gomft.sh
@ -1,84 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/StarFleetCPTN/GoMFT
|
||||
|
||||
APP="GoMFT"
|
||||
var_tags="backup"
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_disk="4"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d "/opt/gomft" ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if ! dpkg -l | grep -q "^ii.*build-essential"; then
|
||||
$STD apt-get install -y build-essential
|
||||
fi
|
||||
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
msg_info "Stopping $APP"
|
||||
systemctl stop gomft
|
||||
msg_ok "Stopped $APP"
|
||||
|
||||
msg_info "Updating $APP to ${RELEASE}"
|
||||
rm -f /opt/gomft/gomft
|
||||
temp_file=$(mktemp)
|
||||
curl -fsSL "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v.${RELEASE}.tar.gz" -o $temp_file
|
||||
tar -xzf $temp_file
|
||||
cp -rf GoMFT-v.${RELEASE}/* /opt/gomft
|
||||
cd /opt/gomft
|
||||
rm -f /opt/gomft/node_modules
|
||||
$STD npm ci
|
||||
$STD node build.js
|
||||
$STD go mod download
|
||||
$STD go get -u github.com/a-h/templ
|
||||
$STD $HOME/go/bin/templ generate
|
||||
export CGO_ENABLED=1
|
||||
export GOOS=linux
|
||||
$STD go build -o gomft
|
||||
chmod +x /opt/gomft/gomft
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP to ${RELEASE}"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -f $temp_file
|
||||
rm -rf GoMFT-v.${RELEASE}
|
||||
msg_ok "Cleanup Complete"
|
||||
|
||||
msg_info "Starting $APP"
|
||||
systemctl start gomft
|
||||
msg_ok "Started $APP"
|
||||
|
||||
msg_ok "Update Successful"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${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}"
|
62
ct/komodo.sh
62
ct/komodo.sh
@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: MickLesk
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://komo.do
|
||||
|
||||
APP="Komodo"
|
||||
var_tags="${var_tags:-docker}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-10}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-12}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
[[ -d /opt/komodo ]] || {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
msg_info "Updating ${APP}"
|
||||
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
||||
if [[ -z "$COMPOSE_FILE" ]]; then
|
||||
msg_error "No valid compose file found in /opt/komodo!"
|
||||
exit 1
|
||||
fi
|
||||
COMPOSE_BASENAME=$(basename "$COMPOSE_FILE")
|
||||
BACKUP_FILE="/opt/komodo/${COMPOSE_BASENAME}.bak_$(date +%Y%m%d_%H%M%S)"
|
||||
cp "$COMPOSE_FILE" "$BACKUP_FILE" || {
|
||||
msg_error "Failed to create backup of ${COMPOSE_BASENAME}!"
|
||||
exit 1
|
||||
}
|
||||
GITHUB_URL="https://raw.githubusercontent.com/moghtech/komodo/main/compose/${COMPOSE_BASENAME}"
|
||||
if ! curl -fsSL "$GITHUB_URL" -o "$COMPOSE_FILE"; then
|
||||
msg_error "Failed to download ${COMPOSE_BASENAME} from GitHub!"
|
||||
mv "$BACKUP_FILE" "$COMPOSE_FILE"
|
||||
exit 1
|
||||
fi
|
||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
||||
msg_ok "Updated ${APP}"
|
||||
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}:9120${CL}"
|
@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://sabnzbd.org/
|
||||
|
||||
APP="SABnzbd"
|
||||
var_tags="${var_tags:-downloader}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-5}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-12}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/sabnzbd ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
|
||||
if [[ -f /opt/${APP}_version.txt ]] && [[ "${RELEASE}" == "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Updating $APP to ${RELEASE}"
|
||||
systemctl stop sabnzbd
|
||||
cp -r /opt/sabnzbd /opt/sabnzbd_backup_$(date +%s)
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
curl -fsSL "https://github.com/sabnzbd/sabnzbd/releases/download/${RELEASE}/SABnzbd-${RELEASE}-src.tar.gz" | tar -xz -C "$tmpdir"
|
||||
cp -rf "${tmpdir}/SABnzbd-${RELEASE}/"* /opt/sabnzbd/
|
||||
rm -rf "$tmpdir"
|
||||
|
||||
# Check if venv exists, else create with uv
|
||||
if [[ ! -d /opt/sabnzbd/venv ]]; then
|
||||
msg_info "Migrating SABnzbd to uv virtual environment"
|
||||
$STD uv venv /opt/sabnzbd/venv
|
||||
msg_ok "Created uv venv at /opt/sabnzbd/venv"
|
||||
|
||||
if grep -q "ExecStart=python3 SABnzbd.py" /etc/systemd/system/sabnzbd.service; then
|
||||
sed -i "s|ExecStart=python3 SABnzbd.py|ExecStart=/opt/sabnzbd/venv/bin/python SABnzbd.py|" /etc/systemd/system/sabnzbd.service
|
||||
systemctl daemon-reload
|
||||
msg_ok "Updated SABnzbd service to use uv venv"
|
||||
fi
|
||||
fi
|
||||
|
||||
$STD uv pip install --upgrade pip --python=/opt/sabnzbd/venv/bin/python
|
||||
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
|
||||
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
systemctl start sabnzbd
|
||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||
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}:7777${CL}"
|
@ -1,77 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: MickLesk (Canbiz)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://zipline.diced.sh/
|
||||
|
||||
APP="Zipline"
|
||||
var_tags="${var_tags:-file;sharing}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-5}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-12}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/zipline ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
if ! command -v pnpm &>/dev/null; then
|
||||
msg_info "Installing pnpm"
|
||||
#export NODE_OPTIONS=--openssl-legacy-provider
|
||||
$STD npm install -g pnpm@latest
|
||||
msg_ok "Installed pnpm"
|
||||
fi
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/diced/zipline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop zipline
|
||||
msg_ok "${APP} Stopped"
|
||||
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
cp /opt/zipline/.env /opt/
|
||||
mkdir -p /opt/zipline-updload
|
||||
$STD cp -R /opt/zipline/updload/* /opt/zipline-upload/ || true
|
||||
curl -fsSL "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip")
|
||||
unzip -q v${RELEASE}.zip
|
||||
rm -R /opt/zipline
|
||||
mv zipline-${RELEASE} /opt/zipline
|
||||
cd /opt/zipline
|
||||
mv /opt/.env /opt/zipline/.env
|
||||
$STD pnpm install
|
||||
$STD pnpm build
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start zipline
|
||||
msg_ok "Started ${APP}"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf v${RELEASE}.zip
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated Successfully"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${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}:3000${CL}"
|
@ -1,118 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/StarFleetCPTN/GoMFT
|
||||
|
||||
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 \
|
||||
sqlite3 \
|
||||
rclone \
|
||||
tzdata \
|
||||
ca-certificates \
|
||||
build-essential \
|
||||
gnupg
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up Node.js Repository"
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||
msg_ok "Set up Node.js Repository"
|
||||
|
||||
msg_info "Installing Node.js"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
msg_ok "Installed Node.js"
|
||||
|
||||
msg_info "Setting up Golang"
|
||||
set +o pipefail
|
||||
temp_file=$(mktemp)
|
||||
golang_tarball=$(curl -s https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1)
|
||||
wget -q https://golang.org/dl/"$golang_tarball" -O "$temp_file"
|
||||
tar -C /usr/local -xzf "$temp_file"
|
||||
ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
||||
set -o pipefail
|
||||
msg_ok "Setup Golang"
|
||||
|
||||
msg_info "Setup ${APPLICATION} (Patience)"
|
||||
temp_file=$(mktemp)
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v.${RELEASE}.tar.gz" -o $temp_file
|
||||
tar -xzf $temp_file
|
||||
mv GoMFT-v.${RELEASE}/ /opt/gomft
|
||||
cd /opt/gomft
|
||||
$STD npm ci
|
||||
$STD node build.js
|
||||
$STD go mod download
|
||||
$STD go install github.com/a-h/templ/cmd/templ@latest
|
||||
$STD go get -u github.com/a-h/templ
|
||||
$STD $HOME/go/bin/templ generate
|
||||
export CGO_ENABLED=1
|
||||
export GOOS=linux
|
||||
$STD go build -o gomft
|
||||
chmod +x /opt/gomft/gomft
|
||||
JWT_SECRET_KEY=$(openssl rand -base64 24 | tr -d '/+=')
|
||||
|
||||
cat <<EOF >/opt/gomft/.env
|
||||
SERVER_ADDRESS=:8080
|
||||
DATA_DIR=/opt/gomft/data/gomft
|
||||
BACKUP_DIR=/opt/gomft/data/gomft/backups
|
||||
JWT_SECRET=$JWT_SECRET_KEY
|
||||
BASE_URL=http://localhost:8080
|
||||
|
||||
# Email configuration
|
||||
EMAIL_ENABLED=false
|
||||
EMAIL_HOST=smtp.example.com
|
||||
EMAIL_PORT=587
|
||||
EMAIL_FROM_EMAIL=gomft@example.com
|
||||
EMAIL_FROM_NAME=GoMFT
|
||||
EMAIL_REPLY_TO=
|
||||
EMAIL_ENABLE_TLS=true
|
||||
EMAIL_REQUIRE_AUTH=true
|
||||
EMAIL_USERNAME=smtp_username
|
||||
EMAIL_PASSWORD=smtp_password
|
||||
EOF
|
||||
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Setup ${APPLICATION}"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/gomft.service
|
||||
[Unit]
|
||||
Description=GoMFT Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/gomft
|
||||
ExecStart=/opt/gomft/./gomft
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now gomft
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -f $temp_file
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
motd_ssh
|
||||
customize
|
@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://sabnzbd.org/
|
||||
|
||||
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 \
|
||||
par2 \
|
||||
p7zip-full
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setup uv"
|
||||
setup_uv
|
||||
msg_ok "Setup uv"
|
||||
|
||||
msg_info "Setup Unrar"
|
||||
cat <<EOF >/etc/apt/sources.list.d/non-free.list
|
||||
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
|
||||
EOF
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y unrar
|
||||
rm /etc/apt/sources.list.d/non-free.list
|
||||
msg_ok "Setup Unrar"
|
||||
|
||||
msg_info "Installing SABnzbd"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
mkdir -p /opt/sabnzbd
|
||||
$STD uv venv /opt/sabnzbd/venv
|
||||
$STD tar zxvf <(curl -fsSL https://github.com/sabnzbd/sabnzbd/releases/download/${RELEASE}/SABnzbd-${RELEASE}-src.tar.gz) -C /opt/sabnzbd --strip-components=1
|
||||
$STD uv pip install -r /opt/sabnzbd/requirements.txt --python=/opt/sabnzbd/venv/bin/python
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed SABnzbd"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/sabnzbd.service
|
||||
[Unit]
|
||||
Description=SABnzbd
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/sabnzbd
|
||||
ExecStart=/opt/sabnzbd/venv/bin/python SABnzbd.py -s 0.0.0.0:7777
|
||||
Restart=always
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now sabnzbd
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
@ -1,95 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 tteck
|
||||
# Author: tteck
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/diced/zipline
|
||||
|
||||
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 \
|
||||
postgresql \
|
||||
gpg
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Setting up Node.js Repository"
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||
msg_ok "Set up Node.js Repository"
|
||||
|
||||
msg_info "Installing Node.js"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y nodejs
|
||||
$STD npm install -g pnpm
|
||||
msg_ok "Installed Node.js"
|
||||
|
||||
msg_info "Setting up PostgreSQL"
|
||||
DB_NAME=ziplinedb
|
||||
DB_USER=zipline
|
||||
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
|
||||
SECRET_KEY="$(openssl rand -base64 42 | tr -dc 'a-zA-Z0-9')"
|
||||
$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 "" >>~/zipline.creds
|
||||
echo -e "Zipline Database User: $DB_USER" >>~/zipline.creds
|
||||
echo -e "Zipline Database Password: $DB_PASS" >>~/zipline.creds
|
||||
echo -e "Zipline Database Name: $DB_NAME" >>~/zipline.creds
|
||||
echo -e "Zipline Secret: $SECRET_KEY" >>~/zipline.creds
|
||||
msg_ok "Set up PostgreSQL"
|
||||
|
||||
msg_info "Installing Zipline (Patience)"
|
||||
cd /opt
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/diced/zipline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
curl -fsSL "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip")
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv zipline-${RELEASE} /opt/zipline
|
||||
cd /opt/zipline
|
||||
cat <<EOF >/opt/zipline/.env
|
||||
DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME
|
||||
CORE_SECRET=$SECRET_KEY
|
||||
CORE_HOSTNAME=0.0.0.0
|
||||
CORE_PORT=3000
|
||||
CORE_RETURN_HTTPS=false
|
||||
DATASOURCE_TYPE=local
|
||||
DATASOURCE_LOCAL_DIRECTORY=/opt/zipline-uploads
|
||||
EOF
|
||||
$STD pnpm install
|
||||
$STD pnpm build
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Installed Zipline"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/zipline.service
|
||||
[Unit]
|
||||
Description=Zipline Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/zipline
|
||||
ExecStart=/usr/bin/pnpm start
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now zipline
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user