Synology DS218+ deploys Harbor (1.10.3)

Welcome to my GitHub

https://github.com/zq2599/blog_demos
content: classification summary of all original articles and supporting source code, involving Java, Docker, Kubernetes, DevOPS, etc.;

Cause is laziness

Recently tossing about docker at home, I need a private mirror warehouse harbor. The usual practice is to turn on the computer, start the harbor, and then turn off the computer when it is used up. I always find these operations to be troublesome (Do you want to call me lazy? You are right...)

Synology solves troubles

  1. There is a Synology DS218+ at home, which never shuts down and provides stable picture and video services for the whole family. Maven private server and MySQL have been deployed on it before, and it runs very stably. Let’s deploy harbor on it today, and you can always use it in the future. Use it as you want, it's a lazy savior.
  2. The picture below shows the appearance of DS218+ just bought. Two NAS hard drives have been in stable service:
    Insert picture description here
  3. The following picture is the memory module purchased online. Now there are a total of 2+8=10G memory. Adequate memory is the confidence to dare to toss:
    Insert picture description here

Previous link

Previous record of tossing Group Hui:

  1. Synology DS218+ deploys mysql
  2. Synology DS218+ deploys kafka
  3. Synology DS218+ do maven private server (nexus3)
  4. K8S uses Synology DS218+ NFS

Ideas

In fact, the operation is very simple: the deployment of harbor is based on docker-compose, and Synology already has docker-compose. Just follow the official deployment guide. The following points should be noted:

  1. Administrator rights are required in the deployment script, so it is not operated on the web page, but SSH login to the background to operate;
  2. If you use it at home, you don’t need https, just use http;

Environmental information

  1. Synology System: DSM 6.2.2-24922 Update 4
  2. harbor:1.10.3

Allow SSH login

First, you must set to allow SSH background login:

  1. The operation in the red box as shown below:
    Insert picture description here
  2. As shown in the figure below, check the Enable SSH function and use 22 as the port:
    Insert picture description here
  3. Now you can log in to Synology with the SSH terminal. I used Xshell6 to log in on a windows computer. You can choose any SSH terminal tool. The account password is the account password that can log in to Synology. As shown in the figure below, after logging in, you can Use the daily linux commands:
    Insert picture description here
  4. Pay attention to the red box in the figure above, the home directory of the login account is /var/services/homes/zq2599

Deploy harbor

  1. Execute the following script to create the necessary directories and download and decompress the harbor installation package:
mkdir ~/harbor-1.10.3 \
&& mkdir ~/harbor-1.10.3/log \
&& mkdir ~/harbor-1.10.3/data \
&& mkdir ~/harbor-1.10.3/data/secret \
&& cd ~/harbor-1.10.3 \
&& wget https://github.com/goharbor/harbor/releases/download/v1.10.3/harbor-online-installer-v1.10.3.tgz \
&& tar -zxvf harbor-online-installer-v1.10.3.tgz \
&& mkdir -p ~/harbor-1.10.3/harbor/common/config
  1. Open the file ~/harbor-1.10.3/harbor/harbor.yml , there are the following points that need to be modified;
  2. Modify hostname , use domain name if there is a domain name, otherwise change to IP address:
    Insert picture description here
  3. Choose an unoccupied port as the http port, here I use 5888
    Insert picture description here
  4. If you do not plan to use https, you must comment all the https configuration:
    Insert picture description here
  5. Modify the location of the stored data, note that /var/services/homes/zq2599 is the home directory of the current account:
    Insert picture description here
  6. Modify the log storage path, this folder was created before:
    Insert picture description here
  7. After modifying the configuration, save;
  8. Execute preparation commands:
cd ~/harbor-1.10.3/harbor \
&& sudo ./prepare
  1. start installation:
cd ~/harbor-1.10.3/harbor \
&& sudo ./install.sh
  1. The console output of a successful operation is as follows:
    Insert picture description here

Browser login harbor

  1. Open the browser, visit the address http://192.168.50.43:5888 , account admin , password Harbor12345
    Insert picture description here
  2. The login is successful as shown below, and Synology Space is still abundant:
    Insert picture description here

Use harbor

  1. The next operation is to remotely push the image to the harbor machine from another Linux computer (hereinafter referred to as computer A);
  2. If you want to connect to the harbor server from computer A, you need to set up computer A. Computer A here is a Linux operating system;
  3. Edit the /etc/docker/daemon.json file of computer A (create it if it does not exist), add the content in the red box in the figure below, 192.168.50.43 is the IP address of the harbor server, and 5888 is the http port configured earlier:
    Insert picture description here
  4. Restart the docker service to make the configuration effective:
systemctl daemon-reload \
&& systemctl restart docker
  1. Remind again: The modification here is the configuration of the machine connecting to the Harbor service remotely, not the configuration of the Harbor server ;
  2. On computer A, there is an nginx mirror with id 2622e6cca7eb , as shown in the figure below:
    Insert picture description here
  3. Tag the image according to the rules of the dockr mirror repository:
docker tag 2622e6cca7eb 192.168.50.43:5888/library/nginx:latest
  1. Now it is a mirror image of the same ID, but there are two tags:
    Insert picture description here
  2. Log in to harbor:
docker login 192.168.50.43:5888 -u admin -p Harbor12345
  1. Push the image to harbor:
docker push 192.168.50.43:5888/library/nginx:latest
  1. Successful operation:
    Insert picture description here
  2. After the push is successful, this image can be seen on the browser page:
    Insert picture description here
  3. The operation of creating a new warehouse is as follows:
    Insert picture description here
  4. Created successfully:
    Insert picture description here

Uninstall harbor

  1. If you don't need harbor, just execute the following command:
cd ~/harbor-1.10.3/harbor \
&& sudo docker-compose down
  1. Then delete the entire ~/harbor-1.10.3 directory, and note that all data will be deleted ;

At this point, the deployment and verification of the harbor for Synology DS218+ is complete, and I hope to bring you some reference;

Welcome to follow my public account: programmer Xin Chen

Insert picture description here

Guess you like

Origin blog.csdn.net/boling_cavalry/article/details/106962214