diff --git a/ct/gramps-web.sh b/ct/gramps-web.sh new file mode 100644 index 000000000..45846b39c --- /dev/null +++ b/ct/gramps-web.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: GitHub Copilot +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://www.grampsweb.org/ + +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}" +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 ]]; then + msg_error "No Gramps Web API Installation Found!" + exit + fi + + if [[ ! -d /opt/gramps-web/frontend ]]; then + msg_error "No Gramps Web Frontend Installation Found!" + exit + fi + + if [[ ! -f /opt/gramps-web/config/config.cfg ]]; then + msg_error "No Gramps Web Configuration Found!" + exit + fi + + PYTHON_VERSION="3.12" setup_uv + NODE_VERSION="22" setup_nodejs + + UPDATE_AVAILABLE=0 + if check_for_gh_release "gramps-web-api" "gramps-project/gramps-web-api"; then + UPDATE_AVAILABLE=1 + fi + if check_for_gh_release "gramps-web" "gramps-project/gramps-web"; then + UPDATE_AVAILABLE=1 + fi + + if [[ "$UPDATE_AVAILABLE" == "1" ]]; then + msg_info "Stopping Service" + systemctl stop gramps-web + 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" + 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 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 "Updating Gramps Web Frontend" + cd /opt/gramps-web/frontend + export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 + corepack enable + $STD npm install + $STD npm run build + msg_ok "Updated Gramps Web Frontend" + + msg_info "Applying Database Migration" + GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \ + GRAMPSHOME=/opt/gramps-web/data/gramps \ + 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" + + msg_info "Starting Service" + systemctl start gramps-web + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi + + exit +} + +start +build_container +description + +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5000${CL}" diff --git a/frontend/public/json/gramps-web.json b/frontend/public/json/gramps-web.json new file mode 100644 index 000000000..a62d420f5 --- /dev/null +++ b/frontend/public/json/gramps-web.json @@ -0,0 +1,44 @@ +{ + "name": "Gramps Web", + "slug": "gramps-web", + "categories": [ + 12 + ], + "date_created": "2026-02-16", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 5000, + "documentation": "https://www.grampsweb.org/install_setup/setup/", + "website": "https://www.grampsweb.org/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/gramps.webp", + "config_path": "/opt/gramps-web/config/config.cfg", + "description": "Gramps Web is a collaborative genealogy platform for browsing, editing and sharing family trees through a modern web interface.", + "install_methods": [ + { + "type": "default", + "script": "ct/gramps-web.sh", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 20, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "On first access, create the owner account via the built-in onboarding wizard.", + "type": "info" + }, + { + "text": "The initial deployment compiles the frontend and can take several minutes.", + "type": "warning" + } + ] +} \ No newline at end of file diff --git a/install/gramps-web-install.sh b/install/gramps-web-install.sh new file mode 100644 index 000000000..7b5983601 --- /dev/null +++ b/install/gramps-web-install.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: GitHub Copilot +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://www.grampsweb.org/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +if apt-cache show libgirepository-2.0-dev >/dev/null 2>&1; then + GI_DEV_PACKAGE="libgirepository-2.0-dev" +else + GI_DEV_PACKAGE="libgirepository1.0-dev" +fi + +msg_info "Installing Dependencies" +$STD apt install -y \ + appstream \ + build-essential \ + ffmpeg \ + gettext \ + gir1.2-gexiv2-0.10 \ + gir1.2-gtk-3.0 \ + gir1.2-osmgpsmap-1.0 \ + gir1.2-pango-1.0 \ + git \ + graphviz \ + libicu-dev \ + libopencv-dev \ + pkg-config \ + poppler-utils \ + python3-dev \ + tesseract-ocr \ + "$GI_DEV_PACKAGE" +msg_ok "Installed Dependencies" + +PYTHON_VERSION="3.12" setup_uv +NODE_VERSION="22" setup_nodejs + +fetch_and_deploy_gh_release "gramps-web-api" "gramps-project/gramps-web-api" "tarball" "latest" "/opt/gramps-web-api" +fetch_and_deploy_gh_release "gramps-web" "gramps-project/gramps-web" "tarball" "latest" "/opt/gramps-web/frontend" + +msg_info "Setting up Gramps Web" +mkdir -p \ + /opt/gramps-web/config \ + /opt/gramps-web/data/cache/export \ + /opt/gramps-web/data/cache/persistent \ + /opt/gramps-web/data/cache/report \ + /opt/gramps-web/data/cache/request \ + /opt/gramps-web/data/cache/thumbnail \ + /opt/gramps-web/data/gramps/grampsdb \ + /opt/gramps-web/data/indexdir \ + /opt/gramps-web/data/media \ + /opt/gramps-web/data/users + +SECRET_KEY="$(python3 -c "import secrets; print(secrets.token_urlsafe(32))")" + +cat </opt/gramps-web/config/config.cfg +TREE="Gramps Web" +SECRET_KEY="${SECRET_KEY}" +BASE_URL="http://${LOCAL_IP}:5000" +USER_DB_URI="sqlite:////opt/gramps-web/data/users/users.sqlite" +SEARCH_INDEX_DB_URI="sqlite:////opt/gramps-web/data/indexdir/search_index.db" +MEDIA_BASE_DIR="/opt/gramps-web/data/media" +STATIC_PATH="/opt/gramps-web/frontend/dist" +THUMBNAIL_CACHE_CONFIG={"CACHE_TYPE":"FileSystemCache","CACHE_DIR":"/opt/gramps-web/data/cache/thumbnail","CACHE_THRESHOLD":1000,"CACHE_DEFAULT_TIMEOUT":0} +REQUEST_CACHE_CONFIG={"CACHE_TYPE":"FileSystemCache","CACHE_DIR":"/opt/gramps-web/data/cache/request","CACHE_THRESHOLD":1000,"CACHE_DEFAULT_TIMEOUT":0} +PERSISTENT_CACHE_CONFIG={"CACHE_TYPE":"FileSystemCache","CACHE_DIR":"/opt/gramps-web/data/cache/persistent","CACHE_THRESHOLD":0,"CACHE_DEFAULT_TIMEOUT":0} +REPORT_DIR="/opt/gramps-web/data/cache/report" +EXPORT_DIR="/opt/gramps-web/data/cache/export" +EOF + +$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 + +cd /opt/gramps-web/frontend +export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +corepack enable +$STD npm install +$STD npm run build + +GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \ + GRAMPSHOME=/opt/gramps-web/data/gramps \ + GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \ + $STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate +msg_ok "Set up Gramps Web" + +msg_info "Creating Service" +cat </etc/systemd/system/gramps-web.service +[Unit] +Description=Gramps Web Service +After=network.target + +[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/gramps +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/gunicorn -w 2 -b 0.0.0.0:5000 gramps_webapi.wsgi:app --timeout 120 --limit-request-line 8190 +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gramps-web +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc