Before beginning, you should already have a working GitLab instance. [Learn how
Before beginning, you should already have a working GitLab instance. [Learn how
to install GitLab](https://about.gitlab.com/install/).
to install GitLab](https://about.gitlab.com/install/).
Provision a PostgreSQL server (PostgreSQL 11 or newer).
Provision a PostgreSQL server. We recommend using the PostgreSQL that is shipped
with Omnibus GitLab and use it to configure the PostgreSQL database. You can use an
external PostgreSQL server (version 11 or newer) but you must set it up [manually](#manual-database-setup).
Prepare all your new nodes by [installing
Prepare all your new nodes by [installing GitLab](https://about.gitlab.com/install/). You need:
GitLab](https://about.gitlab.com/install/).
- 1 PostgreSQL node
- 1 PgBouncer node (optional)
- At least 1 Praefect node (minimal storage required)
- At least 1 Praefect node (minimal storage required)
- 3 Gitaly nodes (high CPU, high memory, fast storage)
- 3 Gitaly nodes (high CPU, high memory, fast storage)
- 1 GitLab server
- 1 GitLab server
You need the IP/host address for each node.
You also need the IP/host address for each node:
1.`LOAD_BALANCER_SERVER_ADDRESS`: the IP/host address of the load balancer
1.`PRAEFECT_LOADBALANCER_HOST`: the IP/host address of Praefect load balancer
1.`POSTGRESQL_SERVER_ADDRESS`: the IP/host address of the PostgreSQL server
1.`POSTGRESQL_HOST`: the IP/host address of the PostgreSQL server
1.`PGBOUNCER_HOST`: the IP/host address of the PostgreSQL server
1.`PRAEFECT_HOST`: the IP/host address of the Praefect server
1.`PRAEFECT_HOST`: the IP/host address of the Praefect server
1.`GITALY_HOST_*`: the IP or host address of each Gitaly server
1.`GITALY_HOST_*`: the IP or host address of each Gitaly server
1.`GITLAB_HOST`: the IP/host address of the GitLab server
1.`GITLAB_HOST`: the IP/host address of the GitLab server
If you are using a cloud provider, you can look up the addresses for each server through your cloud provider's management console.
If you are using Google Cloud Platform, SoftLayer, or any other vendor that provides a virtual private cloud (VPC) you can use the private addresses for each cloud instance (corresponds to "internal address" for Google Cloud Platform) for `PRAEFECT_HOST`, `GITALY_HOST_*`, and `GITLAB_HOST`.
If you are using Google Cloud Platform, SoftLayer, or any other vendor that provides a virtual private cloud (VPC) you can use the private addresses for each cloud instance (corresponds to "internal address" for Google Cloud Platform) for `PRAEFECT_HOST`, `GITALY_HOST_*`, and `GITLAB_HOST`.
#### Secrets
#### Secrets
...
@@ -98,6 +100,14 @@ with secure tokens as you complete the setup process.
...
@@ -98,6 +100,14 @@ with secure tokens as you complete the setup process.
Praefect cluster directly; that could lead to data loss.
Praefect cluster directly; that could lead to data loss.
1.`PRAEFECT_SQL_PASSWORD`: this password is used by Praefect to connect to
1.`PRAEFECT_SQL_PASSWORD`: this password is used by Praefect to connect to
PostgreSQL.
PostgreSQL.
1.`PRAEFECT_SQL_PASSWORD_HASH`: the hash of password of the Praefect user.
Use `gitlab-ctl pg-password-md5 praefect` to generate the hash. The command
asks for the password for `praefect` user. Enter `PRAEFECT_SQL_PASSWORD`
plaintext password. By default, Praefect uses `praefect` user, but you can
change it.
1.`PGBOUNCER_SQL_PASSWORD_HASH`: the hash of password of the PgBouncer user.
PgBouncer uses this password to connect to PostgreSQL. For more details
see [bundled PgBouncer](../postgresql/pgbouncer.md) documentation.
We note in the instructions below where these secrets are required.
We note in the instructions below where these secrets are required.
...
@@ -108,63 +118,81 @@ Omnibus GitLab installations can use `gitlab-secrets.json` for `GITLAB_SHELL_SEC
...
@@ -108,63 +118,81 @@ Omnibus GitLab installations can use `gitlab-secrets.json` for `GITLAB_SHELL_SEC
NOTE:
NOTE:
Do not store the GitLab application database and the Praefect
Do not store the GitLab application database and the Praefect
database on the same PostgreSQL server if using
database on the same PostgreSQL server if using[Geo](../geo/index.md).
[Geo](../geo/index.md). The replication state is internal to each instance
The replication state is internal to each instance of GitLab and should
of GitLab and should not be replicated.
not be replicated.
These instructions help set up a single PostgreSQL database, which creates a single point of
These instructions help set up a single PostgreSQL database, which creates a single point of
failure. The following options are available:
failure. Alternatively, [you can use PostgreSQL replication and failover](../postgresql/replication_and_failover.md).
The following options are available:
- For non-Geo installations, either:
- For non-Geo installations, either:
- Use one of the documented [PostgreSQL setups](../postgresql/index.md).
- Use one of the documented [PostgreSQL setups](../postgresql/index.md).
- Use your own third-party database setup, if fault tolerance is required.
- Use your own third-party database setup. This will require [manual setup](#manual-database-setup).
- For Geo instances, either:
- For Geo instances, either:
- Set up a separate [PostgreSQL instance](https://www.postgresql.org/docs/11/high-availability.html).
- Set up a separate [PostgreSQL instance](https://www.postgresql.org/docs/11/high-availability.html).
- Use a cloud-managed PostgreSQL service. AWS
- Use a cloud-managed PostgreSQL service. AWS
[Relational Database Service](https://aws.amazon.com/rds/) is recommended.
[Relational Database Service](https://aws.amazon.com/rds/) is recommended.
#### Manual database setup
To complete this section you need:
To complete this section you need:
-1 Praefect node
-One Praefect node
-1 PostgreSQL server (PostgreSQL 11 or newer)
-One PostgreSQL node (version 11 or newer)
- An SQL user with permissions to create databases
- A PostgreSQL user with permissions to manage the database server
During this section, we configure the PostgreSQL server, from the Praefect
In this section, we configure the PostgreSQL database. This can be used for both external
node, using `psql` which is installed by Omnibus GitLab.
and Omnibus-provided PostgreSQL server.
1. SSH into the **Praefect** node and login as root:
To run the following instructions, you can use the Praefect node, where `psql` is installed
by Omnibus GitLab (`/opt/gitlab/embedded/bin/psql`). If you are using the Omnibus-provided
PostgreSQL you can use `gitlab-psql` on the PostgreSQL node instead:
```shell
1. Create a new user `praefect` to be used by Praefect:
sudo-i
```
1. Connect to the PostgreSQL server with administrative access. This is likely
the `postgres` user. The database `template1` is used because it is created