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
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"
ln -sf /opt/excalidash_data/.env /opt/excalidash/backend/.env
msg_info "Rebuilding Application"
cd /opt/excalidash/backend
$STD npm ci
@@ -53,15 +50,9 @@ function update_script() {
cp -r /opt/excalidash/frontend/dist/. /var/www/excalidash/
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"
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
msg_ok "Ran Migrations"

View File

@@ -16,7 +16,6 @@ update_os
msg_info "Installing Dependencies"
$STD apt install -y \
build-essential \
python3 \
make \
nginx
msg_ok "Installed Dependencies"
@@ -39,21 +38,23 @@ $STD npm run build
msg_ok "Built Frontend"
msg_info "Configuring Application"
mkdir -p /opt/excalidash/backend/prisma
mkdir -p /opt/excalidash_data
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
cat <<EOF >/opt/excalidash_data/.env
DATABASE_URL=file:/opt/excalidash_data/database.db
PORT=8000
NODE_ENV=production
FRONTEND_URL=http://${LOCAL_IP}:6767
AUTH_MODE=local
TRUST_PROXY=false
RUN_MIGRATIONS=false
JWT_SECRET=$(openssl rand -hex 32)
CSRF_SECRET=$(openssl rand -base64 32)
EOF
ln -sf /opt/excalidash_data/.env /opt/excalidash/backend/.env
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
msg_ok "Configured Application"
@@ -64,13 +65,10 @@ server {
server_name _;
root /var/www/excalidash;
index index.html;
client_max_body_size 50M;
location / {
try_files \$uri \$uri/ /index.html;
}
location /api {
proxy_pass http://127.0.0.1:8000;
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";
@@ -78,6 +76,25 @@ server {
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 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

View File

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