by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

Preface

My friend wants to study the operation of gitlab, I said that it takes less than ten minutes to install it with docker image,
There is also a gitlab package on my Synology Nas that can be installed directly.

As a result, either the installation failed, or it was being repaired, or it was already started and could not be used. @@
I was choked by my friends...


Now that the installation of gitlab on Synalogy Nas always fails, and the mountain does not turn around,
I will use the official Docker image to run the private warehouse

Official document link:
https://docs.gitlab.com/omnibus/docker/
 

Steps

1. Access my Synlogy Nas through ssh connection.
(Previous question, your Synology NAS needs to be set to allow SSH login. Here I use public key authentication and record the password through ssh-agent, so I didn’t enter the password.)

(As an aside, I can log in with cc because there are similar settings in ~/.ssh/config, 192.168.100.1 is the IP address of my Nas)
In the picture below, the Include method is not supported by some old versions of Linux, so post it for your reference!


2. Create the folders required for mounting.
mkdir -p /volume1/docker/gitlab/config
mkdir -p /volume1/docker/gitlab/logs
mkdir -p /volume1/docker/gitlab/data

3. Execute the docker run command to create and execute the container.
(Previous question, your Synology NAS needs to support Docker installation and execution, you have installed it)
docker run --detach \
--hostname git.ccc.tc\
--publish 127.0.0.1:3080:80 --publish 3022:22\
--name gitlab\
--restart always\
--volume /volume1/docker/gitlab/config:/etc/gitlab \
--volume /volume1/docker/gitlab/logs:/var/log/gitlab \
--volume /volume1/docker/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest


In the above example, I opened the web port on the host's port 3080, and used the local IP address.

Because Synology has a reverse proxy that can go through HTTPS, so I don't need to publish unencrypted HTTP to the outside.
We can configure this setting from the "Console" => "Application Portal" on the Synalogy Nas.
My rules are as follows:


If your Synalogy Nas also has a firewall, remember to enable port 3443.
In fact, you can get another sub-domain name, for example: gitlab.ccc.tc, no additional port 3443 is needed.
But it's just a random test, so it's not so particular.

Startup and shutdown

Because it is purely using docker for the establishment and execution of contianer. Next time, unless we delete the container, we just need to enable and disable it.
docker start gitlab

or
docker stop gitlab

About Settings

The settings of gitlab will be stored in the mounted folder, gitlab.rb file


In the docker command above, we use the standard port 3080:80, and you will see that the HTTP link is HTTP, not the HTTPS link below.


On Synology's Nas, HTTPS is used as the entrance, while HTTP is used in the Container. In order for GitLab to display the correct HTTPS protocol,
In the gitlab.rb file, I set as follows:
external_url 'https://git.ccc.tc:3443'

However, if the settings above are simple, it will cause nginx to fail to start. It is speculated that it is caused by not setting the certificate, so I did not go into it.
Add the settings below to override the gitlab container. When starting the container, nginx still uses port 80 instead of the external_url above.
##! **Override only if you use a reverse proxy**
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html#setting-the-nginx-listen-port
# nginx['listen_port'] = nil
nginx['listen_port'] = 80
##! **Override only if your reverse proxy internally communicates over HTTP**
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html#supporting-proxied-ssl
nginx['listen_https'] = false


After completing the settings, enter the container of gitlab
docker exec -ti gitlab bash


Then reload the configuration file: (The command below is executed in the gitlab container)
gitlab-ctl reconfigure

Supplement

We know that git has a variety of transmission protocols, in addition to http, there is also ssh. During docker run, port 3022 has been specified.
Therefore, when we want to use SSH to clone and use a non-standard port, the easiest way is to add ~/.ssh/config
Host cclab
Hostname git.ccc.tc
User git
Port 3022
In this way, you can clone via ssh with a custom host name.
git clone cclab:devin/testing.git

This is a test account (ironma/thor) that my friend invited to create, and the private warehouse is complete.
In addition to himself, the other two users, I asked who would be the manager, and he said him.


I said, Sol is also a god anyway, so... the private warehouse is done.
Below is the created test account..:D


Docker is really convenient and easy to use. D-Laravel too... :p

Tags: git Synology

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


Synology,cli

Change the password of my Synology NAS via the command line

Adjust password by command line synouser --setpw admin <yourpassword>

Synology,haproxy

Use HAProxy to remove the /mail path of the Sysnolgy Mail Station

This article explains the version of DSM7. The Package Center of Synology Nas provides two Mail Servers, one is Synology Mail Server and the other is Synology MailPlus. For me, the advantage of Synology MailPlus is that he can easily specify a domain name in the login portal, but it is limited to a maximum of five accounts, and if there are more accounts, you will have to buy a license. If you use Synoloyg Mail Server, there will be no limit on the number of accounts, but it does not integrate the login portal. If you install the webmail of Mail Station, there will be an additional path of /mail in the directory of the website. Although it is not in the way, but I just do not like it.

synology,log center,rsyslog,syslog

Use the Synology Log Center to centrally view the logs of the host

This article introduces how I use the Synology Log Center to record all the logs of my home host. In Synolog's log center, we can search through its UI. In this way, we can centrally view our logs, such as the scheduled execution status of Linux hosts. It can also send messages to the log center through commands, and we can check the daily backup tasks of the Linux host at any time, whether the backup is successful or failed, etc.