2019-09-30 21:07:59 +05:30
---
type: reference
---
2020-06-23 00:09:42 +05:30
# Load Balancer for multi-node GitLab
2016-06-02 11:05:42 +05:30
2020-06-23 00:09:42 +05:30
In an multi-node GitLab configuration, you will need a load balancer to route
2016-06-02 11:05:42 +05:30
traffic to the application servers. The specifics on which load balancer to use
or the exact configuration is beyond the scope of GitLab documentation. We hope
that if you're managing HA systems like GitLab you have a load balancer of
choice already. Some examples including HAProxy (open-source), F5 Big-IP LTM,
and Citrix Net Scaler. This documentation will outline what ports and protocols
you need to use with GitLab.
2019-07-07 11:18:12 +05:30
## SSL
2020-06-23 00:09:42 +05:30
How will you handle SSL in your multi-node environment? There are several different
2019-07-07 11:18:12 +05:30
options:
- Each application node terminates SSL
- The load balancer(s) terminate SSL and communication is not secure between
the load balancer(s) and the application nodes
- The load balancer(s) terminate SSL and communication is *secure* between the
load balancer(s) and the application nodes
### Application nodes terminate SSL
Configure your load balancer(s) to pass connections on port 443 as 'TCP' rather
than 'HTTP(S)' protocol. This will pass the connection to the application nodes
2019-12-21 20:55:43 +05:30
NGINX service untouched. NGINX will have the SSL certificate and listen on port 443.
2019-07-07 11:18:12 +05:30
2019-12-21 20:55:43 +05:30
See [NGINX HTTPS documentation ](https://docs.gitlab.com/omnibus/settings/nginx.html#enable-https )
for details on managing SSL certificates and configuring NGINX.
2019-07-07 11:18:12 +05:30
### Load Balancer(s) terminate SSL without backend SSL
Configure your load balancer(s) to use the 'HTTP(S)' protocol rather than 'TCP'.
The load balancer(s) will then be responsible for managing SSL certificates and
terminating SSL.
Since communication between the load balancer(s) and GitLab will not be secure,
there is some additional configuration needed. See
2019-12-21 20:55:43 +05:30
[NGINX Proxied SSL documentation ](https://docs.gitlab.com/omnibus/settings/nginx.html#supporting-proxied-ssl )
2019-07-07 11:18:12 +05:30
for details.
### Load Balancer(s) terminate SSL with backend SSL
Configure your load balancer(s) to use the 'HTTP(S)' protocol rather than 'TCP'.
The load balancer(s) will be responsible for managing SSL certificates that
end users will see.
2019-12-21 20:55:43 +05:30
Traffic will also be secure between the load balancer(s) and NGINX in this
2019-07-07 11:18:12 +05:30
scenario. There is no need to add configuration for proxied SSL since the
connection will be secure all the way. However, configuration will need to be
added to GitLab to configure SSL certificates. See
2019-12-21 20:55:43 +05:30
[NGINX HTTPS documentation ](https://docs.gitlab.com/omnibus/settings/nginx.html#enable-https )
for details on managing SSL certificates and configuring NGINX.
2019-07-07 11:18:12 +05:30
## Ports
### Basic ports
2016-06-02 11:05:42 +05:30
2019-12-04 20:38:33 +05:30
| LB Port | Backend Port | Protocol |
| ------- | ------------ | ------------------------ |
| 80 | 80 | HTTP (*1*) |
| 443 | 443 | TCP or HTTPS (*1*) (*2*) |
| 22 | 22 | TCP |
2020-05-24 23:13:21 +05:30
- (*1*): [Web terminal ](../../ci/environments/index.md#web-terminals ) support requires
2019-12-04 20:38:33 +05:30
your load balancer to correctly handle WebSocket connections. When using
HTTP or HTTPS proxying, this means your load balancer must be configured
to pass through the `Connection` and `Upgrade` hop-by-hop headers. See the
[web terminal ](../integration/terminal.md ) integration guide for
more details.
- (*2*): When using HTTPS protocol for port 443, you will need to add an SSL
certificate to the load balancers. If you wish to terminate SSL at the
GitLab application server instead, use TCP protocol.
2016-06-02 11:05:42 +05:30
2019-07-07 11:18:12 +05:30
### GitLab Pages Ports
2016-06-02 11:05:42 +05:30
2019-07-07 11:18:12 +05:30
If you're using GitLab Pages with custom domain support you will need some
2017-08-17 22:00:37 +05:30
additional port configurations.
GitLab Pages requires a separate virtual IP address. Configure DNS to point the
`pages_external_url` from `/etc/gitlab/gitlab.rb` at the new virtual IP address. See the
2019-12-04 20:38:33 +05:30
[GitLab Pages documentation ](../pages/index.md ) for more information.
2016-06-02 11:05:42 +05:30
2019-12-04 20:38:33 +05:30
| LB Port | Backend Port | Protocol |
| ------- | ------------- | --------- |
| 80 | Varies (*1*) | HTTP |
| 443 | Varies (*1*) | TCP (*2*) |
- (*1*): The backend port for GitLab Pages depends on the
`gitlab_pages['external_http']` and `gitlab_pages['external_https']`
setting. See [GitLab Pages documentation ](../pages/index.md ) for more details.
- (*2*): Port 443 for GitLab Pages should always use the TCP protocol. Users can
configure custom domains with custom SSL, which would not be possible
if SSL was terminated at the load balancer.
2016-06-02 11:05:42 +05:30
2019-07-07 11:18:12 +05:30
### Alternate SSH Port
2016-06-02 11:05:42 +05:30
Some organizations have policies against opening SSH port 22. In this case,
it may be helpful to configure an alternate SSH hostname that allows users
2017-08-17 22:00:37 +05:30
to use SSH on port 443. An alternate SSH hostname will require a new virtual IP address
2016-06-02 11:05:42 +05:30
compared to the other GitLab HTTP configuration above.
2019-12-04 20:38:33 +05:30
Configure DNS for an alternate SSH hostname such as `altssh.gitlab.example.com` .
2016-06-02 11:05:42 +05:30
| LB Port | Backend Port | Protocol |
| ------- | ------------ | -------- |
| 443 | 22 | TCP |
2020-06-23 00:09:42 +05:30
## Readiness check
It is strongly recommend that multi-node deployments configure load balancers to utilize the [readiness check ](../../user/admin_area/monitoring/health_check.md#readiness ) to ensure a node is ready to accept traffic, before routing traffic to it. This is especially important when utilizing Puma, as there is a brief period during a restart where Puma will not accept requests.
2016-06-02 11:05:42 +05:30
---
Read more on high-availability configuration:
2020-06-23 00:09:42 +05:30
1. [Configure the database ](../postgresql/replication_and_failover.md )
2016-06-02 11:05:42 +05:30
1. [Configure Redis ](redis.md )
1. [Configure NFS ](nfs.md )
1. [Configure the GitLab application servers ](gitlab.md )
2019-09-30 21:07:59 +05:30
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X` .
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->