Put Pit Log under version control so the app and sync server can live on git.
This commit is contained in:
commit
1030bac79e
79 files changed
+8463
No files matched your search
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Pit Log sync. Runs inside the container the helper script just created.
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
PITLOG_BASE="https://git.ny.daprogs.com/RallyBlock/Pit-Log-App-Server-Installer-Proxmox/raw/branch/main"
|
||||
|
||||
msg_info "Installing Pit Log sync"
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y python3 openssl ca-certificates
|
||||
install -d -o root -g root -m 755 /opt/pitlog
|
||||
if ! id pitlog >/dev/null 2>&1; then
|
||||
useradd --system --home-dir /var/lib/pitlog --shell /usr/sbin/nologin pitlog
|
||||
fi
|
||||
install -d -o pitlog -g pitlog -m 750 /var/lib/pitlog /etc/pitlog
|
||||
curl -fsSL "${PITLOG_BASE}/pitlog_sync.py" -o /opt/pitlog/pitlog_sync.py
|
||||
chown root:pitlog /opt/pitlog/pitlog_sync.py
|
||||
chmod 640 /opt/pitlog/pitlog_sync.py
|
||||
if [[ ! -s /etc/pitlog/token ]]; then
|
||||
openssl rand -hex 32 >/etc/pitlog/token
|
||||
fi
|
||||
chown root:pitlog /etc/pitlog/token
|
||||
chmod 640 /etc/pitlog/token
|
||||
cat >/etc/systemd/system/pitlog-sync.service <<'EOF'
|
||||
[Unit]
|
||||
Description=Pit Log sync
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=pitlog
|
||||
Group=pitlog
|
||||
Environment=PITLOG_TOKEN_FILE=/etc/pitlog/token
|
||||
Environment=PITLOG_DB=/var/lib/pitlog/sync.db
|
||||
Environment=PITLOG_PORT=8787
|
||||
ExecStart=/usr/bin/python3 /opt/pitlog/pitlog_sync.py
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q --now pitlog-sync.service
|
||||
msg_ok "Installed Pit Log sync"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in new issue
Block a user