Skip to content

Commit 4b28f9c

Browse files
chore: configure Docker Compose healthchecks & update PWA dependencies (#499)
1 parent 1b4ae51 commit 4b28f9c

File tree

7 files changed

+1403
-1223
lines changed

7 files changed

+1403
-1223
lines changed

compose.override.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ services:
3434
WATCHPACK_POLLING: "true"
3535
# Development usage only
3636
NODE_TLS_REJECT_UNAUTHORIZED: "0"
37+
healthcheck:
38+
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:3000 || exit 1" ]
39+
start_period: 15s
40+
interval: 5s
41+
timeout: 3s
42+
retries: 5
3743

3844
###> doctrine/doctrine-bundle ###
3945
database:
@@ -55,6 +61,9 @@ services:
5561

5662
keycloak-config-cli:
5763
image: bitnami/keycloak-config-cli:5-debian-12
64+
depends_on:
65+
keycloak:
66+
condition: service_healthy
5867
environment:
5968
KEYCLOAK_URL: http://keycloak:8080/oidc/
6069
KEYCLOAK_USER: ${KEYCLOAK_ADMIN_USER:-admin}

compose.prod.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ services:
2222
NEXT_PUBLIC_OIDC_SERVER_URL: ${NEXT_PUBLIC_OIDC_SERVER_URL}
2323
environment:
2424
AUTH_SECRET: ${AUTH_SECRET}
25+
healthcheck:
26+
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:3000 || exit 1" ]
27+
start_period: 5s
28+
interval: 5s
29+
timeout: 3s
30+
retries: 5
2531

2632
database:
2733
environment:

compose.yaml

+29-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ services:
22
php:
33
image: ${IMAGES_PREFIX:-}app-php
44
depends_on:
5-
- database
5+
database:
6+
condition: service_healthy
7+
pwa:
8+
condition: service_healthy
9+
keycloak:
10+
condition: service_healthy
611
restart: unless-stopped
712
environment:
813
PWA_UPSTREAM: pwa:3000
@@ -52,6 +57,12 @@ services:
5257
# You should definitely change the password in production
5358
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-!ChangeMe!}
5459
- POSTGRES_USER=${POSTGRES_USER:-app}
60+
healthcheck:
61+
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-app}" ]
62+
start_period: 1s
63+
interval: 5s
64+
timeout: 3s
65+
retries: 3
5566
volumes:
5667
- db_data:/var/lib/postgresql/data
5768
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
@@ -69,6 +80,12 @@ services:
6980
# You should definitely change the password in production
7081
POSTGRES_PASSWORD: ${KEYCLOAK_POSTGRES_PASSWORD:-!ChangeMe!}
7182
POSTGRES_USER: ${KEYCLOAK_POSTGRES_USER:-keycloak}
83+
healthcheck:
84+
test: [ "CMD-SHELL", "pg_isready -U ${KEYCLOAK_POSTGRES_USER:-keycloak}" ]
85+
start_period: 1s
86+
interval: 5s
87+
timeout: 3s
88+
retries: 3
7289
volumes:
7390
- keycloak_db_data:/var/lib/postgresql/data
7491

@@ -88,8 +105,18 @@ services:
88105
KC_HOSTNAME_ADMIN_URL: https://${SERVER_NAME:-localhost}/oidc/
89106
# https://www.keycloak.org/server/features
90107
KC_FEATURES: "scripts"
108+
# https://github.com/bitnami/containers/pull/40893
109+
KEYCLOAK_ENABLE_HEALTH_ENDPOINTS: "true"
110+
# https://www.keycloak.org/server/all-config#category-health
111+
healthcheck:
112+
test: [ "CMD-SHELL", "curl http://127.0.0.1:8080/oidc/health || exit 1"]
113+
start_period: 15s
114+
interval: 5s
115+
timeout: 3s
116+
retries: 15
91117
depends_on:
92-
- keycloak-database
118+
keycloak-database:
119+
condition: service_healthy
93120
ports:
94121
- target: 8080
95122
published: 8080

pwa/components/admin/book/BookInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const BookInput = (props: BookInputProps) => {
120120
} = useInput({ ...props, source: "book" });
121121
const title = useWatch({ name: "title" });
122122
const author = useWatch({ name: "author" });
123-
const controller = useRef<AbortController | undefined>();
123+
const controller = useRef<AbortController | undefined>(undefined);
124124
const [searchQuery, setSearchQuery] = useState<string>("");
125125
const [value, setValue] = useState<Result | null | undefined>(
126126
!!title && !!author && !!field.value

pwa/next-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

pwa/package.json

+29-33
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,44 @@
1212
"dependencies": {
1313
"@api-platform/admin": "^4.0.3",
1414
"@api-platform/api-doc-parser": "^0.16.6",
15-
"@auth/core": "^0.37.3",
16-
"@fontsource/poppins": "^5.1.0",
17-
"@mui/icons-material": "^5.16.7",
18-
"@mui/material": "^5.16.7",
19-
"@tailwindcss/forms": "^0.5.9",
20-
"@tanstack/react-query": "^5.59.20",
21-
"@tanstack/react-query-devtools": "^5.59.20",
22-
"@tanstack/react-query-next-experimental": "^5.59.20",
15+
"@auth/core": "^0.37.4",
16+
"@fontsource/poppins": "^5.1.1",
17+
"@mui/icons-material": "latest-v5",
18+
"@mui/material": "latest-v5",
19+
"@tailwindcss/forms": "^0.5.10",
20+
"@tanstack/react-query": "^5.64.2",
21+
"@tanstack/react-query-devtools": "^5.64.2",
22+
"@tanstack/react-query-next-experimental": "^5.64.2",
2323
"autoprefixer": "^10.4.20",
2424
"formik": "^2.4.6",
25-
"next": "^15.1.2",
26-
"next-auth": "5.0.0-beta.16",
25+
"next": "^15.1.5",
26+
"next-auth": "5.0.0-beta.25",
2727
"picocolors": "^1.1.1",
28-
"postcss": "^8.4.47",
29-
"ra-i18n-polyglot": "^5.3.3",
30-
"ra-language-english": "^5.3.3",
31-
"ra-language-french": "^5.3.3",
32-
"ra-ui-materialui": "^5.3.3",
33-
"react": "^18.3.1",
34-
"react-admin": "^5.3.3",
35-
"react-dom": "^18.3.1",
36-
"react-hook-form": "^7.53.2",
37-
"react-spinners": "^0.14.1",
28+
"postcss": "^8.5.1",
29+
"ra-i18n-polyglot": "^5.4.4",
30+
"ra-language-english": "^5.4.4",
31+
"ra-language-french": "^5.4.4",
32+
"ra-ui-materialui": "^5.4.4",
33+
"react": "^19.0.0",
34+
"react-admin": "^5.4.4",
35+
"react-dom": "^19.0.0",
36+
"react-hook-form": "^7.54.2",
37+
"react-spinners": "^0.15.0",
3838
"sharp": "^0.33.5",
3939
"slugify": "^1.6.6",
40-
"tailwindcss": "^3.4.14",
41-
"yup": "^1.4.0"
40+
"tailwindcss": "^3.4.17",
41+
"yup": "^1.6.1"
4242
},
4343
"devDependencies": {
4444
"@babel/core": "^7.26.0",
45-
"@playwright/test": "^1.48.2",
45+
"@playwright/test": "^1.49.1",
4646
"@popperjs/core": "^2.11.8",
47-
"@types/node": "^22.9.0",
48-
"@types/react": "^18.3.12",
49-
"@types/react-dom": "^18.3.1",
50-
"eslint": "^9.14.0",
51-
"eslint-config-next": "^15.0.3",
52-
"typescript": "^5.6.3"
53-
},
54-
"peerDependencies": {
55-
"@babel/core": "^7.19.0",
56-
"@popperjs/core": "^2.11.6"
47+
"@types/node": "^22.10.7",
48+
"@types/react": "^19.0.7",
49+
"@types/react-dom": "^19.0.3",
50+
"eslint": "^9.18.0",
51+
"eslint-config-next": "^15.1.5",
52+
"typescript": "^5.7.3"
5753
},
5854
"packageManager": "[email protected]+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
5955
}

0 commit comments

Comments
 (0)