Preface
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
(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 fileIn 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
No Comment
Post your comment