Commit 8e6ae66 1 parent a65af9a commit 8e6ae66 Copy full SHA for 8e6ae66
File tree 3 files changed +25
-6
lines changed
3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ services:
72
72
ELASTIC_PASSWORD : admin
73
73
ELASTICSEARCH_IRI : http://elastic:admin@elasticsearch:9200
74
74
SYNCHRO_SECRET_KEY : " secret"
75
+ ROLE : api
75
76
cli :
76
77
extra_hosts : *default-extra_hosts
77
78
container_name : openchurch_backend_cli
@@ -91,11 +92,17 @@ services:
91
92
ELASTIC_PASSWORD : admin
92
93
SYNCHRO_SECRET_KEY : secret
93
94
REDIS_URL : redis://redis:6379
95
+ ROLE : cli
94
96
depends_on :
95
97
- db
96
98
- redis
97
99
- elasticsearch
98
100
user : root
101
+ healthcheck :
102
+ test : if [ $$(pgrep -F /var/run/crond.pid -r S,R --count) -eq 1 ]; then exit 0; else exit 1; fi
103
+ interval : 5s
104
+ timeout : 5s
105
+ retries : 55
99
106
networks :
100
107
- app-network
101
108
python :
Original file line number Diff line number Diff line change @@ -77,9 +77,6 @@ if [[ ! "$@" == *"frankenphp"* ]] || [ "$APP_ENV" != "prod" ]; then
77
77
sleep 10
78
78
fi
79
79
echo " \n db is UP!"
80
-
81
- # Run database migrations
82
- # bin/console -n doctrine:migrations:migrate -vvv
83
80
fi
84
81
85
82
nice php -d memory_limit=256M bin/console -n cache:clear --no-warmup
@@ -88,4 +85,17 @@ nice php -d memory_limit=256M bin/console -n cache:warmup
88
85
# Restore correct access rights to all project files exept for node_modules and vendor (they are not writable and do not belong to us):
89
86
chown -R www-data:www-data $( ls -A1 | grep -Ev ' vendor|node_modules|.git' )
90
87
88
+ if [ " $ROLE " == ' cli' ]; then
89
+ # Run database migrations
90
+ bin/console -n doctrine:migrations:migrate -vvv
91
+
92
+ # Merge docker env variables and cron.d/rosario
93
+ env > /etc/cron.d/openchurch_env
94
+ cat /etc/cron.d/backend >> /etc/cron.d/openchurch_env
95
+ mv /etc/cron.d/openchurch_env /etc/cron.d/backend
96
+
97
+ # Initialize elastic indexes
98
+ bin/console -vvv app:write:indexes
99
+ fi
100
+
91
101
exec " $@ "
Original file line number Diff line number Diff line change 4
4
env > /etc/environment
5
5
echo -------------------; echo Versions: ; python --version ; pip --version ; echo -------------------
6
6
7
- /opt/venv/bin/python /app/synchro.py --entity-only diocese &&
8
- /opt/venv/bin/python /app/synchro.py --entity-only parish &&
9
- /opt/venv/bin/python /app/synchro.py --entity-only church
7
+ while true ; do
8
+ /opt/venv/bin/python /app/synchro.py --entity-only diocese
9
+ /opt/venv/bin/python /app/synchro.py --entity-only parish
10
+ /opt/venv/bin/python /app/synchro.py --entity-only church
11
+ done
10
12
11
13
exec " $@ "
You can’t perform that action at this time.
0 commit comments