2) Healthcheck improvements. Fixes: merge_recently_viewed for UserViewSet
35 lines
1,017 B
Bash
35 lines
1,017 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ ! -f .env ]]; then
|
|
echo "Warning: .env file not found. Exiting without running Docker steps."
|
|
exit 0
|
|
fi
|
|
|
|
cpuCount=$(nproc)
|
|
if (( cpuCount < 4 )); then
|
|
echo "Error: Insufficient CPU cores: $cpuCount detected. Minimum 4 required." >&2
|
|
exit 1
|
|
fi
|
|
|
|
mem_kb=$(awk '/MemTotal:/ {print $2}' /proc/meminfo)
|
|
totalMemGB=$(awk "BEGIN {printf \"%.2f\", $mem_kb/1024/1024}")
|
|
if (( mem_kb < 6*1024*1024 )); then
|
|
echo "Error: Insufficient RAM: ${totalMemGB} GB detected. Minimum 6 GB required." >&2
|
|
exit 1
|
|
fi
|
|
|
|
avail_kb=$(df --output=avail . | tail -n1)
|
|
freeGB=$(awk "BEGIN {printf \"%.2f\", $avail_kb/1024/1024}")
|
|
if (( avail_kb < 20*1024*1024 )); then
|
|
echo "Error: Insufficient free disk space: ${freeGB} GB available. Minimum 20 GB required." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "System requirements met: CPU cores=${cpuCount}, RAM=${totalMemGB}GB, FreeDisk=${freeGB}GB"
|
|
|
|
echo "Pulling related images..."
|
|
docker compose pull
|
|
|
|
echo "Building the project's images..."
|
|
docker compose build
|