This commit is contained in:
2026-05-13 22:28:56 +03:30
parent 46fe62fa04
commit 45fee1dfd3
26 changed files with 2329 additions and 878 deletions
+44 -9
View File
@@ -2,6 +2,33 @@
set -e
PROXYCHAINS_CONFIG_FILE="${PROXYCHAINS_CONFIG_FILE:-/etc/proxychains.conf}"
OPENEO_VERIFY_ON_STARTUP="${OPENEO_VERIFY_ON_STARTUP:-1}"
disable_proxy_mode() {
reason="$1"
echo "Proxy support disabled: ${reason}" >&2
ENABLE_PROXYCHAINS=0
export ENABLE_PROXYCHAINS
export OPENEO_PROXY_URL=""
export OPENEO_VERIFY_ON_STARTUP=0
}
proxy_endpoint_reachable() {
proxy_host="$1"
proxy_port="$2"
python - "$proxy_host" "$proxy_port" <<'PY'
import socket
import sys
host = sys.argv[1]
port = int(sys.argv[2])
try:
with socket.create_connection((host, port), timeout=2):
sys.exit(0)
except OSError:
sys.exit(1)
PY
}
setup_proxychains() {
if [ "${ENABLE_PROXYCHAINS}" != "1" ]; then
@@ -10,8 +37,8 @@ setup_proxychains() {
fi
if ! command -v proxychains4 >/dev/null 2>&1; then
echo "proxychains4 is not installed but ENABLE_PROXYCHAINS=1 was set." >&2
exit 1
disable_proxy_mode "proxychains4 is not installed but ENABLE_PROXYCHAINS=1 was set."
return 0
fi
proxy_type="${PROXYCHAINS_PROXY_TYPE:-socks4}"
@@ -21,8 +48,13 @@ setup_proxychains() {
proxy_ip="$(getent hosts "${proxy_host}" | awk 'NR==1 {print $1}')"
if [ -z "${proxy_ip}" ]; then
echo "Could not resolve proxy host: ${proxy_host}" >&2
exit 1
disable_proxy_mode "could not resolve proxy host ${proxy_host}"
return 0
fi
if ! proxy_endpoint_reachable "${proxy_host}" "${proxy_port}"; then
disable_proxy_mode "proxy ${proxy_host}:${proxy_port} is unreachable"
return 0
fi
cat > "${PROXYCHAINS_CONFIG_FILE}" <<EOF
@@ -88,17 +120,20 @@ if [ "${SKIP_MIGRATE}" != "1" ]; then
fi
if [ -n "${DEVELOP}" ] && [ "${SKIP_MIGRATE}" != "1" ]; then
echo "DEVELOP is set. Seeding demo location_data, plant, weather_data, and farm_data..."
echo "DEVELOP is set. Seeding demo location_data, weather_data, and farm_data..."
run_cmd python manage.py seed_location_data
run_cmd python manage.py seed_plants
run_cmd python manage.py seed_weather_data
run_cmd python manage.py seed_farm_data
echo "Demo seeders done."
fi
echo "Checking openEO authentication..."
if ! run_cmd python manage.py verify_openeo_auth --skip-if-unconfigured; then
echo "openEO authentication failed; continuing startup with degraded openEO-dependent features." >&2
if [ "${OPENEO_VERIFY_ON_STARTUP}" = "1" ]; then
echo "Checking openEO authentication..."
if ! run_cmd python manage.py verify_openeo_auth --skip-if-unconfigured; then
echo "openEO authentication failed; continuing startup with degraded openEO-dependent features." >&2
fi
else
echo "Skipping openEO authentication during startup."
fi
echo "Collecting static files..."