minor fixes overall

This commit is contained in:
CanbiZ (MickLesk)
2026-04-17 07:21:03 +02:00
parent 443481f7e6
commit 1a781eded7
8 changed files with 101 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
APP="Blinko"
var_tags="${var_tags:-notes;ai;knowledge}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_ram="${var_ram:-4096}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
@@ -47,15 +47,35 @@ function update_script() {
msg_info "Updating Application"
cd /opt/blinko
$STD bun install --unsafe-perm
$STD bun install
$STD bun run build:web
$STD bun run build:seed
mkdir -p /opt/blinko/server/public
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
$STD bunx prisma migrate deploy
$STD bun /opt/blinko/dist/seed.js
$STD bun run prisma:generate
$STD bun run prisma:migrate:deploy
$STD bun run seed
msg_ok "Updated Application"
msg_info "Updating Service"
cat <<EOF >/etc/systemd/system/blinko.service
[Unit]
Description=Blinko Note-Taking App
After=network.target postgresql.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/blinko
ExecStartPre=/bin/bash -c "mkdir -p /opt/blinko/server/public && cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/"
ExecStart=/usr/local/bin/bun --env-file /opt/blinko/.env /opt/blinko/dist/index.js
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
msg_ok "Updated Service"
msg_info "Starting Service"
systemctl start blinko
msg_ok "Started Service"

View File

@@ -19,6 +19,18 @@ variables
color
catch_errors
function flatten_matomo_layout() {
if [[ -d /opt/matomo/matomo ]]; then
msg_info "Migrating Legacy Layout"
rm -rf /opt/matomo/tmp "/opt/matomo/How to install Matomo.html"
find /opt/matomo/matomo -mindepth 1 -maxdepth 1 -exec mv -t /opt/matomo {} +
rm -rf /opt/matomo/matomo
msg_ok "Migrated Legacy Layout"
fi
rm -rf /opt/matomo/node_modules /opt/matomo/tests
}
function update_script() {
header_info
check_container_storage
@@ -34,19 +46,43 @@ function update_script() {
systemctl stop caddy
msg_ok "Stopped Services"
flatten_matomo_layout
msg_info "Backing up Data"
cp /opt/matomo/config/config.ini.php /opt/matomo_config.bak
cp -r /opt/matomo/misc/user /opt/matomo_user_backup 2>/dev/null
[[ -f /opt/matomo/config/config.ini.php ]] && cp /opt/matomo/config/config.ini.php /opt/matomo_config.bak
[[ -d /opt/matomo/misc/user ]] && cp -r /opt/matomo/misc/user /opt/matomo_user_backup
if [[ -f /opt/matomo/.mariadb-creds ]]; then
cp /opt/matomo/.mariadb-creds /opt/matomo_db_creds.bak
elif [[ -f /root/matomo.creds ]]; then
cp /root/matomo.creds /opt/matomo_db_creds.bak
fi
msg_ok "Backed up Data"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "matomo" "matomo-org/matomo" "prebuild" "latest" "/opt/matomo" "matomo-*.zip"
flatten_matomo_layout
msg_info "Restoring Data"
cp /opt/matomo_config.bak /opt/matomo/config/config.ini.php
cp -r /opt/matomo_user_backup/. /opt/matomo/misc/user 2>/dev/null
if [[ -f /opt/matomo_config.bak ]]; then
mkdir -p /opt/matomo/config
cp /opt/matomo_config.bak /opt/matomo/config/config.ini.php
fi
if [[ -d /opt/matomo_user_backup ]]; then
mkdir -p /opt/matomo/misc/user
cp -r /opt/matomo_user_backup/. /opt/matomo/misc/user
fi
if [[ -f /opt/matomo_db_creds.bak ]]; then
cp /opt/matomo_db_creds.bak /opt/matomo/.mariadb-creds
fi
rm -f /opt/matomo_config.bak
rm -f /opt/matomo_db_creds.bak
rm -rf /opt/matomo_user_backup
chown -R www-data:www-data /opt/matomo
if [[ -f /opt/matomo/.mariadb-creds ]]; then
chown root:root /opt/matomo/.mariadb-creds
chmod 600 /opt/matomo/.mariadb-creds
fi
rm -f /root/matomo.creds
msg_ok "Restored Data"
msg_info "Starting Services"