mirror of https://github.com/veops/cmdb.git
chore: use wait script to hang api before cache/db/es started
This commit is contained in:
parent
91c844ba63
commit
1505d9d948
|
@ -36,6 +36,9 @@ RUN pip install --no-cache-dir -r requirements.txt \
|
|||
&& sed -i "s#redis://127.0.0.1#redis://redis#g" settings.py \
|
||||
&& sed -i 's#CACHE_REDIS_HOST = "127.0.0.1"#CACHE_REDIS_HOST = "redis"#g' settings.py
|
||||
|
||||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
|
||||
RUN chmod +x /wait
|
||||
|
||||
CMD ["bash", "-c", "flask run"]
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ services:
|
|||
container_name: cmdb-api
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
WAIT_HOSTS: cmdb-db:3306, cmdb-cache:6379, cmdb-search:9200
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
|
@ -68,10 +69,12 @@ services:
|
|||
sed -i "s#USE_ES = False#USE_ES = True#g" settings.py
|
||||
sed -i "s#USE_ACL = False#USE_ACL = True#g" settings.py
|
||||
sed -i "s#ES_HOST = '127.0.0.1'#ES_HOST = 'cmdb-search'#g" settings.py
|
||||
sleep 20
|
||||
/wait
|
||||
sleep 5
|
||||
gunicorn --workers=3 autoapp:app -b 0.0.0.0:5000 -D
|
||||
flask init-cache
|
||||
flask init-acl
|
||||
|
||||
celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1
|
||||
depends_on:
|
||||
- cmdb-db
|
||||
|
|
Loading…
Reference in New Issue