Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-06-03. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

Quickstart for configuring your MinIO storage bucket for GitHub Packages

Configure your custom MinIO storage bucket for use with GitHub Packages.

Before you can enable and configure GitHub Packages on 您的 GitHub Enterprise Server 实例, you need to prepare your third-party storage solution.

MinIO offers object storage with support for the S3 API and GitHub Packages on your enterprise.

This quickstart shows you how to set up MinIO using Docker for use with GitHub Packages but you have other options for managing MinIO besides Docker. For more information about MinIO, see the official MinIO docs.

1. Choose a MinIO mode for your needs

MinIO modeOptimized forStorage infrastructure required
Standalone MinIO (on a single host)Fast setupN/A
MinIO as a NAS gatewayNAS (Network-attached storage)NAS devices
Clustered MinIO (also called Distributed MinIO)Data securityStorage servers running in a cluster

For more information about your options, see the official MinIO docs.

Warning: MinIO has announced removal of MinIO Gateways. Starting June 1st, 2022, support and bug fixes for the current MinIO NAS Gateway implementation will only be available for paid customers via their LTS support contract. If you want to continue using MinIO Gateways with GitHub Packages, we recommend moving to MinIO LTS support. For more information, see Scheduled removal of MinIO Gateway for GCS, Azure, HDFS in the minio/minio repository.

Other modes of MinIO remain available with standard support.

2. Install, run, and sign in to MinIO

  1. Set up your preferred environment variables for MinIO.

    These examples use MINIO_DIR:

    $ export MINIO_DIR=$(pwd)/minio
    $ mkdir -p $MINIO_DIR
  2. Install MinIO.

    $ docker pull minio/minio

    For more information, see the official "MinIO Quickstart Guide."

  3. Sign in to MinIO using your MinIO access key and secret.

    $ export MINIO_ACCESS_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
    # this one is actually a secret, so careful
    $ export MINIO_SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
    $ export MINIO_ACCESS_KEY=$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
    # this one is actually a secret, so careful
    $ export MINIO_SECRET_KEY=$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)

    You can access your MinIO keys using the environment variables:

    $ echo $MINIO_ACCESS_KEY
    $ echo $MINIO_SECRET_KEY
  4. Run MinIO in your chosen mode.

    • Run MinIO using Docker on a single host:

      $ docker run -p 9000:9000 \
              -v $MINIO_DIR:/data \
              -e "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
              -e "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
              minio/minio server /data

      For more information, see "MinIO Docker Quickstart guide."

    • Run MinIO using Docker as a NAS gateway:

      This setup is useful for deployments where there is already a NAS you want to use as the backup storage for GitHub Packages.

      $ docker run -p 9000:9000 \
              -v $MINIO_DIR:/data \
              -e "MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY" \
              -e "MINIO_SECRET_KEY=$MINIO_SECRET_KEY" \
              minio/minio gateway nas /data

      For more information, see "MinIO Gateway for NAS."

    • Run MinIO using Docker as a cluster. This MinIO deployment uses several hosts and MinIO's erasure coding for the strongest data protection. To run MinIO in a cluster mode, see the "Distributed MinIO Quickstart Guide.

3. Create your MinIO bucket for GitHub Packages

  1. Install the MinIO client.

    $ docker pull minio/mc
  2. Create a bucket with a host URL that GitHub Enterprise Server can access.

    • Local deployments example:

      $ export MC_HOST_minio="http://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY} @localhost:9000"
      $ docker run minio/mc BUCKET-NAME

      This example can be used for MinIO standalone or MinIO as a NAS gateway.

    • Clustered deployments example:

      $ export MC_HOST_minio="http://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY} @minioclustername.example.com:9000"
      $ docker run minio/mc mb packages

Next steps

To finish configuring storage for GitHub Packages, you'll need to copy the MinIO storage URL:

echo "http://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY}@minioclustername.example.com:9000"

For the next steps, see "Enabling GitHub Packages with MinIO."