## Using Private Images for TiUP Mirror
This document provides instructions on how to build a private TiUP mirror for local development and offline deployments.
**Key Concepts:**
* **TiUP Mirror:** A repository that stores and manages components for TiUP, including databases, KV, and plugins.
* **Private Image:** A customized mirror that contains the components specific to your environment.
* **Local Mirror:** A mirror that you build and manage locally.
**Using Private Images:**
1. **Create a Private Mirror:** Use the `tiup mirror` command to create a new private mirror.
2. **Configure the Private Mirror:** Set the `TIUP_MIRRORS` environment variable to point to the location of your private mirror repository.
3. **Start the Mirror:** Run the `tiup mirror` command to start the mirror and download the necessary components.
4. **Verify the Mirror:** Use the `tiup mirror list` command to verify that the mirror is running and contains the expected components.
**Creating a Custom Private Image:**
1. **Build the Components:** Use the `tiup package` command to build a custom TiDB component.
2. **Create a Private Key:** Use the `tiup mirror genkey` command to generate a private key for the custom component.
3. **Set Permissions:** Use the `tiup mirror set` command to set permissions for the private key.
4. **Create a Custom Repository:** Use the `tiup mirror init` command to create a new mirror for the custom component.
5. **Add the Private Key:** Use the `tiup mirror grant` command to grant the private key to the new mirror.
**Using a Private Image:**
1. **Download and Extract the Image:** Use the `tiup mirror publish` command to download the custom component and extract it to a specific location.
2. **Start the Mirror:** Run the `tiup mirror` command to start the mirror using the private image.
3. **Verify the Mirror:** Use the `tiup mirror list` command to verify that the mirror is running and contains the custom component.
**Additional Points:**
* Use the `~/.tiup/keys/private.json` file to store and manage private keys.
* You can create custom repositories with different component versions and configurations.
* You can merge multiple private repositories into a single one.
* Use the `tiup mirror merge` command to merge a custom repository into an existing one.
The `mirror` command is used to manage a component repository for TiUP, you can use it to create a private repository, or to add new component to an existing repository. The repository can be used either online or offline. It also provides some useful utilities to help manage keys, users, and versions of components or the repository itself. Usage: tiup mirror <command> [flags] Available Commands: init Initialize an empty repository sign Add signatures to a manifest file genkey Generate a new key pair clone Clone a local mirror from remote mirror and download all selected components merge Merge two or more offline mirrors publish Publish a component show Show the mirror address set Set mirror address modify Modify published component renew Renew the manifest of a published component. grant grant a new owner rotate Rotate root.json Flags: -h, --help help for mirror --repo string Path to the repository Global Flags: --help Help for this command Use "tiup mirror [command] --help" for more information about a command.
The component `hello` version is not installed; downloading from repository. Starting component `hello`: /home/dvaneeden/.tiup/components/hello/v0.0.1/hello hello