2026-02-22 11:26:36 +01:00
|
|
|
#!/usr/bin/env bash
|
2026-09-02 13:14:48 +02:00
|
|
|
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
|
|
|
|
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
2026-02-22 11:26:36 +01:00
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
|
|
|
# Author: MickLesk (CanbiZ)
|
|
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
2026-02-24 15:11:53 +01:00
|
|
|
# Source: https://www.grampsweb.org/ | Github: https://github.com/gramps-project/gramps-web
|
2026-02-22 11:26:36 +01:00
|
|
|
|
|
|
|
|
APP="gramps-web"
|
|
|
|
|
var_tags="${var_tags:-genealogy;family;collaboration}"
|
|
|
|
|
var_cpu="${var_cpu:-2}"
|
|
|
|
|
var_ram="${var_ram:-4096}"
|
|
|
|
|
var_disk="${var_disk:-20}"
|
|
|
|
|
var_os="${var_os:-debian}"
|
|
|
|
|
var_version="${var_version:-13}"
|
2026-06-20 08:34:00 +10:00
|
|
|
var_arm64="${var_arm64:-yes}"
|
2026-02-22 11:26:36 +01:00
|
|
|
var_unprivileged="${var_unprivileged:-1}"
|
|
|
|
|
|
|
|
|
|
header_info "$APP"
|
|
|
|
|
variables
|
|
|
|
|
color
|
|
|
|
|
catch_errors
|
|
|
|
|
|
|
|
|
|
function update_script() {
|
|
|
|
|
header_info
|
|
|
|
|
check_container_storage
|
|
|
|
|
check_container_resources
|
|
|
|
|
|
|
|
|
|
if [[ ! -d /opt/gramps-web-api ]] || [[ ! -d /opt/gramps-web/frontend ]]; then
|
|
|
|
|
msg_error "No ${APP} Installation Found!"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
PYTHON_VERSION="3.12" setup_uv
|
2026-06-21 22:24:10 +02:00
|
|
|
NODE_VERSION="22" NODE_MODULE="corepack" setup_nodejs
|
2026-02-22 11:26:36 +01:00
|
|
|
|
2026-10-25 11:59:56 +01:00
|
|
|
if ! grep -q '^CELERY_CONFIG=' /opt/gramps-web/config/config.cfg; then
|
|
|
|
|
msg_info "Setting up Celery Task Queue"
|
|
|
|
|
ensure_dependencies redis-server
|
|
|
|
|
cat <<EOF >>/opt/gramps-web/config/config.cfg
|
|
|
|
|
CELERY_CONFIG={"broker_url":"redis://127.0.0.1:6379/0","result_backend":"redis://127.0.0.1:6379/0"}
|
|
|
|
|
RATELIMIT_STORAGE_URI="redis://127.0.0.1:6379/1"
|
|
|
|
|
EOF
|
|
|
|
|
cat <<EOF >/etc/systemd/system/gramps-web-celery.service
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Gramps Web Celery Worker
|
|
|
|
|
After=network.target redis-server.service
|
|
|
|
|
Wants=redis-server.service
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=simple
|
|
|
|
|
User=root
|
|
|
|
|
WorkingDirectory=/opt/gramps-web-api
|
|
|
|
|
Environment=GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg
|
|
|
|
|
Environment=GRAMPSHOME=/opt/gramps-web/data
|
|
|
|
|
Environment=GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb
|
|
|
|
|
Environment=PATH=/opt/gramps-web/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
|
ExecStart=/opt/gramps-web/venv/bin/celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2
|
|
|
|
|
Restart=on-failure
|
|
|
|
|
RestartSec=5
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
|
EOF
|
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
systemctl enable -q --now redis-server gramps-web-celery
|
|
|
|
|
systemctl restart gramps-web
|
|
|
|
|
msg_ok "Set up Celery Task Queue"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-02-22 11:26:36 +01:00
|
|
|
if check_for_gh_release "gramps-web-api" "gramps-project/gramps-web-api"; then
|
|
|
|
|
msg_info "Stopping Service"
|
2026-10-25 11:59:56 +01:00
|
|
|
systemctl stop gramps-web gramps-web-celery
|
2026-02-22 11:26:36 +01:00
|
|
|
msg_ok "Stopped Service"
|
|
|
|
|
|
|
|
|
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "gramps-web-api" "gramps-project/gramps-web-api" "tarball" "latest" "/opt/gramps-web-api"
|
|
|
|
|
|
|
|
|
|
msg_info "Updating Gramps Web API"
|
|
|
|
|
$STD uv venv -c -p python3.12 /opt/gramps-web/venv
|
|
|
|
|
source /opt/gramps-web/venv/bin/activate
|
|
|
|
|
$STD uv pip install --no-cache-dir --upgrade pip setuptools wheel
|
|
|
|
|
$STD uv pip install --no-cache-dir gunicorn
|
|
|
|
|
$STD uv pip install --no-cache-dir /opt/gramps-web-api
|
|
|
|
|
msg_ok "Updated Gramps Web API"
|
|
|
|
|
|
|
|
|
|
msg_info "Applying Database Migration"
|
|
|
|
|
cd /opt/gramps-web-api
|
|
|
|
|
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
|
|
|
|
|
ALEMBIC_CONFIG=/opt/gramps-web-api/alembic.ini \
|
2026-02-28 22:40:25 +01:00
|
|
|
GRAMPSHOME=/opt/gramps-web/data \
|
2026-02-22 11:26:36 +01:00
|
|
|
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
|
|
|
|
|
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
|
|
|
|
|
msg_ok "Applied Database Migration"
|
|
|
|
|
|
2026-02-28 22:40:25 +01:00
|
|
|
msg_info "Updating Gramps Addons"
|
|
|
|
|
GRAMPS_VERSION=$(/opt/gramps-web/venv/bin/python3 -c "import gramps.version; print('%s%s' % (gramps.version.VERSION_TUPLE[0], gramps.version.VERSION_TUPLE[1]))" 2>/dev/null || echo "60")
|
|
|
|
|
GRAMPS_PLUGINS_DIR="/opt/gramps-web/data/gramps/gramps${GRAMPS_VERSION}/plugins"
|
|
|
|
|
mkdir -p "$GRAMPS_PLUGINS_DIR"
|
2026-10-01 08:14:33 +02:00
|
|
|
curl -fsSL -o /tmp/gramps-addons.zip https://github.com/gramps-project/addons/archive/refs/heads/master.zip
|
2026-02-28 22:40:25 +01:00
|
|
|
for addon in FilterRules JSON; do
|
|
|
|
|
unzip -p /tmp/gramps-addons.zip "addons-master/gramps${GRAMPS_VERSION}/download/${addon}.addon.tgz" |
|
|
|
|
|
tar -xz -C "$GRAMPS_PLUGINS_DIR"
|
|
|
|
|
done
|
|
|
|
|
rm -f /tmp/gramps-addons.zip
|
|
|
|
|
msg_ok "Updated Gramps Addons"
|
|
|
|
|
|
2026-02-22 11:26:36 +01:00
|
|
|
msg_info "Starting Service"
|
2026-10-25 11:59:56 +01:00
|
|
|
systemctl start gramps-web gramps-web-celery
|
2026-02-22 11:26:36 +01:00
|
|
|
msg_ok "Started Service"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if check_for_gh_release "gramps-web" "gramps-project/gramps-web"; then
|
|
|
|
|
msg_info "Stopping Service"
|
|
|
|
|
systemctl stop gramps-web
|
|
|
|
|
msg_ok "Stopped Service"
|
|
|
|
|
|
|
|
|
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "gramps-web" "gramps-project/gramps-web" "tarball" "latest" "/opt/gramps-web/frontend"
|
|
|
|
|
|
|
|
|
|
msg_info "Updating Gramps Web Frontend"
|
|
|
|
|
cd /opt/gramps-web/frontend
|
|
|
|
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
2026-06-21 22:24:10 +02:00
|
|
|
|
2026-06-26 00:16:04 +03:00
|
|
|
create_backup /opt/gramps-web/frontend/dist/config.js
|
|
|
|
|
|
2026-02-22 11:26:36 +01:00
|
|
|
$STD npm install
|
|
|
|
|
$STD npm run build
|
2026-06-26 00:16:04 +03:00
|
|
|
|
|
|
|
|
restore_backup
|
|
|
|
|
|
2026-02-22 11:26:36 +01:00
|
|
|
msg_ok "Updated Gramps Web Frontend"
|
|
|
|
|
|
|
|
|
|
msg_info "Starting Service"
|
|
|
|
|
systemctl start gramps-web
|
|
|
|
|
msg_ok "Started Service"
|
|
|
|
|
fi
|
|
|
|
|
exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start
|
|
|
|
|
build_container
|
|
|
|
|
description
|
|
|
|
|
|
|
|
|
|
msg_ok "Completed successfully!\n"
|
|
|
|
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
2026-06-03 11:03:13 +02:00
|
|
|
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
|
|
|
|
echo -e "${GATEWAY}${BGN}http://${IP}:5000${CL}"
|