Add installers and CT templates for four apps
Add container templates (ct/) and install scripts (install/) plus metadata JSON entries for BunkerM, Colanode, Edit-Mind, and ExcaliDash. Each app includes an LXC template script with update routines, a corresponding installer that provisions dependencies, builds the app, configures services (systemd/nginx/supervisor), and example default environment/config. JSON metadata files register interface ports, recommended resources, documentation/website links, and notes for each app.
This commit is contained in:
177
install/bunkerm-install.sh
Normal file
177
install/bunkerm-install.sh
Normal file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://bunkerai.dev/
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
mosquitto \
|
||||
mosquitto-clients \
|
||||
libmosquitto-dev \
|
||||
nginx \
|
||||
supervisor \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-venv \
|
||||
python3-pip \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
gcc \
|
||||
openssl
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="20" setup_nodejs
|
||||
|
||||
fetch_and_deploy_gh_release "bunkerm" "bunkeriot/BunkerM" "tarball"
|
||||
|
||||
msg_info "Setting up Python Environment"
|
||||
python3 -m venv /opt/venv
|
||||
/opt/venv/bin/pip install --upgrade pip >/dev/null 2>&1
|
||||
$STD /opt/venv/bin/pip install --no-cache-dir \
|
||||
psutil \
|
||||
paho-mqtt \
|
||||
fastapi \
|
||||
python-dotenv \
|
||||
pydantic \
|
||||
pydantic-settings \
|
||||
"uvicorn[standard]" \
|
||||
flask \
|
||||
flask-cors \
|
||||
pytz \
|
||||
statistics \
|
||||
python-multipart \
|
||||
"passlib[bcrypt]" \
|
||||
python-jwt \
|
||||
PyJWT \
|
||||
slowapi \
|
||||
secure \
|
||||
python-decouple \
|
||||
starlette-context \
|
||||
structlog \
|
||||
python-json-logger \
|
||||
aiofiles \
|
||||
types-aiofiles \
|
||||
typing-extensions \
|
||||
"sqlalchemy[asyncio]>=2.0.30" \
|
||||
"aiosqlite>=0.20.0" \
|
||||
"alembic>=1.13.0" \
|
||||
"httpx>=0.27.0" \
|
||||
"numpy>=1.26.0" \
|
||||
"websockets>=12.0" \
|
||||
"apscheduler>=3.10.0" \
|
||||
cryptography \
|
||||
pyOpenSSL \
|
||||
"python-jose[cryptography]" \
|
||||
fastapi-jwt-auth \
|
||||
fastapi-limiter
|
||||
msg_ok "Set up Python Environment"
|
||||
|
||||
msg_info "Building Frontend"
|
||||
cd /opt/bunkerm/frontend
|
||||
AUTH_SECRET="build-time-placeholder" NEXT_TELEMETRY_DISABLED=1 $STD npm ci
|
||||
AUTH_SECRET="build-time-placeholder" NEXT_TELEMETRY_DISABLED=1 $STD npm run build
|
||||
mkdir -p /nextjs
|
||||
cp -r /opt/bunkerm/frontend/.next/standalone/. /nextjs/
|
||||
cp -r /opt/bunkerm/frontend/.next/static /nextjs/.next/static
|
||||
cp -r /opt/bunkerm/frontend/public /nextjs/public
|
||||
msg_ok "Built Frontend"
|
||||
|
||||
msg_info "Setting up Application"
|
||||
mkdir -p /app
|
||||
cp -r /opt/bunkerm/backend/app/. /app/
|
||||
touch /app/monitor/__init__.py
|
||||
msg_ok "Set up Application"
|
||||
|
||||
msg_info "Configuring Mosquitto"
|
||||
mkdir -p /etc/mosquitto/conf.d /var/lib/mosquitto/db /var/log/mosquitto /tmp/mosquitto_backups /tmp/dynsec_backups
|
||||
cp /opt/bunkerm/backend/mosquitto/config/mosquitto.conf /etc/mosquitto/mosquitto.conf
|
||||
cp -r /opt/bunkerm/backend/etc/mosquitto/conf.d/. /etc/mosquitto/conf.d/
|
||||
cp /opt/bunkerm/backend/mosquitto/dynsec/dynamic-security.json /var/lib/mosquitto/dynamic-security.json
|
||||
touch /etc/mosquitto/mosquitto_passwd
|
||||
id -u mosquitto &>/dev/null || useradd -r -s /usr/sbin/nologin mosquitto
|
||||
chown -R mosquitto:mosquitto /var/lib/mosquitto /var/log/mosquitto /etc/mosquitto
|
||||
chmod 664 /etc/mosquitto/mosquitto_passwd
|
||||
msg_ok "Configured Mosquitto"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
mkdir -p /run/nginx /etc/nginx/conf.d /var/log/nginx /var/lib/history
|
||||
cp /opt/bunkerm/nginx.conf /etc/nginx/nginx.conf
|
||||
cp /opt/bunkerm/default-next.conf /etc/nginx/conf.d/default.conf
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
msg_info "Configuring Supervisor"
|
||||
mkdir -p /var/log/supervisor /var/log/api /etc/bunkerm /nextjs/data
|
||||
cp /opt/bunkerm/supervisord-next.conf /etc/supervisor/conf.d/bunkerm.conf
|
||||
msg_ok "Configured Supervisor"
|
||||
|
||||
msg_info "Creating Environment"
|
||||
MQTT_USERNAME="bunker"
|
||||
MQTT_PASSWORD="bunker"
|
||||
JWT_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-48)
|
||||
API_KEY=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-48)
|
||||
AUTH_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-48)
|
||||
cat <<EOF >/etc/bunkerm/bunkerm.env
|
||||
MQTT_BROKER=localhost
|
||||
MQTT_PORT=1900
|
||||
MQTT_USERNAME=${MQTT_USERNAME}
|
||||
MQTT_PASSWORD=${MQTT_PASSWORD}
|
||||
JWT_SECRET=${JWT_SECRET}
|
||||
API_KEY=${API_KEY}
|
||||
AUTH_SECRET=${AUTH_SECRET}
|
||||
HOST_ADDRESS=${LOCAL_IP}
|
||||
FRONTEND_URL=http://${LOCAL_IP}:2000
|
||||
ALLOWED_ORIGINS=*
|
||||
ALLOWED_HOSTS=*
|
||||
RATE_LIMIT_PER_MINUTE=100
|
||||
LOG_LEVEL=INFO
|
||||
API_LOG_FILE=/var/log/api/api_activity.log
|
||||
BROKER_LOG_PATH=/var/log/mosquitto/mosquitto.log
|
||||
CLIENT_LOG_PATH=/var/log/api/api_activity.log
|
||||
MOSQUITTO_PASSWD_PATH=/etc/mosquitto/mosquitto_passwd
|
||||
MOSQUITTO_CONF_PATH=/etc/mosquitto/mosquitto.conf
|
||||
MOSQUITTO_BACKUP_DIR=/tmp/mosquitto_backups
|
||||
CONFIG_API_PORT=1005
|
||||
DYNSEC_PATH=/var/lib/mosquitto/dynamic-security.json
|
||||
DYNSEC_BACKUP_DIR=/tmp/dynsec_backups
|
||||
MAX_UPLOAD_SIZE=10485760
|
||||
PYTHONPATH=/app/monitor
|
||||
NODE_ENV=production
|
||||
BUNKERAI_API_KEY=
|
||||
BUNKERAI_WS_URL=wss://api.bunkerai.dev/connect
|
||||
EOF
|
||||
msg_ok "Created Environment"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/bunkerm.service
|
||||
[Unit]
|
||||
Description=BunkerM MQTT Management Platform
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
EnvironmentFile=/etc/bunkerm/bunkerm.env
|
||||
ExecStart=/usr/bin/supervisord -c /etc/supervisor/conf.d/bunkerm.conf -n
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now bunkerm
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
93
install/colanode-install.sh
Normal file
93
install/colanode-install.sh
Normal file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://colanode.com/
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
redis-server \
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PG_VERSION="17" PG_MODULES="pgvector" setup_postgresql
|
||||
PG_DB_NAME="colanode_db" PG_DB_USER="colanode" setup_postgresql_db
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
fetch_and_deploy_gh_release "colanode" "colanode/colanode" "tarball"
|
||||
|
||||
msg_info "Building Application"
|
||||
cd /opt/colanode
|
||||
$STD npm ci
|
||||
$STD npm run build -w @colanode/core
|
||||
$STD npm run build -w @colanode/crdt
|
||||
$STD npm run build -w @colanode/server
|
||||
$STD npm run build -w @colanode/client
|
||||
$STD npm run build -w @colanode/ui
|
||||
$STD npm run build -w @colanode/web
|
||||
$STD npm prune --production
|
||||
msg_ok "Built Application"
|
||||
|
||||
msg_info "Configuring Application"
|
||||
mkdir -p /var/lib/colanode/storage /var/www/colanode
|
||||
cp -r /opt/colanode/apps/web/dist/. /var/www/colanode/
|
||||
cat <<EOF >/opt/colanode/.env
|
||||
POSTGRES_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
||||
REDIS_URL=redis://127.0.0.1:6379
|
||||
NODE_ENV=production
|
||||
EOF
|
||||
msg_ok "Configured Application"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
cat <<EOF >/etc/nginx/sites-available/colanode
|
||||
server {
|
||||
listen 4000;
|
||||
server_name _;
|
||||
root /var/www/colanode;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.html;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
ln -sf /etc/nginx/sites-available/colanode /etc/nginx/sites-enabled/colanode
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
systemctl reload nginx
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/colanode-server.service
|
||||
[Unit]
|
||||
Description=Colanode Server
|
||||
After=network.target postgresql.service redis-server.service
|
||||
Requires=postgresql.service redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/colanode
|
||||
EnvironmentFile=/opt/colanode/.env
|
||||
ExecStart=/usr/bin/node apps/server/dist/index.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now colanode-server
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
202
install/edit-mind-install.sh
Normal file
202
install/edit-mind-install.sh
Normal file
@@ -0,0 +1,202 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://github.com/IliasHad/edit-mind
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
redis-server \
|
||||
nginx \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-venv \
|
||||
python3-pip \
|
||||
libgomp1 \
|
||||
libglib2.0-0 \
|
||||
libgl1 \
|
||||
libsm6 \
|
||||
libxext6 \
|
||||
libxrender1 \
|
||||
openssl
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_ffmpeg
|
||||
PG_VERSION="16" PG_MODULES="pgvector" setup_postgresql
|
||||
PG_DB_NAME="editmind" PG_DB_USER="editmind" setup_postgresql_db
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
msg_info "Installing pnpm"
|
||||
$STD npm install -g pnpm@10
|
||||
msg_ok "Installed pnpm"
|
||||
|
||||
fetch_and_deploy_gh_release "edit-mind" "IliasHad/edit-mind" "tarball"
|
||||
|
||||
msg_info "Installing Application Dependencies"
|
||||
cd /opt/edit-mind
|
||||
$STD pnpm install --prefer-frozen-lockfile
|
||||
$STD pnpm --filter prisma generate
|
||||
msg_ok "Installed Application Dependencies"
|
||||
|
||||
msg_info "Building Application"
|
||||
$STD pnpm run build:web
|
||||
$STD pnpm rebuild @tailwindcss/oxide rollup onnxruntime-node
|
||||
$STD pnpm run build:background-jobs
|
||||
msg_ok "Built Application"
|
||||
|
||||
msg_info "Setting up Python ML Environment"
|
||||
python3 -m venv /opt/edit-mind/.venv
|
||||
$STD /opt/edit-mind/.venv/bin/pip install --upgrade pip
|
||||
$STD /opt/edit-mind/.venv/bin/pip install --no-cache-dir -r /opt/edit-mind/python/requirements.txt
|
||||
msg_ok "Set up Python ML Environment"
|
||||
|
||||
msg_info "Setting up ChromaDB"
|
||||
$STD /opt/edit-mind/.venv/bin/pip install --no-cache-dir chromadb
|
||||
msg_ok "Set up ChromaDB"
|
||||
|
||||
msg_info "Configuring Application"
|
||||
SESSION_SECRET=$(openssl rand -base64 32)
|
||||
ENCRYPTION_KEY=$(openssl rand -base64 32)
|
||||
mkdir -p /opt/edit-mind/.data /opt/edit-mind/ml-models
|
||||
cat <<EOF >/opt/edit-mind/.env
|
||||
SESSION_SECRET=${SESSION_SECRET}
|
||||
ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||
HOST_MEDIA_PATH=/opt/edit-mind/media
|
||||
OLLAMA_MODEL=qwen2.5:7b-instruct
|
||||
USE_OLLAMA_MODEL=false
|
||||
OLLAMA_HOST=
|
||||
OLLAMA_PORT=
|
||||
GEMINI_API_KEY=
|
||||
USE_GEMINI=false
|
||||
PORT=3745
|
||||
BACKGROUND_JOBS_PORT=4000
|
||||
ML_PORT=8765
|
||||
REDIS_PORT=6379
|
||||
POSTGRES_PORT=5432
|
||||
CHROMA_PORT=8000
|
||||
EOF
|
||||
cat <<EOF >/opt/edit-mind/.env.system
|
||||
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
||||
REDIS_URL=redis://127.0.0.1:6379
|
||||
REDIS_HOST=127.0.0.1
|
||||
CHROMA_HOST=127.0.0.1
|
||||
IS_PERSISTENT=TRUE
|
||||
ML_HOST=127.0.0.1
|
||||
PROCESSED_VIDEOS_DIR=/opt/edit-mind/.data
|
||||
THUMBNAILS_PATH=/opt/edit-mind/.data/.thumbnails
|
||||
STITCHED_VIDEOS_DIR=/opt/edit-mind/.data/.stitched-videos
|
||||
FACES_DIR=/opt/edit-mind/.data/.faces
|
||||
UNKNOWN_FACES_DIR=/opt/edit-mind/.data/.unknown_faces
|
||||
KNOWN_FACES_FILE=/opt/edit-mind/.data/.faces.json
|
||||
KNOWN_FACES_FILE_LOADED=/opt/edit-mind/.data/.known_faces.json
|
||||
BACKGROUND_JOBS_URL=http://127.0.0.1:4000
|
||||
NODE_ENV=production
|
||||
ANONYMIZED_TELEMETRY=FALSE
|
||||
WEB_APP_URL=http://127.0.0.1:3745
|
||||
EOF
|
||||
mkdir -p /opt/edit-mind/media
|
||||
set -a && source /opt/edit-mind/.env && source /opt/edit-mind/.env.system && set +a
|
||||
$STD pnpm --filter prisma migrate:deploy
|
||||
$STD pnpm --filter db seed
|
||||
msg_ok "Configured Application"
|
||||
|
||||
msg_info "Creating Services"
|
||||
cat <<EOF >/etc/systemd/system/edit-mind-chroma.service
|
||||
[Unit]
|
||||
Description=Edit-Mind ChromaDB
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/edit-mind
|
||||
Environment=IS_PERSISTENT=TRUE
|
||||
ExecStart=/opt/edit-mind/.venv/bin/chroma run --host 127.0.0.1 --port 8000 --path /opt/edit-mind/.data/chroma
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/edit-mind-ml.service
|
||||
[Unit]
|
||||
Description=Edit-Mind ML Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/edit-mind
|
||||
EnvironmentFile=/opt/edit-mind/.env
|
||||
EnvironmentFile=/opt/edit-mind/.env.system
|
||||
Environment=YOLO_CONFIG_DIR=/opt/edit-mind/ml-models/ultralytics
|
||||
Environment=DEEPFACE_HOME=/opt/edit-mind/ml-models/deepface
|
||||
Environment=TRANSCRIPTION_MODEL_CACHE=/opt/edit-mind/ml-models/whisper
|
||||
Environment=TORCH_HOME=/opt/edit-mind/ml-models/torch
|
||||
Environment=HF_HOME=/opt/edit-mind/ml-models/huggingface
|
||||
ExecStart=/opt/edit-mind/.venv/bin/python /opt/edit-mind/python/main.py --host 0.0.0.0 --port 8765
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/edit-mind-jobs.service
|
||||
[Unit]
|
||||
Description=Edit-Mind Background Jobs
|
||||
After=network.target postgresql.service redis-server.service edit-mind-chroma.service edit-mind-ml.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/edit-mind
|
||||
EnvironmentFile=/opt/edit-mind/.env
|
||||
EnvironmentFile=/opt/edit-mind/.env.system
|
||||
ExecStart=/usr/bin/pnpm --filter background-jobs start
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/edit-mind-web.service
|
||||
[Unit]
|
||||
Description=Edit-Mind Web Application
|
||||
After=network.target postgresql.service redis-server.service edit-mind-chroma.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/edit-mind
|
||||
EnvironmentFile=/opt/edit-mind/.env
|
||||
EnvironmentFile=/opt/edit-mind/.env.system
|
||||
ExecStart=/usr/bin/pnpm --filter web start --host 0.0.0.0 --port 3745
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now edit-mind-chroma
|
||||
systemctl enable -q --now edit-mind-ml
|
||||
systemctl enable -q --now edit-mind-jobs
|
||||
systemctl enable -q --now edit-mind-web
|
||||
msg_ok "Created Services"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
112
install/excalidash-install.sh
Normal file
112
install/excalidash-install.sh
Normal file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://github.com/ZimengXiong/ExcaliDash
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
python3 \
|
||||
make \
|
||||
nginx
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="20" setup_nodejs
|
||||
|
||||
fetch_and_deploy_gh_release "excalidash" "ZimengXiong/ExcaliDash" "tarball"
|
||||
|
||||
msg_info "Building Backend"
|
||||
cd /opt/excalidash/backend
|
||||
$STD npm ci
|
||||
$STD npx prisma generate
|
||||
$STD npx tsc
|
||||
msg_ok "Built Backend"
|
||||
|
||||
msg_info "Building Frontend"
|
||||
cd /opt/excalidash/frontend
|
||||
$STD npm ci
|
||||
$STD npm run build
|
||||
msg_ok "Built Frontend"
|
||||
|
||||
msg_info "Configuring Application"
|
||||
mkdir -p /opt/excalidash/backend/prisma
|
||||
mkdir -p /var/www/excalidash
|
||||
cp -r /opt/excalidash/frontend/dist/. /var/www/excalidash/
|
||||
cat <<EOF >/opt/excalidash/backend/.env
|
||||
DATABASE_URL=file:/opt/excalidash/backend/prisma/database.db
|
||||
PORT=8000
|
||||
NODE_ENV=production
|
||||
AUTH_MODE=local
|
||||
TRUST_PROXY=false
|
||||
RUN_MIGRATIONS=false
|
||||
JWT_SECRET=$(openssl rand -hex 32)
|
||||
CSRF_SECRET=$(openssl rand -base64 32)
|
||||
EOF
|
||||
cd /opt/excalidash/backend
|
||||
set -a && source /opt/excalidash/backend/.env && set +a
|
||||
$STD npx prisma migrate deploy
|
||||
msg_ok "Configured Application"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
cat <<EOF >/etc/nginx/sites-available/excalidash
|
||||
server {
|
||||
listen 6767;
|
||||
server_name _;
|
||||
root /var/www/excalidash;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
ln -sf /etc/nginx/sites-available/excalidash /etc/nginx/sites-enabled/excalidash
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
systemctl reload nginx
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/excalidash.service
|
||||
[Unit]
|
||||
Description=ExcaliDash Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/excalidash/backend
|
||||
EnvironmentFile=/opt/excalidash/backend/.env
|
||||
ExecStart=/usr/bin/node dist/index.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now excalidash
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in New Issue
Block a user