Skip to content

Commit 5a5eba1

Browse files
Document Public and Private Networks, alongwith Network Aliases
1 parent ec0570f commit 5a5eba1

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

docs/concepts/networking.mdx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,43 @@ Defang configures Security Groups, deploys applications to a private subnet and
1414
This page is about internal networking only. If you want to configure your services to be accessible from the public internet, check the [domains page](./domains.mdx).
1515
:::
1616

17+
## Public Services
18+
19+
If you want a service to have a public IP address, use the `public` network:
20+
21+
```yaml
22+
services:
23+
web:
24+
networks:
25+
public: # Defang will assign a public IP address
26+
```
27+
28+
## Private Services
29+
30+
If you want a service to not be accessible from the public internet, use the `private` network:
31+
32+
```yaml
33+
services:
34+
db:
35+
networks:
36+
private: # Defang will not assign a public IP address
37+
```
38+
39+
The service's hostname will be the same as the service's name.
40+
41+
## Hostname Aliases
42+
43+
By using network aliases, a service can be made available at multiple hostnames.
44+
45+
```yaml
46+
services:
47+
web:
48+
networks:
49+
public:
50+
aliases:
51+
- app
52+
```
53+
1754
## Internal Communication
1855

1956
You can expose ports in your service definition to allow other services to communicate with it. Similar to public communication, you can use the `ports` section of your service definition, but set the `mode` to `host` instead of `ingress` to allow other services to communicate with it through the internal network.
@@ -65,4 +102,4 @@ Internal communication between services in Defang BYOC follows the following pat
65102
http://<service-name>:<port>
66103
```
67104
</TabItem>
68-
</Tabs>
105+
</Tabs>

0 commit comments

Comments
 (0)