Geo | GitLab Docs (original) (raw)

Geo is the solution for widely distributed development teams and for providing a warm-standby as part of a disaster recovery strategy. Geo is not an out of the box HA solution.

Geo undergoes significant changes from release to release. Upgrades are supported and documented, but you should ensure that you’re using the right version of the documentation for your installation.

To make sure you’re using the right version of the documentation, go to the Geo page on GitLab.com and choose the appropriate release from the Switch branch/tag dropdown list. For example, v15.7.6-ee.

Fetching large repositories can take a long time for teams and runners located far from a single GitLab instance.

Geo provides local caches that can be placed geographically close to remote teams which can serve read requests. This can reduce the time it takes to clone and fetch large repositories, speeding up development and increasing the productivity of your remote teams.

Geo secondary sites transparently proxy write requests to the primary site. All Geo sites can be configured to respond to a single GitLab URL, to deliver a consistent, seamless, and comprehensive experience whichever site the user lands on.

Geo uses a set of defined terms that are described in the Geo Glossary. Be sure to familiarize yourself with those terms.

Use cases

Implementing Geo addresses several use cases. This section provides some of the intended use cases and highlights their benefits.

Regional disaster recovery

Geo as a disaster recovery solution gives you a warm-standby secondary site in a different region from your primary site. Data is continuously synchronized to the secondary site ensuring it is always up to date. In the event of a disaster, such as data center or network outage or hardware failure, you can failover to a fully operational secondary site. You can test your disaster recovery processes and infrastructure with planned failovers.

Benefits:

Remote team acceleration

Establish Geo secondary sites geographically closer to your remote teams to provide local caches that accelerate read operations. You can have multiple Geo secondary sites, each tailored to synchronize only the projects your remote teams need. Transparent proxying and geographic routing with unified URL ensures a consistent and seamless developer experience.

Benefits:

CI/CD traffic offload

You can configure your CI/CD runners to clone from Geo secondary sites. You can tailor your secondary sites to match the needs of the runner workload and don’t need to mirror the primary site. Supported read requests are served with cached data on the secondary site, and requests are transparently forwarded to the primary site when the data on the secondary site is stale or not available.

Benefits:

Additional use cases

Infrastructure migrations

You can use Geo to migrate to new infrastructure. If you move your GitLab instance to a new server or data center, use Geo to migrate your GitLab data to the new instance in the background while your old instance continues to serve your users. Any changes to your active GitLab data are copied to your new instance, so there’s no data loss during the cutover.

You cannot use Geo to migrate a PostgreSQL database from one operating system to another. See Upgrading operating systems for PostgreSQL.

Benefits:

Migration to GitLab Dedicated

You can also use Geo to migrate GitLab Self-Managed to GitLab Dedicated. A migration to GitLab Dedicated is similar to an infrastructure migration.

Benefits:

What Geo is not designed to address

Geo is not designed to address every use case. This section provides examples of use cases where Geo is not an appropriate solution.

Enforce data export compliance

While Geo’s selective synchronization functionality allows you to restrict projects that are synchronized to secondary sites, it was designed to reduce cross-region traffic and storage requirements, not to enforce export compliance. You must independently determine your legal obligations with regard to privacy, cybersecurity, and applicable trade control laws on an ongoing basis based on solution and documentation. Both the solution and the documentation are subject to change.

Provide access control

Geo read-only secondary site functionality is not a first-class feature, and might not be supported in the future. You should not rely on this functionality for access control purposes. GitLab provides authentication and authorization controls that better serve this purpose.

An alternative to zero downtime upgrades

Geo is a not a solution for zero downtime upgrades. You must upgrade the primary Geo site before upgrading secondary sites.

Protect against malicious or unintentional corruption

Geo replicates corruption on the primary site to all secondary sites. To protect against malicious or unintentional corruption you should complement Geo with backups.

Active-active, high-availability configuration

Geo is designed to be a active-passive, high-availability solution. It operates an eventually consistent synchronization model which means that secondary sites are not tightly synchronized with the primary site. Secondary sites follow the primary with a small delay, which can result in a small amount of data loss after a disaster. Failover to a secondary site in the event of a disaster requires human intervention. However, large parts of the process of promoting a secondary site to become a primary is automated by the GitLab Environment Toolkit (GET), provided you deploy all your sites using GET.

Gitaly Cluster

Geo should not be confused with Gitaly Cluster. For more information about the difference between Geo and Gitaly Cluster, see Comparison to Geo.

How it works

This is a brief summary of how Geo works in your GitLab environment. For more details, see the Geo development documentation.

Your Geo instance can be used for cloning and fetching projects, in addition to reading any data. This makes working with large repositories over large distances much faster.

Geo overview

When Geo is enabled, the:

Keep in mind that:

Architecture

The following diagram illustrates the underlying architecture of Geo.

Geo architecture

In this diagram:

From the perspective of a user performing Git operations:

From the perspective of a user browsing the GitLab UI, or using the API:

To simplify the diagram, some necessary components are omitted.

A secondary site needs two different PostgreSQL databases:

The secondary sites also run an additional daemon: Geo Log Cursor.

Requirements for running Geo

The following are required to run Geo:

Additionally, check the GitLab minimum requirements, and use the latest version of GitLab for a better experience.

Firewall rules

The following table lists basic ports that must be open between the primary and secondary sites for Geo. To simplify failovers, you should open ports in both directions.

Source site Source port Destination site Destination port Protocol
Primary Any Secondary 80 TCP (HTTP)
Primary Any Secondary 443 TCP (HTTPS)
Secondary Any Primary 80 TCP (HTTP)
Secondary Any Primary 443 TCP (HTTPS)
Secondary Any Primary 5432 TCP

See the full list of ports used by GitLab in Package defaults

Web terminal support requires your load balancer to correctly handle WebSocket connections. When using HTTP or HTTPS proxying, your load balancer must be configured to pass through the Connection and Upgrade hop-by-hop headers. See the web terminal integration guide for more details.

When using HTTPS protocol for port 443, you must add an SSL certificate to the load balancers. If you wish to terminate SSL at the GitLab application server instead, use TCP protocol.

If you are only using HTTPS for external/internal URLs, it is not necessary to open port 80 in the firewall.

Internal URL

HTTP requests from any Geo secondary site to the primary Geo site use the Internal URL of the primary Geo site. If this is not explicitly defined in the primary Geo site settings in the Admin area, the public URL of the primary site is used.

To update the internal URL of the primary Geo site:

  1. On the left sidebar, at the bottom, select Admin.
  2. Select Geo > Sites.
  3. Select Edit on the primary site.
  4. Change the Internal URL, then select Save changes.

Geo Tracking Database

The tracking database instance is used as metadata to control what needs to be updated on the local instance. For example:

Because the replicated database instance is read-only, we need this additional database instance for each secondary site.

Geo Log Cursor

This daemon:

When something is marked to be updated in the tracking database instance, asynchronous jobs running on the secondary site execute the required operations and update the state.

This new architecture allows GitLab to be resilient to connectivity issues between the sites. It doesn’t matter how long the secondary site is disconnected from the primary site as it is able to replay all the events in the correct order and become synchronized with the primary site again.

Known issues

These known issues reflect only the latest version of GitLab. If you are using an older version, additional issues might exist.

Replicated data types

There is a complete list of all GitLab data types andreplicated data types.

Post-installation documentation

After installing GitLab on the secondary sites and performing the initial configuration, see the following documentation for post-installation information.

Setting up Geo

For information on configuring Geo, see Set up Geo.

Configuring Geo with Object Storage

For information on configuring Geo with Object storage, see Geo with Object storage.

Replicating the container registry

For more information on how to replicate the container registry, see Container registry for a secondary site.

Set up a unified URL for Geo sites

For an example of how to set up a single, location-aware URL with AWS Route53 or Google Cloud DNS, see Set up a unified URL for Geo sites.

Single Sign On (SSO)

For more information on configuring Single Sign-On (SSO), see Geo with Single Sign-On (SSO).

LDAP

For more information on configuring LDAP, see Geo with Single Sign-On (SSO) > LDAP.

Tuning Geo

For more information on tuning Geo, see Tuning Geo.

Pausing and resuming replication

For more information, see Pausing and resuming replication.

Backfill

When a secondary site is set up, it starts replicating missing data from the primary site in a process known as backfill. You can monitor the synchronization process on each Geo site from the primary site’s Geo Nodesdashboard in your browser.

Failures that happen during a backfill are scheduled to be retried at the end of the backfill.

Runners

Upgrading Geo

For information on how to update your Geo sites to the latest GitLab version, see Upgrading the Geo sites.

Security Review

For more information on Geo security, see Geo security review.

Remove Geo site

For more information on removing a Geo site, see Removing secondary Geo sites.

Disable Geo

To find out how to disable Geo, see Disabling Geo.

Log files

Geo stores structured log messages in a geo.log file.

For more information on how to access and consume Geo logs, see the Geo section in the log system documentation.

Disaster Recovery

For information on using Geo in disaster recovery situations to mitigate data-loss and restore services, see Disaster Recovery.

Frequently Asked Questions

For answers to common questions, see the Geo FAQ.

Troubleshooting