From 1514caac1113210f7fbb35f3beca7addb39d88cc Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 21 Aug 2025 11:53:07 +0200 Subject: [PATCH] fixes --- install/healthchecks-install.sh | 10 ++++++---- misc/tools.func | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/install/healthchecks-install.sh b/install/healthchecks-install.sh index 6496d149..ab265b5c 100644 --- a/install/healthchecks-install.sh +++ b/install/healthchecks-install.sh @@ -49,20 +49,22 @@ msg_info "Setup healthchecks" cd /opt/healthchecks mkdir -p /opt/healthchecks/static-collected/ $STD uv pip install wheel gunicorn -r requirements.txt --system + LOCAL_IP=$(hostname -I | awk '{print $1}') cat </opt/healthchecks/hc/local_settings.py DEBUG = False ALLOWED_HOSTS = ["${LOCAL_IP}", "127.0.0.1", "localhost"] -CSRF_TRUSTED_ORIGINS = ["https://${LOCAL_IP}"] +CSRF_TRUSTED_ORIGINS = ["http://${LOCAL_IP}", "https://${LOCAL_IP}"] SECRET_KEY = "${SECRET_KEY}" -SITE_ROOT = "https://${LOCAL_IP}" +SITE_ROOT = "http://${LOCAL_IP}:8000" SITE_NAME = "MyChecks" DEFAULT_FROM_EMAIL = "healthchecks@${LOCAL_IP}" STATIC_ROOT = "/opt/healthchecks/static-collected" +COMPRESS_OFFLINE = True DATABASES = { 'default': { @@ -76,9 +78,11 @@ DATABASES = { } } EOF + $STD uv run -- python manage.py makemigrations $STD uv run -- python manage.py migrate --noinput $STD uv run -- python manage.py collectstatic --noinput +$STD uv run -- python manage.py compress ADMIN_EMAIL="admin@helper-scripts.local" ADMIN_PASSWORD="$DB_PASS" @@ -98,9 +102,7 @@ After=network.target postgresql.service [Service] WorkingDirectory=/opt/healthchecks/ -EnvironmentFile=/opt/healthchecks/.env ExecStart=/usr/local/bin/uv run -- gunicorn hc.wsgi:application --bind 127.0.0.1:8000 - Restart=always [Install] diff --git a/misc/tools.func b/misc/tools.func index 697f69fc..6bb819b9 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -163,7 +163,7 @@ function setup_postgresql() { if [[ "$CURRENT_PG_VERSION" == "$PG_VERSION" ]]; then : # PostgreSQL is already at the desired version – no action needed else - msg_info "Detected PostgreSQL $CURRENT_PG_VERSION, preparing upgrade to $PG_VERSION" + $STD msg_info "Detected PostgreSQL $CURRENT_PG_VERSION, preparing upgrade to $PG_VERSION" NEED_PG_INSTALL=true fi else @@ -173,9 +173,9 @@ function setup_postgresql() { if [[ "$NEED_PG_INSTALL" == true ]]; then if [[ -n "$CURRENT_PG_VERSION" ]]; then - msg_info "Dumping PostgreSQL $CURRENT_PG_VERSION data" + $STD msg_info "Dumping PostgreSQL $CURRENT_PG_VERSION data" su - postgres -c "pg_dumpall > /var/lib/postgresql/backup_$(date +%F)_v${CURRENT_PG_VERSION}.sql" - msg_ok "Data dump completed" + $STD msg_ok "Data dump completed" systemctl stop postgresql fi