Skip to content

Commit

Permalink
local_docker: Fix races between the containers
Browse files Browse the repository at this point in the history
This change will make docker-compose wait for both the redis and the
postgres container before starting the other services.

related #6792
  • Loading branch information
dasJ committed Oct 30, 2020
1 parent 52d178b commit f5821bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion installer/roles/local_docker/templates/docker-compose.yml.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#jinja2: lstrip_blocks: True
version: '2'
version: '3'
services:

web:
Expand Down Expand Up @@ -163,6 +163,9 @@ services:
https_proxy: {{ https_proxy | default('') }}
no_proxy: {{ no_proxy | default('') }}
command: ["/usr/local/etc/redis/redis.conf"]
healthcheck:
test: ["CMD-SHELL", "redis-cli -s /var/run/redis/redis.sock ping"]
interval: 10s
volumes:
- "{{ docker_compose_dir }}/redis.conf:/usr/local/etc/redis/redis.conf:ro"
- "{{ docker_compose_dir }}/redis_socket:/var/run/redis/:rw"
Expand All @@ -176,6 +179,9 @@ services:
image: {{ postgresql_image }}
container_name: awx_postgres
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U {{ pg_username }}"]
interval: 10s
volumes:
- "{{ postgres_data_dir }}/10/data/:/var/lib/postgresql/data:Z"
environment:
Expand Down

0 comments on commit f5821bd

Please sign in to comment.