Skip to main content

Installing GitHub Enterprise Server on Google Cloud Platform

To install GitHub Enterprise Server on Google Cloud Platform, you must deploy onto a supported machine type and use a persistent standard disk or a persistent SSD.

Prerequisites

Hardware considerations

最低要求

建议根据 你的 GitHub Enterprise Server 实例 的用户许可数选择不同的硬件配置。 如果预配的资源超过最低要求,您的实例将表现出更好的性能和扩展。

用户许可证x86-64 vCPU内存根存储附加(数据)存储
试用版、演示版或 10 个轻度用户432 GB200 GB150 GB
10-3000848 GB200 GB300 GB
3000-50001264 GB200 GB500 GB
5000-80001696 GB200 GB750 GB
8000-10000+20160 GB200 GB1000 GB

如果计划为实例的用户启用 GitHub Actions,则需要更多资源。

有关这些要求的详细信息,请参阅“Getting started with GitHub Actions for GitHub Enterprise Server”。

如果计划为实例的用户启用 Container registry,则需要更多资源。 有关这些要求的详细信息,请参阅“Getting started with GitHub Packages for your enterprise”。

有关为现有实例调整资源的详细信息,请参阅“增加存储容量”和“增加 CPU 或内存资源”。

存储

我们建议为 GitHub Enterprise Server 配置具有高每秒输入/输出操作数 (IOPS) 和低延迟的高性能 SSD。 工作负载是 I/O 密集型的。 如果使用裸机管理程序,建议直接连接磁盘或使用存储区域网络 (SAN) 中的磁盘。

您的实例需要一个独立于根磁盘的持久数据磁盘。 有关详细信息,请参阅“系统概览”。

若要配置 GitHub Actions,必须提供外部 Blob 存储。 有关详细信息,请参阅“Getting started with GitHub Actions for GitHub Enterprise Server”。

根文件系统上的可用空间将占磁盘总大小的 50%。 您可以通过构建一个新实例或使用现有实例来调整实例的根磁盘大小。 有关详细信息,请参阅“系统概览”和“增加存储容量”。

CPU 和内存

GitHub Enterprise Server 需要的 CPU 和内存资源取决于用户的活动水平、自动化和集成。

为 你的 GitHub Enterprise Server 实例 预配的任何 VM 都必须使用 x86-64 CPU 体系结构。 其他体系结构(例如 Aarch64 或 arm64)均不受支持。

如果计划为 GitHub Enterprise Server 实例的用户启用 GitHub Actions,则可能需要为实例预配额外的 CPU 和内存资源。 有关详细信息,请参阅“Getting started with GitHub Actions for GitHub Enterprise Server”。

增加 CPU 资源时,GitHub建议为实例预配的每个 vCPU(最多 16 个 vCPU)增加至少 6.5 GB 的内存。 如果您使用的 vCPU 超过 16 个,则无需为每个 vCPU 添加 6.5 GB 内存,但应监控您的实例以确保其有足够的内存。

警告:建议用户配置 Web 挂钩事件来通知外部系统有关 GitHub Enterprise Server 上的活动。 自动检查更改或轮询将对实例的性能和可扩展性产生不利影响。 有关详细信息,请参阅“关于 web 挂钩”。

有关监视 GitHub Enterprise Server 的容量和性能的详细信息,请参阅“监视实例”。

您可以增加实例的 CPU 或内存资源。 有关详细信息,请参阅“增加 CPU 或内存资源”。

Determining the machine type

Before launching 你的 GitHub Enterprise Server 实例 on Google Cloud Platform, you'll need to determine the machine type that best fits the needs of your organization. To review the minimum requirements for GitHub Enterprise Server, see "Minimum requirements."

可以随时通过调整实例大小来扩展 CPU 或内存。 更改实例的可用资源需要用户安排出故障时间,因此GitHub建议预配帐户资源以进行缩放。

GitHub recommends a general-purpose, high-memory machine for GitHub Enterprise Server. For more information, see "Machine types" in the Google Compute Engine documentation.

Selecting the GitHub Enterprise Server image

  1. Using the gcloud compute command-line tool, list the public GitHub Enterprise Server images:

    gcloud compute images list --project github-enterprise-public --no-standard-images
    
  2. Take note of the image name for the latest GCE image of GitHub Enterprise Server.

Configuring the firewall

GCE virtual machines are created as a member of a network, which has a firewall. For the network associated with the GitHub Enterprise Server VM, you'll need to configure the firewall to allow the required ports listed in the table below. We recommend opening network ports selectively based on the network services you need to expose for administrative and user purposes. For more information, see "Network ports," and Firewall Rules Overview in the Google Cloud Platform documentation.

  1. Using the gcloud compute command-line tool, create the network. For more information, see gcloud compute networks create in the Google documentation.

    gcloud compute networks create NETWORK-NAME --subnet-mode auto
    
  2. Create a firewall rule for each of the ports in the table below. For more information, see gcloud compute firewall-rules in the Google documentation.

    $ gcloud compute firewall-rules create RULE-NAME \
    --network NETWORK-NAME \
    --allow tcp:22,tcp:25,tcp:80,tcp:122,udp:161,tcp:443,udp:1194,tcp:8080,tcp:8443,tcp:9418,icmp
    

    This table identifies the required ports and what each port is used for.

    端口服务说明
    22SSHGit over SSH 访问。 支持克隆、获取和推送操作到公共/私有仓库。
    25SMTP支持加密 (STARTTLS) 的 SMTP。
    80HTTPWeb 应用程序访问。 当 SSL 启用时,所有请求都会重定向到 HTTPS 端口。
    122SSH实例 shell 访问。 默认 SSH 端口 (22) 专用于应用程序 git+ssh 网络流量。
    161/UDPSNMP为网络监视协议操作所需。
    443HTTPSWeb 应用程序和 Git over HTTPS 访问。
    1194/UDPVPN采用高可用性配置的安全复制网络隧道。 使用 WireGuard 进行加密。
    8080HTTP基于纯文本 Web 的 管理控制台。 除非手动禁用 SSL,否则不需要。
    8443HTTPS基于安全 Web 的 管理控制台。 进行基本安装和配置时需要。
    9418Git简单的 Git 协议端口。 仅克隆和获取操作到公共仓库。 未加密的网络通信。 如果在实例上启用了私有模式,则仅当您也启用了匿名 Git 读取访问时才需要打开此端口。 有关详细信息,请参阅“Enforcing repository management policies in your enterprise”。

Allocating a static IP and assigning it to the VM

If this is a production appliance, we strongly recommend reserving a static external IP address and assigning it to the GitHub Enterprise Server VM. Otherwise, the public IP address of the VM will not be retained after restarts. For more information, see the Google guide Reserving a Static External IP Address.

In production High Availability configurations, both primary and replica appliances should be assigned separate static IP addresses.

Creating the GitHub Enterprise Server instance

To create the GitHub Enterprise Server instance, you'll need to create a GCE instance with your GitHub Enterprise Server image and attach an additional storage volume for your instance data. For more information, see "Hardware considerations."

  1. Using the gcloud compute command-line tool, create a data disk to use as an attached storage volume for your instance data, and configure the size based on your user license count. For more information, see gcloud compute disks create in the Google documentation.

    gcloud compute disks create DATA-DISK-NAME --size DATA-DISK-SIZE --type DATA-DISK-TYPE --zone ZONE
    
  2. Then create an instance using the name of the GitHub Enterprise Server image you selected, and attach the data disk. For more information, see gcloud compute instances create in the Google documentation.

    $ gcloud compute instances create INSTANCE-NAME \
    --machine-type n1-standard-8 \
    --image GITHUB-ENTERPRISE-IMAGE-NAME \
    --disk name=DATA-DISK-NAME \
    --metadata serial-port-enable=1 \
    --zone ZONE \
    --network NETWORK-NAME \
    --image-project github-enterprise-public
    

Configuring the instance

若要配置实例,必须上传许可证文件,设置 根管理控制台 密码,配置实例的设置,然后重启实例。

警告****:若要防止攻击者破坏新实例,请确保亲自设置 root 管理控制台 密码并尽快创建首个用户。

  1. 复制虚拟机的公共 DNS 名称,然后将其粘贴到 web 浏览器中。
  2. 在提示时上传许可文件并设置管理控制台密码。 有关详细信息,请参阅“管理 GitHub Enterprise 的许可证”。
  3. 管理控制台 中,配置并保存所需的设置。 For more information, see "Configuring GitHub Enterprise."
  4. 实例将自动重启。
  5. 单击“访问实例”。

Further reading