-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit_airflow.sh
More file actions
executable file
·34 lines (26 loc) · 1 KB
/
init_airflow.sh
File metadata and controls
executable file
·34 lines (26 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Initialize Airflow DB
set -e
# Load environment variables
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
echo "📄 Checking for custom Airflow user credentials…"
if [[ "$AIRFLOW_USERNAME" != "changeme" && "$AIRFLOW_PASSWORD" != "changeme" ]]; then
echo "🔑 Creating Airflow user with credentials from .env…"
airflow users create \
--username "$AIRFLOW_USERNAME" \
--password "$AIRFLOW_PASSWORD" \
--firstname "${AIRFLOW_FIRSTNAME:-User}" \
--lastname "${AIRFLOW_LASTNAME:-User}" \
--role Admin \
--email "${AIRFLOW_EMAIL:-user@example.com}"
echo "✅ Custom Airflow user created: $AIRFLOW_USERNAME"
else
echo "⚠️ No custom credentials detected in .env. Using default admin/admin."
fi
echo "Airflow admin user created. You can log in at http://localhost:8080"
# Start the webserver & scheduler (optional here)
echo "🚀 Starting Airflow webserver & scheduler..."
airflow webserver -p 8080 &
airflow scheduler &