mirror of
https://github.com/tteck/Proxmox.git
synced 2024-12-25 14:31:56 +00:00
Compare commits
10 Commits
64eab60a4c
...
5ae25108ef
Author | SHA1 | Date | |
---|---|---|---|
|
5ae25108ef | ||
|
55c8d1187b | ||
|
9a5d43e4d3 | ||
|
bb2c143cc8 | ||
|
2a844122d0 | ||
|
540fcd24f2 | ||
|
c2c48b52c7 | ||
|
744e183eea | ||
|
468a5d367d | ||
|
edf0753120 |
@ -13,6 +13,14 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
> [!NOTE]
|
||||
All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
|
||||
|
||||
## 2024-10-25
|
||||
|
||||
### Changed
|
||||
|
||||
- **Zoraxy LXC** [(Commit)](https://github.com/tteck/Proxmox/commit/468a5d367ded4cf453a1507452e112ac3e234e2a)
|
||||
- Switch built from source to a pre-compiled binary version.
|
||||
- Breaking Change
|
||||
|
||||
## 2024-10-23
|
||||
|
||||
### Changed
|
||||
|
110
ct/adventurelog.sh
Normal file
110
ct/adventurelog.sh
Normal file
@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
___ __ __ __
|
||||
/ | ____/ / _____ ____ / /___ __________ / / ____ ____ _
|
||||
/ /| |/ __ / | / / _ \/ __ \/ __/ / / / ___/ _ \/ / / __ \/ __ `/
|
||||
/ ___ / /_/ /| |/ / __/ / / / /_/ /_/ / / / __/ /___/ /_/ / /_/ /
|
||||
/_/ |_\__,_/ |___/\___/_/ /_/\__/\__,_/_/ \___/_____/\____/\__, /
|
||||
/____/
|
||||
EOF
|
||||
}
|
||||
header_info
|
||||
echo -e "Loading..."
|
||||
APP="AdventureLog"
|
||||
var_disk="7"
|
||||
var_cpu="2"
|
||||
var_ram="2048"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function default_settings() {
|
||||
CT_TYPE="1"
|
||||
PW=""
|
||||
CT_ID=$NEXTID
|
||||
HN=$NSAPP
|
||||
DISK_SIZE="$var_disk"
|
||||
CORE_COUNT="$var_cpu"
|
||||
RAM_SIZE="$var_ram"
|
||||
BRG="vmbr0"
|
||||
NET="dhcp"
|
||||
GATE=""
|
||||
APT_CACHER=""
|
||||
APT_CACHER_IP=""
|
||||
DISABLEIP6="no"
|
||||
MTU=""
|
||||
SD=""
|
||||
NS=""
|
||||
MAC=""
|
||||
VLAN=""
|
||||
SSH="no"
|
||||
VERB="no"
|
||||
echo_default
|
||||
}
|
||||
function update_script() {
|
||||
header_info
|
||||
if [[ ! -d /opt/adventurelog ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||
if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
|
||||
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
|
||||
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
|
||||
fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/seanmorley15/AdventureLog/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 Services"
|
||||
systemctl stop adventurelog-backend
|
||||
systemctl stop adventurelog-frontend
|
||||
msg_ok "Services Stopped"
|
||||
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
cp /opt/adventurelog/backend/server/.env /opt/server.env
|
||||
cp /opt/adventurelog/frontend/env /opt/frontend.env
|
||||
wget -q "https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv AdventureLog-${RELEASE} /opt/adventurelog
|
||||
mv /opt/server.env /opt/adventurelog/backend/server/.env
|
||||
cd /opt/adventurelog/backend/server
|
||||
pip install --upgrade pip &>/dev/null
|
||||
pip install -r requirements.txt &>/dev/null
|
||||
python3 manage.py collectstatic --noinput &>/dev/null
|
||||
python3 manage.py migrate &>/dev/null
|
||||
|
||||
mv /opt/frontend.env /opt/adventurelog/frontend/.env
|
||||
cd /opt/adventurelog/frontend
|
||||
pnpm install &>/dev/null
|
||||
pnpm run build &>/dev/null
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP}"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start adventurelog-backend
|
||||
systemctl start adventurelog-frontend
|
||||
msg_ok "Started Services"
|
||||
|
||||
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 "${APP} Setup should be reachable by going to the following URL.
|
||||
${BL}http://${IP}:3000${CL} \n"
|
34
ct/zoraxy.sh
34
ct/zoraxy.sh
@ -20,7 +20,7 @@ header_info
|
||||
echo -e "Loading..."
|
||||
APP="Zoraxy"
|
||||
var_disk="6"
|
||||
var_cpu="4"
|
||||
var_cpu="2"
|
||||
var_ram="2048"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
@ -54,30 +54,28 @@ function default_settings() {
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
if [[ ! -d /opt/zoraxy/src ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "SET RESOURCES" "Please set the resources in your ${APP} LXC to ${var_cpu}vCPU and ${var_ram}RAM for the build process before continuing" 10 75
|
||||
msg_info "Updating $APP"
|
||||
systemctl stop zoraxy
|
||||
cd /opt/zoraxy/src
|
||||
systemctl stop zoraxy
|
||||
if git pull | grep -q 'Already up to date.'; then
|
||||
msg_ok "Already up to date. No update required."
|
||||
else
|
||||
go mod tidy
|
||||
go build
|
||||
if [[ ! -d /opt/zoraxy/ ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||
RELEASE=$(curl -s https://api.github.com/repos/tobychui/zoraxy/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_info "Updating $APP to ${RELEASE}"
|
||||
systemctl stop zoraxy
|
||||
wget -q "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64"
|
||||
rm /opt/zoraxy/zoraxy
|
||||
mv zoraxy_linux_amd64 /opt/zoraxy/zoraxy
|
||||
chmod +x /opt/zoraxy/zoraxy
|
||||
systemctl start zoraxy
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP"
|
||||
fi
|
||||
systemctl start zoraxy
|
||||
exit
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_info "Setting Container to Normal Resources"
|
||||
pct set $CTID -cores 2
|
||||
msg_ok "Set Container to Normal Resources"
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${APP} should be reachable by going to the following URL.
|
||||
${BL}http://${IP}:8000${CL} \n"
|
||||
|
175
install/adventurelog-install.sh
Normal file
175
install/adventurelog-install.sh
Normal file
@ -0,0 +1,175 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: tteck
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
# Source: https://github.com/seanmorley15/AdventureLog
|
||||
|
||||
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 \
|
||||
gpg \
|
||||
curl \
|
||||
sudo \
|
||||
mc \
|
||||
gdal-bin \
|
||||
libgdal-dev \
|
||||
git \
|
||||
python3-venv \
|
||||
python3-pip
|
||||
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 "Setting up PostgreSQL Repository"
|
||||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
|
||||
echo "deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" >/etc/apt/sources.list.d/pgdg.list
|
||||
msg_ok "Set up PostgreSQL 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 "Install/Set up PostgreSQL Database"
|
||||
$STD apt-get install -y postgresql-16 postgresql-16-postgis
|
||||
DB_NAME="adventurelog_db"
|
||||
DB_USER="adventurelog_user"
|
||||
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
|
||||
SECRET_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-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 "CREATE EXTENSION IF NOT EXISTS postgis;" $DB_NAME
|
||||
$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 "AdventureLog-Credentials"
|
||||
echo "AdventureLog Database User: $DB_USER"
|
||||
echo "AdventureLog Database Password: $DB_PASS"
|
||||
echo "AdventureLog Database Name: $DB_NAME"
|
||||
echo "AdventureLog Secret: $SECRET_KEY"
|
||||
} >> ~/adventurelog.creds
|
||||
msg_ok "Set up PostgreSQL"
|
||||
|
||||
msg_info "Installing AdventureLog (Patience)"
|
||||
DJANGO_ADMIN_USER="djangoadmin"
|
||||
DJANGO_ADMIN_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
|
||||
LOCAL_IP="$(hostname -I | awk '{print $1}')"
|
||||
cd /opt
|
||||
RELEASE=$(curl -s https://api.github.com/repos/seanmorley15/AdventureLog/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
wget -q "https://github.com/seanmorley15/AdventureLog/archive/refs/tags/v${RELEASE}.zip"
|
||||
unzip -q v${RELEASE}.zip
|
||||
mv AdventureLog-${RELEASE} /opt/adventurelog
|
||||
cat <<EOF > /opt/adventurelog/backend/server/.env
|
||||
PGHOST='localhost'
|
||||
PGDATABASE='${DB_NAME}'
|
||||
PGUSER='${DB_USER}'
|
||||
PGPASSWORD='${DB_PASS}'
|
||||
SECRET_KEY='${SECRET_KEY}'
|
||||
PUBLIC_URL='http://$LOCAL_IP:8000'
|
||||
DEBUG=True
|
||||
FRONTEND_URL='http://$LOCAL_IP:3000'
|
||||
CSRF_TRUSTED_ORIGINS='http://127.0.0.1:3000,http://localhost:3000,http://$LOCAL_IP:3000'
|
||||
DJANGO_ADMIN_USERNAME='${DJANGO_ADMIN_USER}'
|
||||
DJANGO_ADMIN_PASSWORD='${DJANGO_ADMIN_PASS}'
|
||||
DISABLE_REGISTRATION=False
|
||||
# EMAIL_BACKEND='email'
|
||||
# EMAIL_HOST='smtp.gmail.com'
|
||||
# EMAIL_USE_TLS=False
|
||||
# EMAIL_PORT=587
|
||||
# EMAIL_USE_SSL=True
|
||||
# EMAIL_HOST_USER='user'
|
||||
# EMAIL_HOST_PASSWORD='password'
|
||||
# DEFAULT_FROM_EMAIL='user@example.com'
|
||||
EOF
|
||||
cd /opt/adventurelog/backend/server
|
||||
mkdir -p /opt/adventurelog/backend/server/media
|
||||
$STD pip install --upgrade pip
|
||||
$STD pip install -r requirements.txt
|
||||
$STD python3 manage.py collectstatic --noinput
|
||||
$STD python3 manage.py migrate
|
||||
$STD python3 manage.py download-countries
|
||||
cat <<EOF > /opt/adventurelog/frontend/.env
|
||||
PUBLIC_SERVER_URL=http://$LOCAL_IP:8000
|
||||
BODY_SIZE_LIMIT=Infinity
|
||||
ORIGIN='http://$LOCAL_IP:3000'
|
||||
EOF
|
||||
cd /opt/adventurelog/frontend
|
||||
$STD pnpm i
|
||||
$STD pnpm build
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Installed AdventureLog"
|
||||
|
||||
msg_info "Setting up Django Admin"
|
||||
$STD python3 /opt/adventurelog/backend/server/manage.py shell << EOF
|
||||
from django.contrib.auth import get_user_model
|
||||
UserModel = get_user_model()
|
||||
user = UserModel.objects.create_user('$DJANGO_ADMIN_USER', password='$DJANGO_ADMIN_PASS')
|
||||
user.is_superuser = True
|
||||
user.is_staff = True
|
||||
user.save()
|
||||
EOF
|
||||
{
|
||||
echo ""
|
||||
echo "Django-Credentials"
|
||||
echo "Django Admin User: $DJANGO_ADMIN_USER"
|
||||
echo "Django Admin Password: $DJANGO_ADMIN_PASS"
|
||||
} >> ~/adventurelog.creds
|
||||
msg_ok "Setup Django Admin"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/adventurelog-backend.service
|
||||
[Unit]
|
||||
Description=AdventureLog Backend Service
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/adventurelog/backend/server
|
||||
ExecStart=python3 manage.py runserver 0.0.0.0:8000
|
||||
Restart=always
|
||||
EnvironmentFile=/opt/adventurelog/backend/server/.env
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat <<EOF >/etc/systemd/system/adventurelog-frontend.service
|
||||
[Unit]
|
||||
Description=AdventureLog SvelteKit Frontend Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/adventurelog/frontend
|
||||
ExecStart=/usr/bin/node build 127.0.0.1:3000
|
||||
Restart=always
|
||||
EnvironmentFile=/opt/adventurelog/frontend/.env
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now adventurelog-backend.service
|
||||
systemctl enable -q --now adventurelog-frontend.service
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf /opt/v${RELEASE}.zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
@ -41,7 +41,6 @@ $STD apt-get install -y --no-install-recommends \
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Python3 Dependencies (Patience)"
|
||||
$STD python3 -m nltk.downloader all
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-pip \
|
||||
|
@ -17,23 +17,16 @@ msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y curl
|
||||
$STD apt-get install -y sudo
|
||||
$STD apt-get install -y mc
|
||||
$STD apt-get install -y git
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Golang"
|
||||
set +o pipefail
|
||||
RELEASE=$(curl -s https://go.dev/dl/ | grep -o "go.*\linux-amd64.tar.gz" | head -n 1)
|
||||
wget -q https://golang.org/dl/$RELEASE
|
||||
$STD tar -xzf $RELEASE -C /usr/local
|
||||
$STD ln -s /usr/local/go/bin/go /usr/local/bin/go
|
||||
set -o pipefail
|
||||
msg_ok "Installed Golang"
|
||||
|
||||
msg_info "Installing Zoraxy (Patience)"
|
||||
$STD git clone https://github.com/tobychui/zoraxy /opt/zoraxy
|
||||
cd /opt/zoraxy/src
|
||||
$STD go mod tidy
|
||||
$STD go build
|
||||
RELEASE=$(curl -s https://api.github.com/repos/tobychui/zoraxy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
wget -q "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64"
|
||||
mkdir -p /opt/zoraxy
|
||||
mv zoraxy_linux_amd64 /opt/zoraxy/zoraxy
|
||||
chmod +x /opt/zoraxy/zoraxy
|
||||
ln -s /opt/zoraxy/zoraxy /usr/local/bin/zoraxy
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Zoraxy"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@ -43,8 +36,8 @@ Description=General purpose request proxy and forwarding tool
|
||||
After=syslog.target network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/opt/zoraxy/src/./zoraxy
|
||||
WorkingDirectory=/opt/zoraxy/src/
|
||||
ExecStart=/opt/zoraxy/./zoraxy
|
||||
WorkingDirectory=/opt/zoraxy/
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
@ -57,7 +50,6 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf $RELEASE
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
Loading…
Reference in New Issue
Block a user