Compare commits

..

3 Commits

Author SHA1 Message Date
7bc97edce6 Update systemd service in jotty update script
- Recreate systemd service file with correct ExecStart command
- Change from 'yarn start' to '/usr/bin/node server.js'
- Ensures old installations get updated service configuration
- Run daemon-reload after service file update
2025-12-21 22:59:32 +01:00
9fe00ae3c6 Apply standalone mode optimization to Jotty update script
- Use standalone mode in update_script function
- Ensures updates maintain the optimized deployment structure
- Consistent with install script changes
2025-12-21 22:58:18 +01:00
f139c6960f Optimize Jotty installation with standalone mode
- Use Next.js standalone mode to reduce folder size from ~2.4GB to ~80MB
- Copy public, howto, and static folders to standalone output
- Remove node_modules and build artifacts after creating standalone version
- Update systemd service to use node directly instead of yarn start
- Improves build efficiency and reduces disk usage

Implements #10178
Co-authored-by: fccview <fccview@users.noreply.github.com>
2025-12-21 22:57:33 +01:00
3 changed files with 45 additions and 39 deletions

View File

@ -48,6 +48,17 @@ function update_script() {
$STD yarn --frozen-lockfile $STD yarn --frozen-lockfile
$STD yarn next telemetry disable $STD yarn next telemetry disable
$STD yarn build $STD yarn build
[ -d "public" ] && cp -r public .next/standalone/
[ -d "howto" ] && cp -r howto .next/standalone/
mkdir -p .next/standalone/.next
cp -r .next/static .next/standalone/.next/
mv .next/standalone /tmp/jotty_standalone
rm -rf * .next .git .gitignore .yarn
mv /tmp/jotty_standalone/* .
mv /tmp/jotty_standalone/.[!.]* . 2>/dev/null || true
rm -rf /tmp/jotty_standalone
msg_ok "Updated jotty" msg_ok "Updated jotty"
msg_info "Restoring configuration & data" msg_info "Restoring configuration & data"
@ -55,6 +66,24 @@ function update_script() {
$STD tar -xf /opt/data_config.tar $STD tar -xf /opt/data_config.tar
msg_ok "Restored configuration & data" msg_ok "Restored configuration & data"
msg_info "Updating Service"
cat <<EOF >/etc/systemd/system/jotty.service
[Unit]
Description=jotty server
After=network.target
[Service]
WorkingDirectory=/opt/jotty
EnvironmentFile=/opt/jotty/.env
ExecStart=/usr/bin/node server.js
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
msg_ok "Updated Service"
msg_info "Starting Service" msg_info "Starting Service"
systemctl start jotty systemctl start jotty
msg_ok "Started Service" msg_ok "Started Service"

View File

@ -21,6 +21,18 @@ cd /opt/jotty
$STD yarn --frozen-lockfile $STD yarn --frozen-lockfile
$STD yarn next telemetry disable $STD yarn next telemetry disable
$STD yarn build $STD yarn build
[ -d "public" ] && cp -r public .next/standalone/
[ -d "howto" ] && cp -r howto .next/standalone/
mkdir -p .next/standalone/.next
cp -r .next/static .next/standalone/.next/
mv .next/standalone /tmp/jotty_standalone
rm -rf * .next .git .gitignore .yarn
mv /tmp/jotty_standalone/* .
mv /tmp/jotty_standalone/.[!.]* . 2>/dev/null || true
rm -rf /tmp/jotty_standalone
mkdir -p data/{users,checklists,notes} mkdir -p data/{users,checklists,notes}
cat <<EOF >/opt/jotty/.env cat <<EOF >/opt/jotty/.env
@ -55,7 +67,7 @@ After=network.target
[Service] [Service]
WorkingDirectory=/opt/jotty WorkingDirectory=/opt/jotty
EnvironmentFile=/opt/jotty/.env EnvironmentFile=/opt/jotty/.env
ExecStart=yarn start ExecStart=/usr/bin/node server.js
Restart=on-abnormal Restart=on-abnormal
[Install] [Install]

View File

@ -2734,46 +2734,11 @@ EOF
return 1 return 1
} }
# For AMD GPUs, firmware-amd-graphics is needed but requires non-free repositories # AMD firmware for better GPU support
if [[ "$os_id" == "debian" ]]; then if [[ "$os_id" == "debian" ]]; then
# Add non-free-firmware repository if not already present $STD apt -y install firmware-amd-graphics 2>/dev/null || true
if [[ ! -f /etc/apt/sources.list.d/non-free-firmware.sources ]]; then
if [[ "$os_codename" == "bookworm" ]]; then
cat <<EOF >/etc/apt/sources.list.d/non-free-firmware.sources
Types: deb
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: non-free-firmware
Types: deb
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: non-free-firmware
EOF
elif [[ "$os_codename" == "trixie" || "$os_codename" == "sid" ]]; then
cat <<EOF >/etc/apt/sources.list.d/non-free-firmware.sources
Types: deb
URIs: http://deb.debian.org/debian
Suites: trixie trixie-updates
Components: non-free-firmware
Types: deb
URIs: http://deb.debian.org/debian-security
Suites: trixie-security
Components: non-free-firmware
EOF
fi
$STD apt update
fi
# Now install AMD firmware and libdrm
$STD apt -y install libdrm-amdgpu1 firmware-amd-graphics 2>/dev/null || {
msg_warn "Failed to install AMD firmware - may need manual installation"
}
else
# For non-Debian (Ubuntu, etc), try to install without adding repos
$STD apt -y install libdrm-amdgpu1 firmware-amd-graphics 2>/dev/null || true
fi fi
$STD apt -y install libdrm-amdgpu1 2>/dev/null || true
;; ;;
NVIDIA) NVIDIA)