Spaces:
Sleeping
Sleeping
Upload 7 files
Browse files- config.sh +6 -0
- entrypoint.sh +4 -1
- supervisord.conf +16 -8
config.sh
CHANGED
|
@@ -13,6 +13,11 @@ export LOGS_DIR="${AIRFLOW_HOME}/logs"
|
|
| 13 |
# ---- Database Connection (Set via HF Secret for production) ----
|
| 14 |
export AIRFLOW__DATABASE__SQL_ALCHEMY_CONN="${AIRFLOW__DATABASE__SQL_ALCHEMY_CONN:-postgresql://postgres.ffetkispaxytayrnmxvj:uKInpRkBXsCUfVg1@aws-1-ap-south-1.pooler.supabase.com:5432/postgres}"
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# ---- DAG Repository ----
|
| 17 |
export DAG_REPO_URL="${DAG_REPO_URL:-https://github.com/subhamgiri460/myworkflows.git}"
|
| 18 |
export DAG_REPO_BRANCH="${DAG_REPO_BRANCH:-main}"
|
|
@@ -34,6 +39,7 @@ export AIRFLOW__CORE__EXECUTOR="${AIRFLOW__CORE__EXECUTOR:-LocalExecutor}"
|
|
| 34 |
export AIRFLOW__WEBSERVER__WEB_SERVER_PORT="${AIRFLOW_WEB_PORT}"
|
| 35 |
export AIRFLOW__WEBSERVER__WEB_SERVER_MASTER_TIMEOUT="${AIRFLOW__WEBSERVER__WEB_SERVER_MASTER_TIMEOUT:-300}"
|
| 36 |
export AIRFLOW__WEBSERVER__WORKER_CLASS="${AIRFLOW__WEBSERVER__WORKER_CLASS:-gevent}"
|
|
|
|
| 37 |
|
| 38 |
# ---- Airflow Scheduler Settings ----
|
| 39 |
export AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL="${AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL:-30}"
|
|
|
|
| 13 |
# ---- Database Connection (Set via HF Secret for production) ----
|
| 14 |
export AIRFLOW__DATABASE__SQL_ALCHEMY_CONN="${AIRFLOW__DATABASE__SQL_ALCHEMY_CONN:-postgresql://postgres.ffetkispaxytayrnmxvj:uKInpRkBXsCUfVg1@aws-1-ap-south-1.pooler.supabase.com:5432/postgres}"
|
| 15 |
|
| 16 |
+
# Prevent DB Connection Exhaustion on Hugging Face / Supabase Free Tier
|
| 17 |
+
export AIRFLOW__DATABASE__SQL_ALCHEMY_POOL_SIZE="2"
|
| 18 |
+
export AIRFLOW__DATABASE__SQL_ALCHEMY_MAX_OVERFLOW="1"
|
| 19 |
+
export AIRFLOW__DATABASE__SQL_ALCHEMY_POOL_RECYCLE="1800"
|
| 20 |
+
|
| 21 |
# ---- DAG Repository ----
|
| 22 |
export DAG_REPO_URL="${DAG_REPO_URL:-https://github.com/subhamgiri460/myworkflows.git}"
|
| 23 |
export DAG_REPO_BRANCH="${DAG_REPO_BRANCH:-main}"
|
|
|
|
| 39 |
export AIRFLOW__WEBSERVER__WEB_SERVER_PORT="${AIRFLOW_WEB_PORT}"
|
| 40 |
export AIRFLOW__WEBSERVER__WEB_SERVER_MASTER_TIMEOUT="${AIRFLOW__WEBSERVER__WEB_SERVER_MASTER_TIMEOUT:-300}"
|
| 41 |
export AIRFLOW__WEBSERVER__WORKER_CLASS="${AIRFLOW__WEBSERVER__WORKER_CLASS:-gevent}"
|
| 42 |
+
export AIRFLOW__WEBSERVER__SECRET_KEY="${AIRFLOW__WEBSERVER__SECRET_KEY:-hf-spaces-default-secret-key-12345}"
|
| 43 |
|
| 44 |
# ---- Airflow Scheduler Settings ----
|
| 45 |
export AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL="${AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL:-30}"
|
entrypoint.sh
CHANGED
|
@@ -29,12 +29,15 @@ airflow db migrate || true
|
|
| 29 |
|
| 30 |
echo ""
|
| 31 |
echo "=== Creating admin user ==="
|
|
|
|
|
|
|
|
|
|
| 32 |
airflow users create \
|
| 33 |
--username "${AIRFLOW_ADMIN_USER}" \
|
| 34 |
--firstname Admin \
|
| 35 |
--lastname User \
|
| 36 |
--role Admin \
|
| 37 |
-
--email
|
| 38 |
--password "${AIRFLOW_ADMIN_PASSWORD}" || true
|
| 39 |
|
| 40 |
echo ""
|
|
|
|
| 29 |
|
| 30 |
echo ""
|
| 31 |
echo "=== Creating admin user ==="
|
| 32 |
+
# Delete old admin user if it exists to ensure fresh credentials
|
| 33 |
+
airflow users delete -u "${AIRFLOW_ADMIN_USER}" || true
|
| 34 |
+
|
| 35 |
airflow users create \
|
| 36 |
--username "${AIRFLOW_ADMIN_USER}" \
|
| 37 |
--firstname Admin \
|
| 38 |
--lastname User \
|
| 39 |
--role Admin \
|
| 40 |
+
--email "${AIRFLOW_ADMIN_USER}@example.com" \
|
| 41 |
--password "${AIRFLOW_ADMIN_PASSWORD}" || true
|
| 42 |
|
| 43 |
echo ""
|
supervisord.conf
CHANGED
|
@@ -9,30 +9,38 @@ loglevel=info
|
|
| 9 |
command=/usr/sbin/nginx -g "daemon off;"
|
| 10 |
autostart=true
|
| 11 |
autorestart=true
|
| 12 |
-
stderr_logfile=/
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
priority=5
|
| 15 |
|
| 16 |
[program:airflow-webserver]
|
| 17 |
command=airflow webserver
|
| 18 |
autostart=true
|
| 19 |
autorestart=true
|
| 20 |
-
stderr_logfile=/
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
priority=20
|
| 23 |
|
| 24 |
[program:airflow-scheduler]
|
| 25 |
command=airflow scheduler
|
| 26 |
autostart=true
|
| 27 |
autorestart=true
|
| 28 |
-
stderr_logfile=/
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
priority=30
|
| 31 |
|
| 32 |
[program:refresh-service]
|
| 33 |
command=gunicorn --bind 127.0.0.1:5000 --workers 1 --worker-class gevent --chdir / refresh_service:app
|
| 34 |
autostart=true
|
| 35 |
autorestart=true
|
| 36 |
-
stderr_logfile=/
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
priority=10
|
|
|
|
| 9 |
command=/usr/sbin/nginx -g "daemon off;"
|
| 10 |
autostart=true
|
| 11 |
autorestart=true
|
| 12 |
+
stderr_logfile=/dev/stderr
|
| 13 |
+
stderr_logfile_maxbytes=0
|
| 14 |
+
stdout_logfile=/dev/stdout
|
| 15 |
+
stdout_logfile_maxbytes=0
|
| 16 |
priority=5
|
| 17 |
|
| 18 |
[program:airflow-webserver]
|
| 19 |
command=airflow webserver
|
| 20 |
autostart=true
|
| 21 |
autorestart=true
|
| 22 |
+
stderr_logfile=/dev/stderr
|
| 23 |
+
stderr_logfile_maxbytes=0
|
| 24 |
+
stdout_logfile=/dev/stdout
|
| 25 |
+
stdout_logfile_maxbytes=0
|
| 26 |
priority=20
|
| 27 |
|
| 28 |
[program:airflow-scheduler]
|
| 29 |
command=airflow scheduler
|
| 30 |
autostart=true
|
| 31 |
autorestart=true
|
| 32 |
+
stderr_logfile=/dev/stderr
|
| 33 |
+
stderr_logfile_maxbytes=0
|
| 34 |
+
stdout_logfile=/dev/stdout
|
| 35 |
+
stdout_logfile_maxbytes=0
|
| 36 |
priority=30
|
| 37 |
|
| 38 |
[program:refresh-service]
|
| 39 |
command=gunicorn --bind 127.0.0.1:5000 --workers 1 --worker-class gevent --chdir / refresh_service:app
|
| 40 |
autostart=true
|
| 41 |
autorestart=true
|
| 42 |
+
stderr_logfile=/dev/stderr
|
| 43 |
+
stderr_logfile_maxbytes=0
|
| 44 |
+
stdout_logfile=/dev/stdout
|
| 45 |
+
stdout_logfile_maxbytes=0
|
| 46 |
priority=10
|