Switch development builds to production and harden install/update steps across several apps. - Akaunting: use `npm run production` instead of `npm run dev` in both install and update scripts to produce production assets. - Blinko: make bun installs run with `--unsafe-perm`, run `bun run build:web` and `bun run build:seed`, copy built public assets into `/opt/blinko/server/public`, run prisma migrations, and execute the generated seed script. Add PORT and NEXT_PUBLIC_BASE_URL to the .env. Update the systemd service to use WorkingDirectory `/opt/blinko/server` and start the app with `node /opt/blinko/dist/index.js`. - InvoiceShelf & SolidTime: stop capturing APP_KEY via `php artisan key:generate --show` + sed; instead run `php artisan key:generate` during install after composer install. SolidTime also runs `php artisan storage:link` after build. These changes simplify key generation and ensure proper storage linking. Overall these updates ensure production-ready builds, proper artifact placement, and correct runtime configuration for services.
73 lines
1.8 KiB
Bash
73 lines
1.8 KiB
Bash
#!/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://blinko.space/
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
NODE_VERSION="22" setup_nodejs
|
|
|
|
msg_info "Installing Bun"
|
|
export BUN_INSTALL="/root/.bun"
|
|
curl -fsSL https://bun.sh/install | $STD bash
|
|
ln -sf /root/.bun/bin/bun /usr/local/bin/bun
|
|
ln -sf /root/.bun/bin/bunx /usr/local/bin/bunx
|
|
msg_ok "Installed Bun"
|
|
|
|
PG_VERSION="16" setup_postgresql
|
|
PG_DB_NAME="blinko" PG_DB_USER="blinko" setup_postgresql_db
|
|
|
|
fetch_and_deploy_gh_release "blinko" "blinkospace/blinko" "tarball"
|
|
|
|
msg_info "Setting up Blinko"
|
|
cd /opt/blinko
|
|
cat <<EOF >/opt/blinko/.env
|
|
NODE_ENV=production
|
|
PORT=1111
|
|
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
|
NEXTAUTH_URL=http://${LOCAL_IP}:1111
|
|
NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
|
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:1111
|
|
EOF
|
|
$STD bun install --unsafe-perm
|
|
$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 node /opt/blinko/dist/seed.js
|
|
msg_ok "Set up Blinko"
|
|
|
|
msg_info "Creating 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/server
|
|
EnvironmentFile=/opt/blinko/.env
|
|
ExecStart=/usr/bin/node /opt/blinko/dist/index.js
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable -q --now blinko
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|