|
| 1 | +# Atomic Registry managed by systemd |
| 2 | + |
| 3 | +http://docs.projectatomic.io/registry/ |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +1. Install |
| 8 | + |
| 9 | + sudo atomic install projectatomic/atomic-registry-install <hostname> |
| 10 | + |
| 11 | +1. Start system services |
| 12 | + |
| 13 | + sudo systemctl start atomic-registry-master.service |
| 14 | + |
| 15 | +1. Setup the registry. This script creates the oauth client so the web console can connect. It also configures the registry service account so it can connect to the API master. |
| 16 | + |
| 17 | + sudo /var/run/setup-atomic-registry.sh <hostname> |
| 18 | + |
| 19 | +1. Until the registry is secured with TLS certificates, configure client docker daemon to **--insecure-registry** and restart. |
| 20 | + |
| 21 | + /etc/sysconfig/docker |
| 22 | + sudo systemctl restart docker.service |
| 23 | + |
| 24 | +**Optional post-install configuration:** |
| 25 | +* configure authentication provider. **NOTE**: by default *ANY* username and password will authenticate users. |
| 26 | +* configure storage |
| 27 | + * mount local storage **/var/lib/atomic-registry/registry** or |
| 28 | + * configure cloud storage in **/etc/atomic-registry/registry/config.yml** |
| 29 | +* add TLS certificates to services (see below) |
| 30 | + |
| 31 | +## Uninstall |
| 32 | + |
| 33 | +* Uninstall but **retain data** in /var/lib/atomic-registry. This will remove all configuration changes, etc. You can run install steps again and existing data will be available in the new deployment configuration. |
| 34 | + |
| 35 | + sudo atomic install projectatomic/atomic-registry-install |
| 36 | +* Uninstall and **remove data** in /var/lib/atomic-registry. This will remove all images and the datastore. This will completely clean up the environment. |
| 37 | + |
| 38 | + sudo atomic install projectatomic/atomic-registry-install --remove-data |
| 39 | + |
| 40 | +## Services |
| 41 | + |
| 42 | +| Service and container name | Role | Configuration | Data | Port | |
| 43 | +| -------------------------- | ---- | ------------- | ---- | ---- | |
| 44 | +| atomic-registry-master | auth, datastore, API | General config, incl auth: /etc/atomic-registry/master/master-config.yaml, Log level: /etc/sysconfig/atomic-registry-master | datastore: /var/lib/atomic-registry/etcd | 8443 | |
| 45 | +| atomic-registry | docker registry | /etc/sysconfig/atomic-registry, /etc/atomic-registry/registry/config.yml | images: /var/lib/atomic-registry/registry | 5000 | |
| 46 | +| atomic-registry-console | web console | /etc/sysconfig/atomic-registry-console | none (stateless) | 9090 | |
| 47 | + |
| 48 | +## Changing configuration |
| 49 | + |
| 50 | +1. Edit appropriate configuration file(s) on host |
| 51 | +1. Restart service via systemd |
| 52 | + |
| 53 | + sudo systemctl restart <service_name> |
| 54 | + |
| 55 | +## Updating |
| 56 | + |
| 57 | +As a microservice application the three services may theoretically be updated independently. However, it is strongly recommended that the services be updated together to ensure you are deploying a tested configuration. |
| 58 | + |
| 59 | +1. Pull the updated images |
| 60 | + |
| 61 | + sudo docker pull openshift/origin |
| 62 | + sudo docker pull openshift/origin-docker-registry |
| 63 | + sudo docker pull cockpit/kubernetes |
| 64 | +1. Restart the services |
| 65 | + |
| 66 | + sudo systemctl restart atomic-registry-console |
| 67 | + sudo systemctl restart atomic-registry-master |
| 68 | + sudo systemctl restart atomic-registry |
| 69 | + |
| 70 | +## Data persistence and backup |
| 71 | + |
| 72 | + The data that should be persisted is the configuration, image data and the registry database. These are mounted on the host. See Service table above for specific paths. |
| 73 | + |
| 74 | +## Secure Registry endpoint |
| 75 | + |
| 76 | +Here we create a self-signed certificate so docker clients can connect using TLS. While other tools like openssl may be used to create certificates, the master API provides a tool that may also be used. |
| 77 | + |
| 78 | +1. `sudo docker exec -it atomic-registry-master bash` |
| 79 | +1. `cd /etc/atomic-registry/master` |
| 80 | +1. `oadm ca create-server-cert --signer-cert=ca.crt --signer-key=ca.key --signer-serial=ca.serial.txt --hostnames='<hostname(s)>' --cert=registry.crt --key=registry.key` |
| 81 | +1. `exit` |
| 82 | +1. `sudo cp /etc/atomic-registry/master/registry.* /etc/atomic-registry/registry/` |
| 83 | +1. `sudo chown -R 1001:root /etc/atomic-registry/registry/` |
| 84 | +1. Edit `/etc/sysconfig/atomic-registry`, uncomment environment variables *REGISTRY_HTTP_TLS_CERTIFICATE* and *REGISTRY_HTTP_TLS_KEY*. |
| 85 | +1. `sudo systemctl restart atomic-registry` |
| 86 | + |
| 87 | +### Serving the certificate for docker clients |
| 88 | + |
| 89 | +If you're creating a self-signed certificate key pair you want to make the public CA certificate available to end-users so they don't have to put docker into insecure mode. |
| 90 | + |
| 91 | +1. Edit `/etc/atomic-registry/master/master-config.yaml` and add the following extension. |
| 92 | + |
| 93 | + assetConfig: |
| 94 | + ... |
| 95 | + extensions: |
| 96 | + - name: certs |
| 97 | + sourceDirectory: /etc/atomic-registry/master/site |
| 98 | +1. `sudo cp /etc/atomic-registry/master/ca.crt /etc/atomic-registry/master/site/` |
| 99 | +1. `sudo systemctl restart atomic-registry-master` |
| 100 | +1. Clients may then save this cert into their docker client and restart the docker daemon |
| 101 | + |
| 102 | + curl --insecure -O https://<registry_hostname>:8443/console/extensions/certs/ca.crt |
| 103 | + sudo cp ca.crt /etc/docker/certs.d/<registry_hostname>:5000/. |
| 104 | + sudo systemctl restart docker.service |
0 commit comments