mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-10-28 02:00:14 +01:00
Gramps-Web: run the Celery task queue with Redis (#18141)
This commit is contained in:
committed by
GitHub
parent
782281728d
commit
911c84574e
+36
-2
@@ -34,9 +34,43 @@ function update_script() {
|
|||||||
PYTHON_VERSION="3.12" setup_uv
|
PYTHON_VERSION="3.12" setup_uv
|
||||||
NODE_VERSION="22" NODE_MODULE="corepack" setup_nodejs
|
NODE_VERSION="22" NODE_MODULE="corepack" setup_nodejs
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
if check_for_gh_release "gramps-web-api" "gramps-project/gramps-web-api"; then
|
if check_for_gh_release "gramps-web-api" "gramps-project/gramps-web-api"; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop gramps-web
|
systemctl stop gramps-web gramps-web-celery
|
||||||
msg_ok "Stopped Service"
|
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-api" "gramps-project/gramps-web-api" "tarball" "latest" "/opt/gramps-web-api"
|
||||||
@@ -71,7 +105,7 @@ function update_script() {
|
|||||||
msg_ok "Updated Gramps Addons"
|
msg_ok "Updated Gramps Addons"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start gramps-web
|
systemctl start gramps-web gramps-web-celery
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ $STD apt install -y \
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
poppler-utils \
|
poppler-utils \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
|
redis-server \
|
||||||
tesseract-ocr
|
tesseract-ocr
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
@@ -70,6 +71,8 @@ REQUEST_CACHE_CONFIG={"CACHE_TYPE":"FileSystemCache","CACHE_DIR":"/opt/gramps-we
|
|||||||
PERSISTENT_CACHE_CONFIG={"CACHE_TYPE":"FileSystemCache","CACHE_DIR":"/opt/gramps-web/data/cache/persistent","CACHE_THRESHOLD":0,"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"
|
REPORT_DIR="/opt/gramps-web/data/cache/report"
|
||||||
EXPORT_DIR="/opt/gramps-web/data/cache/export"
|
EXPORT_DIR="/opt/gramps-web/data/cache/export"
|
||||||
|
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
|
EOF
|
||||||
$STD uv venv -c -p python3.12 /opt/gramps-web/venv
|
$STD uv venv -c -p python3.12 /opt/gramps-web/venv
|
||||||
source /opt/gramps-web/venv/bin/activate
|
source /opt/gramps-web/venv/bin/activate
|
||||||
@@ -107,7 +110,8 @@ msg_info "Creating Service"
|
|||||||
cat <<EOF >/etc/systemd/system/gramps-web.service
|
cat <<EOF >/etc/systemd/system/gramps-web.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Gramps Web Service
|
Description=Gramps Web Service
|
||||||
After=network.target
|
After=network.target redis-server.service
|
||||||
|
Wants=redis-server.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
@@ -124,7 +128,28 @@ RestartSec=5
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now gramps-web
|
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 enable -q --now gramps-web gramps-web-celery
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
|||||||
Reference in New Issue
Block a user