mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-10-18 17:15:44 +00:00
The path refactor in #16487 deleted the wrapper instead of pointing it at the new layout, while the documented way to create the first superuser is still wanderer-pb superuser upsert. Calling pocketbase directly without --dir would quietly start an empty database. Install the wrapper again, and write it on every update so containers set up since then get it too.
114 lines
3.1 KiB
Bash
114 lines
3.1 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: rrole
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://wanderer.to | Github: https://github.com/open-wanderer/wanderer
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
NODE_VERSION="22" setup_nodejs
|
|
mkdir -p /opt/{wanderer,wanderer_data/pb_data,wanderer_data/meili_data,wanderer_data/plugins}
|
|
MEILISEARCH_DB_PATH="/opt/wanderer_data/meili_data" setup_meilisearch
|
|
fetch_and_deploy_gh_release "wanderer" "open-wanderer/wanderer" "tarball" "latest"
|
|
mkdir -p /opt/wanderer/db/data
|
|
[[ -e /opt/wanderer/db/data/plugins ]] || ln -sfn /opt/wanderer_data/plugins /opt/wanderer/db/data/plugins
|
|
|
|
GO_VERSION="$(grep -m1 '^go ' /opt/wanderer/db/go.mod | awk '{print $2}')" setup_go
|
|
|
|
msg_info "Installing wanderer (patience)"
|
|
cd /opt/wanderer/db
|
|
$STD go mod tidy
|
|
$STD go build
|
|
cd /opt/wanderer/web
|
|
$STD npm ci
|
|
$STD npm run build
|
|
msg_ok "Installed wanderer"
|
|
|
|
msg_info "Installing wanderer plugins"
|
|
for plugin in hammerhead komoot strava; do
|
|
fetch_and_deploy_gh_release "wanderer-plugin-${plugin}" "open-wanderer/wanderer" "prebuild" "latest" "/opt/wanderer_data/plugins/${plugin}" "wanderer-plugin-${plugin}.tar.gz" || msg_warn "Failed to install wanderer plugin: ${plugin}"
|
|
done
|
|
msg_ok "Installed wanderer plugins"
|
|
|
|
msg_info "Creating Service"
|
|
POCKETBASE_KEY=$(openssl rand -hex 16)
|
|
|
|
cat <<EOF >/opt/wanderer/.env
|
|
ORIGIN=http://${LOCAL_IP}:3000
|
|
MEILI_HTTP_ADDR=127.0.0.1:7700
|
|
MEILI_URL=http://127.0.0.1:7700
|
|
MEILI_MASTER_KEY=${MEILISEARCH_MASTER_KEY}
|
|
PB_URL=${LOCAL_IP}:8090
|
|
PUBLIC_POCKETBASE_URL=http://${LOCAL_IP}:8090
|
|
PUBLIC_VALHALLA_URL=https://valhalla1.openstreetmap.de
|
|
POCKETBASE_ENCRYPTION_KEY=${POCKETBASE_KEY}
|
|
POCKETBASE_PROXY_SECRET=$(openssl rand -hex 32)
|
|
PB_DB_LOCATION=/opt/wanderer_data/pb_data
|
|
MEILI_DB_PATH=/opt/wanderer_data/meili_data
|
|
EOF
|
|
|
|
cat <<'EOF' >/usr/local/bin/wanderer-pb
|
|
#!/usr/bin/env bash
|
|
set -a
|
|
source /opt/wanderer/.env
|
|
set +a
|
|
cd /opt/wanderer/db
|
|
exec ./pocketbase "$@" --dir="$PB_DB_LOCATION"
|
|
EOF
|
|
chmod +x /usr/local/bin/wanderer-pb
|
|
|
|
cat <<EOF >/etc/systemd/system/wanderer-pocketbase.service
|
|
[Unit]
|
|
Description=wanderer PocketBase
|
|
Wants=network.target
|
|
After=network.target
|
|
PartOf=wanderer-web.service
|
|
StartLimitIntervalSec=10
|
|
StartLimitBurst=5
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=/opt/wanderer/db
|
|
EnvironmentFile=/opt/wanderer/.env
|
|
ExecStart=/opt/wanderer/db/pocketbase serve --http=\${PB_URL} --dir=\${PB_DB_LOCATION}
|
|
Restart=always
|
|
RestartSec=1
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
cat <<EOF >/etc/systemd/system/wanderer-web.service
|
|
[Unit]
|
|
Description=wanderer
|
|
Wants=network.target meilisearch.service wanderer-pocketbase.service
|
|
After=network.target meilisearch.service wanderer-pocketbase.service
|
|
StartLimitIntervalSec=10
|
|
StartLimitBurst=5
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=/opt/wanderer/web
|
|
EnvironmentFile=/opt/wanderer/.env
|
|
ExecStart=/usr/bin/node build
|
|
Restart=always
|
|
RestartSec=1
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
sleep 1
|
|
systemctl enable -q --now wanderer-pocketbase wanderer-web
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|