Update healthchecks-install.sh

This commit is contained in:
CanbiZ 2025-07-10 11:42:41 +02:00
parent f9d60db88e
commit 802cc6cc57

View File

@ -15,15 +15,15 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
gcc \ gcc \
libpq-dev \ libpq-dev \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libssl-dev libssl-dev
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setup Python3" msg_info "Setup Python3"
$STD apt-get install -y \ $STD apt-get install -y \
python3 python3-dev python3-pip python3 python3-dev python3-pip
$STD pip install --upgrade pip $STD pip install --upgrade pip
msg_ok "Setup Python3" msg_ok "Setup Python3"
@ -42,23 +42,25 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8'
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
{ {
echo "healthchecks-Credentials" echo "healthchecks-Credentials"
echo "healthchecks Database User: $DB_USER" echo "healthchecks Database User: $DB_USER"
echo "healthchecks Database Password: $DB_PASS" echo "healthchecks Database Password: $DB_PASS"
echo "healthchecks Database Name: $DB_NAME" echo "healthchecks Database Name: $DB_NAME"
} >>~/healthchecks.creds } >>~/healthchecks.creds
msg_ok "Set up Database" msg_ok "Set up Database"
msg_info "Setup healthchecks" msg_info "Setup healthchecks"
fetch_and_deploy_gh_release "healthchecks" "healthchecks/healthchecks" "source" fetch_and_deploy_gh_release "healthchecks" "healthchecks/healthchecks" "source"
cd /opt/healthchecks cd /opt/healthchecks
mkdir -p /opt/healthchecks/static-collected/
$STD uv venv .venv $STD uv venv .venv
$STD source .venv/bin/activate $STD source .venv/bin/activate
$STD uv pip install wheel $STD uv pip install wheel
$STD uv pip install gunicorn $STD uv pip install gunicorn
$STD uv pip install -r requirements.txt $STD uv pip install -r requirements.txt
LOCAL_IP=$(hostname -I | awk '{print $1}')
cat <<EOF >/opt/healthchecks/.env cat <<EOF >/opt/healthchecks/.env
ALLOWED_HOSTS=0.0.0.0 ALLOWED_HOSTS=${LOCAL_IP},localhost,127.0.0.1
DB=postgres DB=postgres
DB_HOST=localhost DB_HOST=localhost
DB_PORT=5432 DB_PORT=5432
@ -87,7 +89,8 @@ SITE_ROOT=http://0.0.0.0:8000
EOF EOF
$STD .venv/bin/python3 manage.py makemigrations $STD .venv/bin/python3 manage.py makemigrations
$STD .venv/bin/python3 manage.py migrate $STD .venv/bin/python3 manage.py migrate --noinput
$STD .venv/bin/python3 manage.py collectstatic --noinput
ADMIN_EMAIL="admin@helper-scripts.local" ADMIN_EMAIL="admin@helper-scripts.local"
ADMIN_PASSWORD="$DB_PASS" ADMIN_PASSWORD="$DB_PASS"