You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple example with 3 servers and a load balancer that distributes the traffic between them. The example assumes that each of the servers has some application listening on port 3000.
3
+
A simple example with 3 servers and a load balancer that distributes the traffic between them. The example uses an user-data script to launch a HTTP server listening to port 80 on each server. The example does not enable TLS on frontend by default.
4
4
5
-
Once you deploy it, go to your domain settings and add a CNAME record that points to the `lb_url` output variable. After the change gets propagated, all the traffic to your domain (`my.domain.com` in this example) will be distributed among the 3 servers.
5
+
## Getting started
6
+
7
+
To deploy private network, three servers, and load balancer on your UpCloud account, run:
8
+
9
+
```bash
10
+
terraform init
11
+
terraform apply
12
+
```
13
+
14
+
Once the deployment is complete and load balancer has reached `running` state you can use `curl` or your browser to send request to the load balancer available in the URL defined by `lb_url` output variable:
15
+
16
+
```bash
17
+
curl $(terraform output -raw lb_url)
18
+
```
19
+
20
+
Note that it might take some time for the DNS name to propagate. During this time the above `curl` command will likely fail with `Could not resolve host: ...` error message.
21
+
22
+
The output should include hostname of the backend server, for example:
23
+
24
+
```txt
25
+
Hello from lb-module-basic-example-server-1
26
+
```
27
+
28
+
## Enable TLS
29
+
30
+
The example does not enable TLS on frontend by default. To enable TLS, uncomment `domains` variable in [main.tf](./main.tf) and replace example domain with your domain. Change also the value for `frontend_port` from `80` to `443`.
31
+
32
+
Deploy the changes with `terraform apply`. When the deployment is completed, go to your domain settings and add a CNAME record that points to the `lb_url` output variable. After the change gets propagated, all the traffic to your domain will be distributed among the 3 servers.
0 commit comments