mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-18 04:41:26 +01:00
update installation guide
This commit is contained in:
parent
32b31f3f7d
commit
f8db6c6cf6
@ -1,16 +1,13 @@
|
||||
# Installation and Configuration Guide
|
||||
Harbor can be installed by one of three approaches:
|
||||
Harbor can be installed by one of two approaches:
|
||||
|
||||
- **Online installer:** The installer downloads Harbor's images from Docker hub. For this reason, the installer is very small in size.
|
||||
|
||||
- **Offline installer:** Use this installer when the host does not have an Internet connection. The installer contains pre-built images so its size is larger.
|
||||
|
||||
- **Virtual Appliance:** If you are installing Harbor as the registry component of vSphere Integrated Containers (VIC), or using Harbor as a standalone registry on vSphere platform, download the OVA version of Harbor.
|
||||
|
||||
All installers can be downloaded from the **[official release](https://github.com/vmware/harbor/releases)** page.
|
||||
|
||||
To install Harbor's virtual appliance, refer to the **[Harbor Installation Guide for Virtual Appliance](installation_guide_ova.md)**.
|
||||
|
||||
This guide describes the steps to install and configure Harbor by using the online or offline installer. The installation processes are almost the same.
|
||||
|
||||
If you run a previous version of Harbor, you may need to migrate the data to fit the new database schema. For more details, please refer to **[Data Migration Guide](migration_guide.md)**.
|
||||
@ -47,10 +44,25 @@ Offline installer:
|
||||
|
||||
#### Configuring Harbor
|
||||
Configuration parameters are located in the file **harbor.cfg**.
|
||||
|
||||
There are two categories of parameters in harbor.cfg, **required parameters** and **optional parameters**.
|
||||
* **required parameters**: These parameters are required to be set in the configuration file, and they will take effect if user updates them in harbor.cfg, rerun the ```install.sh``` script to reinstall Harbor.
|
||||
* **optional parameters**: These parameters are optional, and only take effect in the initial installation, user can leave them empty and update them on UI after Harbor is started, subsequential update to these parameters in ```harbor.cfg``` will be ignored.
|
||||
|
||||
The parameters are described below - note that at the very least, you will need to change the **hostname** attribute.
|
||||
|
||||
##### Required parameters:
|
||||
|
||||
* **hostname**: The target host's hostname, which is used to access the UI and the registry service. It should be the IP address or the fully qualified domain name (FQDN) of your target machine, e.g., `192.168.1.10` or `reg.yourdomain.com`. _Do NOT use `localhost` or `127.0.0.1` for the hostname - the registry service needs to be accessible by external clients!_
|
||||
* **ui_url_protocol**: (**http** or **https**. Default is **http**) The protocol used to access the UI and the token/notification service. By default, this is _http_. To set up the https protocol, refer to **[Configuring Harbor with HTTPS Access](configure_https.md)**.
|
||||
* **db_password**: The root password for the MySQL database used for **db_auth**. _Change this password for any production use!_
|
||||
* **max_job_workers**: (default value is **3**) The maximum number of replication workers in job service. For each image replication job, a worker synchronizes all tags of a repository to the remote destination. Increasing this number allows more concurrent replication jobs in the system. However, since each worker consumes a certain amount of network/CPU/IO resources, please carefully pick the value of this attribute based on the hardware resource of the host.
|
||||
* **customize_crt**: (**on** or **off**. Default is **on**) When this attribute is **on**, the prepare script creates private key and root certificate for the generation/verification of the registry's token. Set this attribute to **off** when the key and root certificate are supplied by external sources. Refer to [Customize Key and Certificate of Harbor Token Service](customize_token_service.md) for more info.
|
||||
* **ssl_cert**: The path of SSL certificate, it's applied only when the protocol is set to https
|
||||
* **ssl_cert_key**: The path of SSL key, it's applied only when the protocol is set to https
|
||||
* **secretkey_path**: The path of key for encrypt or decrypt the password of a remote registry in a replication policy.
|
||||
|
||||
##### Optional parameters
|
||||
* **Email settings**: These parameters are needed for Harbor to be able to send a user a "password reset" email, and are only necessary if that functionality is needed. Also, do note that by default SSL connectivity is _not_ enabled - if your SMTP server requires SSL, but does _not_ support STARTTLS, then you should enable SSL by setting **email_ssl = true**.
|
||||
* email_server = smtp.mydomain.com
|
||||
* email_server_port = 25
|
||||
@ -68,16 +80,10 @@ The parameters are described below - note that at the very least, you will need
|
||||
* **ldap_filter**:The search filter for looking up a user, e.g. `(objectClass=person)`.
|
||||
* **ldap_uid**: The attribute used to match a user during a LDAP search, it could be uid, cn, email or other attributes.
|
||||
* **ldap_scope**: The scope to search for a user, 1-LDAP_SCOPE_BASE, 2-LDAP_SCOPE_ONELEVEL, 3-LDAP_SCOPE_SUBTREE. Default is 3.
|
||||
* **db_password**: The root password for the MySQL database used for **db_auth**. _Change this password for any production use!_
|
||||
* **self_registration**: (**on** or **off**. Default is **on**) Enable / Disable the ability for a user to register themselves. When disabled, new users can only be created by the Admin user, only an admin user can create new users in Harbor. _NOTE: When **auth_mode** is set to **ldap_auth**, self-registration feature is **always** disabled, and this flag is ignored._
|
||||
* **use_compressed_js**: (**on** or **off**. Default is **on**) For production use, turn this flag to **on**. In development mode, set it to **off** so that js files can be modified separately.
|
||||
* **max_job_workers**: (default value is **3**) The maximum number of replication workers in job service. For each image replication job, a worker synchronizes all tags of a repository to the remote destination. Increasing this number allows more concurrent replication jobs in the system. However, since each worker consumes a certain amount of network/CPU/IO resources, please carefully pick the value of this attribute based on the hardware resource of the host.
|
||||
* **secretkey_path**: The path of key for encrypt or decrypt the password of a remote registry in a replication policy.
|
||||
|
||||
* **token_expiration**: The expiration time (in minutes) of a token created by token service, default is 30 minutes.
|
||||
|
||||
* **project_creation_restriction**: The flag to control what users have permission to create projects. By default everyone can create a project, set to "adminonly" such that only admin can create project.
|
||||
* **verify_remote_cert**: (**on** or **off**. Default is **on**) This flag determines whether or not to verify SSL/TLS certificate when Harbor communicates with a remote registry instance. Setting this attribute to **off** bypasses the SSL/TLS verification, which is often used when the remote instance has a self-signed or untrusted certificate.
|
||||
* **customize_crt**: (**on** or **off**. Default is **on**) When this attribute is **on**, the prepare script creates private key and root certificate for the generation/verification of the registry's token. The following attributes:**crt_country**, **crt_state**, **crt_location**, **crt_organization**, **crt_organizationalunit**, **crt_commonname**, **crt_email** are used as parameters for generating the keys. Set this attribute to **off** when the key and root certificate are supplied by external sources. Refer to [Customize Key and Certificate of Harbor Token Service](customize_token_service.md) for more info.
|
||||
|
||||
#### Configuring storage backend (optional)
|
||||
|
||||
@ -104,6 +110,9 @@ _NOTE: For detailed information on storage backend of a registry, refer to [Regi
|
||||
#### Finishing installation and starting Harbor
|
||||
Once **harbor.cfg** and storage backend (optional) are configured, install and start Harbor using the ```install.sh``` script. Note that it may take some time for the online installer to download Harbor images from Docker hub.
|
||||
|
||||
##### Default installation
|
||||
After version 1.1.0, Harbor has integrated with Notary, but by default the installation does not include notary support.
|
||||
|
||||
```sh
|
||||
$ sudo ./install.sh
|
||||
```
|
||||
@ -117,6 +126,16 @@ $ docker push reg.yourdomain.com/myproject/myrepo:mytag
|
||||
```
|
||||
**IMPORTANT:** The default installation of Harbor uses _HTTP_ - as such, you will need to add the option `--insecure-registry` to your client's Docker daemon and restart the Docker service.
|
||||
|
||||
##### Installation with Notary
|
||||
To install Harbor with Notary support, add a parameter when you run ```install.sh```
|
||||
```sh
|
||||
$ sudo ./install.sh --with-notary
|
||||
```
|
||||
**Note**: For installation with Notary the parameter "ui_url_protocol" must be set to "https", for configuring HTTPS certificate please refer to the following sections.
|
||||
|
||||
More information about Notary and Docker Content Trust, please refer to docker's documentation:
|
||||
https://docs.docker.com/engine/security/trust/content_trust/
|
||||
|
||||
For information on how to use Harbor, please refer to **[User Guide of Harbor](user_guide.md)** .
|
||||
|
||||
#### Configuring Harbor with HTTPS access
|
||||
@ -149,7 +168,7 @@ Starting proxy ... done
|
||||
|
||||
To change Harbor's configuration, first stop existing Harbor instance, update harbor.cfg, and then run install.sh again:
|
||||
```
|
||||
$ sudo docker-compose down
|
||||
$ sudo docker-compose down -v
|
||||
|
||||
$ vim harbor.cfg
|
||||
|
||||
@ -158,7 +177,7 @@ $ sudo install.sh
|
||||
|
||||
Removing Harbor's containers while keeping the image data and Harbor's database files on the file system:
|
||||
```
|
||||
$ sudo docker-compose down
|
||||
$ sudo docker-compose down -v
|
||||
```
|
||||
|
||||
Removing Harbor's database and image data (for a clean re-installation):
|
||||
@ -167,6 +186,11 @@ $ rm -r /data/database
|
||||
$ rm -r /data/registry
|
||||
```
|
||||
|
||||
**Note** When Harbor is installed with Notary, user needs to add extra template file to docker-compose command, so the docker-compose commands to manage the lifecycle of Harbor will be:
|
||||
```
|
||||
sudo docker-compose -f ./docker-compose.yml -f ./docker-compose.notary.yml [ up|down|stop|start ]
|
||||
```
|
||||
|
||||
Please check the [Docker Compose command-line reference](https://docs.docker.com/compose/reference/) for more on docker-compose.
|
||||
|
||||
### Persistent data and log files
|
||||
@ -260,7 +284,7 @@ auth:
|
||||
|
||||
4.Run install.sh to update and start Harbor.
|
||||
```sh
|
||||
$ sudo docker-compose down
|
||||
$ sudo docker-compose down -v
|
||||
$ sudo install.sh
|
||||
```
|
||||
|
||||
@ -286,7 +310,7 @@ proxy_set_header X-Forwarded-Proto $scheme;
|
||||
```
|
||||
And run the following commands to restart Harbor:
|
||||
```sh
|
||||
$ sudo docker-compose down
|
||||
$ sudo docker-compose down -v
|
||||
$ sudo ./prepare
|
||||
$ sudo docker-compose up -d
|
||||
```
|
Loading…
Reference in New Issue
Block a user