ProxmoxVED/install/flatnotes-install.sh
Luís Oliveira c7e8652d67 Apply suggestions from code review
Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
2026-01-15 14:22:58 +01:00

64 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: luismco
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/dullage/flatnotes
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
fetch_and_deploy_gh_release "flatnotes" "dullage/flatnotes"
USE_UVX=YES setup_uv
setup_nodejs
msg_info "Installing Backend"
cd /opt/flatnotes
$STD /usr/local/bin/uvx migrate-to-uv
$STD /usr/local/bin/uv sync
mkdir /opt/flatnotes/data
msg_ok "Installed Backend"
msg_info "Installing Frontend"
cd /opt/flatnotes/client
$STD npm install
$STD npm run build
msg_ok "Installed Frontend"
msg_info "Creating Service"
cat <<EOF >/opt/flatnotes/.env
FLATNOTES_AUTH_TYPE='none'
FLATNOTES_PATH='/opt/flatnotes/data/'
#FLATNOTES_USERNAME='username'
#FLATNOTES_PASSWORD='password'
#FLATNOTES_SECRET_KEY='secret-key'
EOF
cat <<EOF >/etc/systemd/system/flatnotes.service
[Unit]
Description=Flatnotes
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/flatnotes
EnvironmentFile=/opt/flatnotes/.env
ExecStart=/opt/flatnotes/.venv/bin/python -m uvicorn main:app --app-dir server --host 0.0.0.0 --port 8080 --proxy-headers
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now flatnotes
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc