Motivation
The previous code was basically placed on GitHub, but because some codes involve some scientific research projects, even if they are placed in the private repository, there may be potential security issues, so I want to build a private code repository and put them on my own computer or server.
Prerequisites
- docker和docker compose
- Domain name (second-level domain name is sufficient)
- acme.sh (Generate SSL certificate)
- nginx (Reverse proxy)
Preparation
Domain Name and SSL Certificate
For the installation and preparation of the above software and tools, please refer to “Building a Personal Cloud Network Disk using Nextcloud and Docker”
Install GitLab
Use docker-compose
to install Jellyfin. The specific operation refer to https://docs.gitlab.com/ee/install/docker.html.HTML.
Create the following docker-compose.yml
file under the installation directory/media/gitlab
file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ee:latest'
restart: always
hostname: 'git.jinli.io'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://git.jinli.io'
gitlab_rails['gitlab_shell_ssh_port'] = 22
ports:
- '1080:80'
- '1443:443'
- '1022:22'
volumes:
- './config:/etc/gitlab'
- './logs:/var/log/gitlab'
- './data:/var/opt/gitlab'
shm_size: '256m'
|
Then execute the following command to start the GitLab service:
1
|
sudo docker-compose up -d
|
Website Initialization and Settings
If all the above configurations are successfully completed, you can access the website through the browser, you can enter http: //0.0.0.0: 8080
in the address bar, or use the domain name https: // git.jinli.cyou
access.
If the website has not yet been initialized, you will see the prompt 502 Bad Gateway
when you visit the browser, you need to wait patiently for a few minutes until the website is initialized.
When you visit the website for the first time, you need to set up an administrator account and password, and then you can create a common account for daily use.
Configuration System Notification Mailbox
After the above configuration, gitlab can be used normally.However, we also want to use the system notification function, such as sending the system to notify the email, the email verification when registering the account, etc., we need to configure the system to notify the mailbox. Here I use my own mailbox server. The specific configuration is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
### GitLab email server settings
###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
###! **Use smtp instead of sendmail/postfix.**
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail.jinli.cyou"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "your_email_password"
gitlab_rails['smtp_domain'] = "mail.jinli.cyou"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
# gitlab_rails['smtp_pool'] = false
###! **Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert'**
###! Docs: http://api.rubyonrails.org/classes/ActionMailer/Base.html
gitlab_rails['smtp_openssl_verify_mode'] = 'none'
# gitlab_rails['smtp_ca_path'] = "/etc/ssl/certs"
# gitlab_rails['smtp_ca_file'] = "/etc/ssl/certs/ca-certificates.crt"
### Email Settings
# gitlab_rails['gitlab_email_enabled'] = true
##! If your SMTP server does not like the default 'From: [email protected]'
##! can change the 'From' with this setting.
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_display_name'] = 'GitLab Mailer'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
# gitlab_rails['gitlab_email_subject_suffix'] = ''
# gitlab_rails['gitlab_email_smime_enabled'] = false
# gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key'
# gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt'
# gitlab_rails['gitlab_email_smime_ca_certs_file'] = '/etc/gitlab/ssl/gitlab_smime_cas.crt'
|
In this way, our own Gitlab server also has a systematic notification function.