Skip to content

Commit a66e751

Browse files
committed
add new warning/error messages section
1 parent 00c6865 commit a66e751

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

docs/faq/_category_.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"label": "FAQ",
3+
"position": 600,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Wondering about something? Check out one of the guides below for additional support."
7+
}
8+
}
9+

docs/faq/warnings-errors.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
sidebar_position: 700
3+
title: Common Error Messages
4+
description: Common warnings and error messages, and their meanings.
5+
---
6+
7+
Here are meanings of common [warning](#warnings) and [error](#errors) messages you may encounter in the Defang CLI.
8+
9+
## Warnings
10+
11+
### "The folder is not empty. Files may be overwritten."
12+
- This message is displayed when you run `defang generate` and the target folder is not empty. If you proceed, Defang will overwrite any existing files with the same name. If you want to keep the existing files, you should move them to a different folder before running `defang generate` or pick a different target folder.
13+
14+
### "environment variable not found"
15+
- This message is displayed when you run `defang compose up` and the Compose file references an environment variable that is not set. If you proceed, the environment variable will be empty in the container. If you want to set the environment variable, you should set it in the environment where you run `defang compose up`.
16+
17+
### "Unsupported platform"
18+
- This message is displayed when you run `defang compose up` and the Compose file references a platform that is not supported by Defang. Defang Beta only supports Linux operating systems.
19+
20+
### "not logged in"
21+
- This message is displayed when you run `defang compose config` but you are not logged in. The displayed configuration will be incomplete. If you want to see the complete configuration, you should log in first using `defang login`.
22+
23+
### "No port mode was specified; assuming 'host'"
24+
- This message is displayed when you run `defang compose up` and the Compose file declares a `port` that does not specify a port `mode`. By default, Defang will keep the port private. If you want to expose the port to the public internet, you should specify the `mode` as `ingress`:
25+
```
26+
services:
27+
service1:
28+
29+
ports:
30+
- target: 80
31+
mode: ingress
32+
```
33+
34+
### "Published ports are not supported in ingress mode; assuming 'host'"
35+
- This message is displayed when you run `defang compose up` and the Compose file declares a `port` with `mode` set to `ingress` and `published` set to a port number. Defang does not support published ports in ingress mode. If you want to expose the port to the public internet, you should specify the `mode` as `ingress` and remove the `published` setting.
36+
37+
### "TCP ingress is not supported; assuming HTTP"
38+
- This message is displayed when you run `defang compose up` and the Compose file declares a `port` with `mode` set to `ingress` and `protocol` set to `tcp`. Defang does not support arbitrary TCP ingress and will assume the port is used for HTTP traffic. To silence the warning, remove the `protocol` setting.
39+
40+
### "unsupported compose directive"
41+
- This message is displayed when you run `defang compose up` and the Compose file declares a directive that is not supported by Defang. The deployment will continue, but the unsupported directive will be ignored, which may cause unexpected behavior.
42+
43+
### "no reservations specified; using limits as reservations"
44+
- This message is displayed when you run `defang compose up` and the Compose file declares a `resource` with `limits` but no `reservations`. Defang will use the `limits` as `reservations` to ensure the container has enough resources. Specify `reservations` if you want to silence the warning or reserve a different amount of resources:
45+
```
46+
services:
47+
service1:
48+
49+
deploy:
50+
resources:
51+
reservations:
52+
cpus: 0.5
53+
memory: 512MB
54+
```
55+
56+
### "ingress port without healthcheck defaults to GET / HTTP/1.1"
57+
- This message is displayed when you run `defang compose up` and the Compose file declares an `ingress` with a `port` but no `healthcheck`. Defang will assume the default healthcheck of `GET / HTTP/1.1` to ensure the port is healthy. Specify a `healthcheck` if you want to silence the warning or use a different healthcheck:
58+
```
59+
services:
60+
service1:
61+
62+
deploy:
63+
healthcheck:
64+
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
65+
```
66+
67+
### "missing memory reservation; specify deploy.resources.reservations.memory to avoid out-of-memory errors"
68+
- This message is displayed when you run `defang compose up` and the Compose file doesn't specify a `memory` reservation. If available, Defang will use the `memory` limit as the `memory` reservation. Specify a `memory` reservation if you want to silence the warning or reserve a different amount of memory:
69+
```
70+
services:
71+
service1:
72+
73+
deploy:
74+
resources:
75+
reservations:
76+
memory: 512MB
77+
```
78+
79+
### "The build context contains more than 10 files"
80+
- This message is displayed when you run `defang compose up` and the Compose file declares a `build` with a `context` that contains more than 10 files. Ensure the context refers to the correct folder. Defang will use the `context` as is, but you may experience slow build times. If you want to speed up the build, you should reduce the number of files in the `context`.
81+
82+
### "AWS provider was selected, but AWS environment variables are not set"
83+
- This message is displayed when you run `defang compose up` with the `--provider=aws` but none of the AWS environment variables were set. If you proceed, the deployment might fail, unless you have defined defined `default` credentials in the AWS configuration files or are running on an AWS instance.
84+
85+
### "Using Defang provider, but AWS environment variables were detected"
86+
- This message is displayed when you run `defang compose up` with the `--provider=defang` but AWS environment variables were detected. The AWS environment variables will be ignored.
87+
88+
## Errors
89+
90+
### "Stack:… is in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS state and cannot be updated"
91+
- 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`.
92+
93+
### "invalid healthcheck: ingress ports require an HTTP healthcheck on `localhost`.
94+
95+
- 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. To solve this issue, ask yourself these two questions:
96+
97+
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:
98+
99+
```diff
100+
services:
101+
my-service:
102+
image: my-image
103+
ports:
104+
- - "1234:1234"
105+
+ - "1234"
106+
```
107+
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:
108+
109+
```yaml
110+
healthcheck:
111+
test: ["CMD", "curl", "-f", "http://localhost:1234/health"]
112+
```
113+
114+
This healthcheck is not valid for `ingress` ports:
115+
116+
```yaml
117+
healthcheck:
118+
test: ["CMD", "./my-healthcheck"]
119+
```
120+
121+
### The build aborted with OutOfMemoryError: Container killed due to memory usage
122+
123+
The image build might fail if the build process uses too much memory. The first thing to try is to limit the size of your project by excluding unnecessary files: the easiest way is to create a `.dockerignore` file that excludes irrelevatn files. Note that Defang will use a default `.dockerignore` file if you don't have one, but that default might not work for some projects and it's always better to make a `.dockerignore` file specific to your project.
124+
125+
If that doesn't work, you can try to increase the memory available to the build process by adding a field `shm_size` to the `build` section in your `compose.yaml` file:
126+
127+
```yaml
128+
services:
129+
service1:
130+
build:
131+
context: .
132+
shm_size: 16g
133+
```

0 commit comments

Comments
 (0)