We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b529dd commit 95973cdCopy full SHA for 95973cd
backend/bin/setup_configuration.sh
@@ -1,13 +1,25 @@
1
#!/bin/sh
2
3
+# Waiting for database to be up
4
until pg_isready; do
5
>&2 echo "Waiting for database connection..."
6
sleep 1
7
done
8
-until python src/manage.py migrate --check; do
9
- >&2 echo "Waiting for migrations to be done..."
10
- sleep 1
+# Waiting for migrations to be done
+attempt_counter=0
11
+max_attempts=${CHECK_MIGRATIONS_MAX_ATTEMPT:-10}
12
+
13
+while ! python src/manage.py migrate --check; do
14
+ attempt_counter=$((attempt_counter + 1))
15
16
+ if [ $attempt_counter -ge $max_attempts ]; then
17
+ >&2 echo "Timed out while waiting for django migrations."
18
+ exit 1
19
+ fi
20
21
+ >&2 echo "Attempt $attempt_counter/$max_attempts: Waiting for migrations to be done..."
22
+ sleep 10
23
24
25
# Run setup configuration
0 commit comments