Replace the old curl-based installer and interactive update menu with unified GitHub release deployment helpers. ct/surrealdb.sh now checks for a new surrealdb release via check_for_gh_release, stops the service, uses fetch_and_deploy_gh_release to deploy the prebuilt binary to /usr/local/bin, sets exec permissions, and restarts the service (also use ${APP} in an error message). The previous menu-driven update and storage-switch options (memory vs rocksdb) were removed. install/surrealdb-install.sh now skips the removed mc dependency install, uses fetch_and_deploy_gh_release instead of the install.surrealdb.com script, makes the binary executable, and no longer writes a release-version file. Overall moves to a consistent release fetch/deploy flow and simplifies update/install logic.
56 lines
1.4 KiB
Bash
56 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: PouletteMC
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
# Source: https://surrealdb.com
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
msg_info "Installing SurrealDB"
|
|
fetch_and_deploy_gh_release "surrealdb" "surrealdb/surrealdb" "prebuild" "latest" "/usr/local/bin" "surreal-v*.linux-amd64.tgz"
|
|
chmod +x /usr/local/bin/surreal
|
|
msg_ok "Installed SurrealDB"
|
|
|
|
msg_info "Configuring SurrealDB"
|
|
mkdir -p /opt/surrealdb/data
|
|
SURREALDB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
|
cat <<EOF >/opt/surrealdb/.env
|
|
SURREALDB_PASS=${SURREALDB_PASS}
|
|
EOF
|
|
{
|
|
echo "SurrealDB Credentials"
|
|
echo "Username: root"
|
|
echo "Password: ${SURREALDB_PASS}"
|
|
} >>~/surrealdb.creds
|
|
msg_ok "Configured SurrealDB"
|
|
|
|
msg_info "Creating Service"
|
|
cat <<EOF >/etc/systemd/system/surrealdb.service
|
|
[Unit]
|
|
Description=SurrealDB Server
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
EnvironmentFile=/opt/surrealdb/.env
|
|
ExecStart=/usr/local/bin/surreal start --bind 0.0.0.0:8000 --user root --pass \${SURREALDB_PASS} rocksdb:///opt/surrealdb/data/srdb.db
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable -q --now surrealdb
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|