From 5a5eba1463d01b2722a056098e887cb4d3921b11 Mon Sep 17 00:00:00 2001 From: Jordan Stephens Date: Tue, 19 Nov 2024 10:34:33 -0800 Subject: [PATCH] Document Public and Private Networks, alongwith Network Aliases --- docs/concepts/networking.mdx | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/concepts/networking.mdx b/docs/concepts/networking.mdx index 881b6ab82..f38c39502 100644 --- a/docs/concepts/networking.mdx +++ b/docs/concepts/networking.mdx @@ -14,6 +14,43 @@ Defang configures Security Groups, deploys applications to a private subnet and 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). ::: +## Public Services + +If you want a service to have a public IP address, use the `public` network: + +```yaml +services: + web: + networks: + public: # Defang will assign a public IP address +``` + +## Private Services + +If you want a service to not be accessible from the public internet, use the `private` network: + +```yaml +services: + db: + networks: + private: # Defang will not assign a public IP address +``` + +The service's hostname will be the same as the service's name. + +## Hostname Aliases + +By using network aliases, a service can be made available at multiple hostnames. + +```yaml +services: + web: + networks: + public: + aliases: + - app +``` + ## Internal Communication 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 http://: ``` - \ No newline at end of file +