refactor: update Excalidash installation and configuration paths

This commit is contained in:
MickLesk
2026-05-27 15:58:02 +02:00
parent 3c1c05178e
commit 238d375dfa
3 changed files with 32 additions and 24 deletions

View File

@@ -35,13 +35,10 @@ function update_script() {
systemctl stop excalidash systemctl stop excalidash
msg_ok "Stopped Service" msg_ok "Stopped Service"
msg_info "Backing up Data"
cp /opt/excalidash/backend/.env /opt/excalidash.env.bak
cp /opt/excalidash/backend/prisma/database.db /opt/excalidash.db.bak 2>/dev/null || true
msg_ok "Backed up Data"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "excalidash" "ZimengXiong/ExcaliDash" "tarball" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "excalidash" "ZimengXiong/ExcaliDash" "tarball"
ln -sf /opt/excalidash_data/.env /opt/excalidash/backend/.env
msg_info "Rebuilding Application" msg_info "Rebuilding Application"
cd /opt/excalidash/backend cd /opt/excalidash/backend
$STD npm ci $STD npm ci
@@ -53,15 +50,9 @@ function update_script() {
cp -r /opt/excalidash/frontend/dist/. /var/www/excalidash/ cp -r /opt/excalidash/frontend/dist/. /var/www/excalidash/
msg_ok "Rebuilt Application" msg_ok "Rebuilt Application"
msg_info "Restoring Data"
cp /opt/excalidash.env.bak /opt/excalidash/backend/.env
cp /opt/excalidash.db.bak /opt/excalidash/backend/prisma/database.db 2>/dev/null || true
rm -f /opt/excalidash.env.bak /opt/excalidash.db.bak
msg_ok "Restored Data"
msg_info "Running Migrations" msg_info "Running Migrations"
cd /opt/excalidash/backend cd /opt/excalidash/backend
set -a && source /opt/excalidash/backend/.env && set +a set -a && source /opt/excalidash_data/.env && set +a
$STD npx prisma migrate deploy $STD npx prisma migrate deploy
msg_ok "Ran Migrations" msg_ok "Ran Migrations"

View File

@@ -16,7 +16,6 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
build-essential \ build-essential \
python3 \
make \ make \
nginx nginx
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
@@ -39,21 +38,23 @@ $STD npm run build
msg_ok "Built Frontend" msg_ok "Built Frontend"
msg_info "Configuring Application" msg_info "Configuring Application"
mkdir -p /opt/excalidash/backend/prisma mkdir -p /opt/excalidash_data
mkdir -p /var/www/excalidash mkdir -p /var/www/excalidash
cp -r /opt/excalidash/frontend/dist/. /var/www/excalidash/ cp -r /opt/excalidash/frontend/dist/. /var/www/excalidash/
cat <<EOF >/opt/excalidash/backend/.env cat <<EOF >/opt/excalidash_data/.env
DATABASE_URL=file:/opt/excalidash/backend/prisma/database.db DATABASE_URL=file:/opt/excalidash_data/database.db
PORT=8000 PORT=8000
NODE_ENV=production NODE_ENV=production
FRONTEND_URL=http://${LOCAL_IP}:6767
AUTH_MODE=local AUTH_MODE=local
TRUST_PROXY=false TRUST_PROXY=false
RUN_MIGRATIONS=false RUN_MIGRATIONS=false
JWT_SECRET=$(openssl rand -hex 32) JWT_SECRET=$(openssl rand -hex 32)
CSRF_SECRET=$(openssl rand -base64 32) CSRF_SECRET=$(openssl rand -base64 32)
EOF EOF
ln -sf /opt/excalidash_data/.env /opt/excalidash/backend/.env
cd /opt/excalidash/backend cd /opt/excalidash/backend
set -a && source /opt/excalidash/backend/.env && set +a set -a && source /opt/excalidash_data/.env && set +a
$STD npx prisma migrate deploy $STD npx prisma migrate deploy
msg_ok "Configured Application" msg_ok "Configured Application"
@@ -64,13 +65,10 @@ server {
server_name _; server_name _;
root /var/www/excalidash; root /var/www/excalidash;
index index.html; index index.html;
client_max_body_size 50M;
location / { location /api/ {
try_files \$uri \$uri/ /index.html; proxy_pass http://127.0.0.1:8000/;
}
location /api {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade; proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
@@ -78,6 +76,25 @@ server {
proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme; proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
location /socket.io/ {
proxy_pass http://127.0.0.1:8000/socket.io/;
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;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
location / {
try_files \$uri \$uri/ /index.html;
} }
} }
EOF EOF

View File

@@ -18,7 +18,7 @@
{ {
"type": "default", "type": "default",
"script": "ct/excalidash.sh", "script": "ct/excalidash.sh",
"config_path": "/opt/excalidash/backend/.env", "config_path": "/opt/excalidash_data/.env",
"resources": { "resources": {
"cpu": 2, "cpu": 2,
"ram": 2048, "ram": 2048,