Skip to content

Commit 99859c2

Browse files
adding an FAQ section to describe solutions to the invalid healthcheck error
1 parent 938d763 commit 99859c2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/faq.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,31 @@ secrets:
144144

145145
### "Stack:… is in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS state and cannot be updated"
146146
- This happens if different version of the Defang CLI are used with the same AWS account. Each version one will try to update the CD stack to its version, back and forth. Make sure that all users have the same version of the CLI. Check the CLI version using `defang version`.
147+
148+
### "invalid healthcheck: ingress ports require an HTTP healthcheck on `localhost`.
149+
150+
- This message is displayed when `defang compose up` tries to deploy a service with an "ingress" port, if the service does not have a `healthcheck` which mentions `localhost`. Defang routes a load balancer to your service's ingress ports, and the loadbalancer needs to be able to check the health of the service. Two solve this issue, ask yourself these two questions:
151+
152+
1. Should my service be public? It's common to declare your container's ports using the Compose file "shorthand" syntax (`1234:1234`). This syntax can be understood as `[HOST:]CONTAINER`. If your service is not intended to be public, you do not need to declare a HOST port. For example:
153+
154+
```diff
155+
services:
156+
my-service:
157+
image: my-image
158+
ports:
159+
- - "1234:1234"
160+
+ - "1234"
161+
```
162+
2. Does my healthcheck include the string `localhost`? It is very common to define a healthcheck by using `curl` or `wget` to make a request to `localhost`. So common, in fact, that defang will look for the string `localhost` in your healthcheck definition. For example, this healthcheck is valid:
163+
164+
```yaml
165+
healthcheck:
166+
test: ["CMD", "curl", "-f", "http://localhost:1234/health"]
167+
```
168+
169+
This healthcheck is not valid:
170+
171+
```yaml
172+
healthcheck:
173+
test: ["CMD", "./my-healthcheck"]
174+
```

0 commit comments

Comments
 (0)