Skip to content

Commit 22b26dc

Browse files
authored
Merge pull request #103 from itk-dev/feature/healthy
Added memcache and mariadb healt checks
2 parents 54ab2db + 5f9b4a4 commit 22b26dc

File tree

7 files changed

+81
-12
lines changed

7 files changed

+81
-12
lines changed

templates/drupal-10/docker-compose.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -39,8 +45,10 @@ services:
3945
- COMPOSER_VERSION=2
4046
- PHP_IDE_CONFIG=serverName=localhost
4147
depends_on:
42-
- mariadb
43-
- memcached
48+
mariadb:
49+
condition: service_healthy
50+
memcached:
51+
condition: service_healthy
4452
volumes:
4553
- .:/app
4654

@@ -70,11 +78,15 @@ services:
7078
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
7179

7280
memcached:
73-
image: 'memcached:latest'
81+
image: memcached:alpine
7482
networks:
7583
- app
7684
ports:
7785
- '11211'
86+
healthcheck:
87+
test: echo "version" | nc -vn -w 1 127.0.0.1 11211
88+
interval: 10s
89+
retries: 60
7890
environment:
7991
- MEMCACHED_CACHE_SIZE=64
8092

templates/drupal-7/docker-compose.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -39,8 +45,10 @@ services:
3945
- COMPOSER_VERSION=2
4046
- PHP_IDE_CONFIG=serverName=localhost
4147
depends_on:
42-
- mariadb
43-
- memcached
48+
mariadb:
49+
condition: service_healthy
50+
memcached:
51+
condition: service_healthy
4452
volumes:
4553
- .:/app
4654
- drush-cache:/root/.drush
@@ -76,6 +84,10 @@ services:
7684
- app
7785
ports:
7886
- '11211'
87+
healthcheck:
88+
test: echo "version" | nc -vn -w 1 127.0.0.1 11211
89+
interval: 10s
90+
retries: 60
7991
environment:
8092
- MEMCACHED_CACHE_SIZE=64
8193

templates/drupal-8/docker-compose.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -39,8 +45,10 @@ services:
3945
- COMPOSER_VERSION=2
4046
- PHP_IDE_CONFIG=serverName=localhost
4147
depends_on:
42-
- mariadb
43-
- memcached
48+
mariadb:
49+
condition: service_healthy
50+
memcached:
51+
condition: service_healthy
4452
volumes:
4553
- .:/app
4654

@@ -75,6 +83,10 @@ services:
7583
- app
7684
ports:
7785
- '11211'
86+
healthcheck:
87+
test: echo "version" | nc -vn -w 1 127.0.0.1 11211
88+
interval: 10s
89+
retries: 60
7890
environment:
7991
- MEMCACHED_CACHE_SIZE=64
8092

templates/drupal-9/docker-compose.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -39,8 +45,10 @@ services:
3945
- COMPOSER_VERSION=2
4046
- PHP_IDE_CONFIG=serverName=localhost
4147
depends_on:
42-
- mariadb
43-
- memcached
48+
mariadb:
49+
condition: service_healthy
50+
memcached:
51+
condition: service_healthy
4452
volumes:
4553
- .:/app
4654

@@ -75,6 +83,10 @@ services:
7583
- app
7684
ports:
7785
- '11211'
86+
healthcheck:
87+
test: echo "version" | nc -vn -w 1 127.0.0.1 11211
88+
interval: 10s
89+
retries: 60
7890
environment:
7991
- MEMCACHED_CACHE_SIZE=64
8092

templates/symfony-3/docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -39,7 +45,8 @@ services:
3945
- COMPOSER_VERSION=2
4046
- PHP_IDE_CONFIG=serverName=localhost
4147
depends_on:
42-
- mariadb
48+
mariadb:
49+
condition: service_healthy
4350
volumes:
4451
- .:/app
4552

templates/symfony-4/docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -39,7 +45,8 @@ services:
3945
- COMPOSER_VERSION=2
4046
- PHP_IDE_CONFIG=serverName=localhost
4147
depends_on:
42-
- mariadb
48+
mariadb:
49+
condition: service_healthy
4350
volumes:
4451
- .:/app
4552

templates/symfony-6/docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ services:
1313
- app
1414
ports:
1515
- '3306'
16+
healthcheck:
17+
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
18+
start_period: 10s
19+
interval: 10s
20+
timeout: 5s
21+
retries: 3
1622
environment:
1723
- MYSQL_ROOT_PASSWORD=password
1824
- MYSQL_USER=db
@@ -36,7 +42,8 @@ services:
3642
- COMPOSER_VERSION=2
3743
- PHP_IDE_CONFIG=serverName=localhost
3844
depends_on:
39-
- mariadb
45+
mariadb:
46+
condition: service_healthy
4047
volumes:
4148
- .:/app
4249

0 commit comments

Comments
 (0)