1. Configuration docker – compose
A Chinese docker image is used here. Hub.docker.com/r/twang2218…
version: '3'
services:
gitlab:
image: 'twang2218 / gitlab - ce - useful: 9.4'
restart: unless-stopped
hostname: 'fantj.gitlab.top'
environment:
TZ: 'Asia/Shanghai'
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://fantj.gitlab.top:9999'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
The configuration that needs to be configured in gitlab.rb can be configured here, one line per configuration, note the indentation.
For example:
# gitlab_rails['smtp_enable'] = true
# gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
# gitlab_rails['smtp_port'] = 465
# gitlab_rails['smtp_user_name'] = "[email protected]"
# gitlab_rails['smtp_password'] = "password"
# gitlab_rails['smtp_authentication'] = "login"
# gitlab_rails['smtp_enable_starttls_auto'] = true
# gitlab_rails['smtp_tls'] = true
# gitlab_rails['gitlab_email_from'] = '[email protected]'
ports:
- '9999:9999'
# - '443-443'
# - 'and'
volumes:
- /home/fantj/app/docker/compose/gitlab/config:/etc/gitlab
- /home/fantj/app/docker/compose/gitlab/data:/var/opt/gitlab
- /home/fantj/app/docker/compose/gitlab/logs:/var/log/gitlab
Copy the code
2. Configure the hosts
[fantj@lalala gitlab]$cat /etc/hosts 127.0.0.1 localhost localhost. localDomain localhost4 localhost4. Localdomain4 ::1 Localhost localhost.localDomain localhost6 localhost6.localDomain6 127.0.0.1 www.xmind.net 127.0.0.1 fantJ.gitlab.topCopy the code
3. Create a directory
[fantj@lalala gitlab]$ pwd/ home/fantj/app/docker/compose/gitlab [fantj @ lalala gitlab] $ll always use 16 DRWXRWXR - x 3 root root on September 4, 4096 now config Drwxr-xr-x 18 root root 4096 9月 4 11:42 data-rw-rw-r -- 1 Fantj Fantj 1286 9月 4 11:42 docker-compose. Yml drwxr-xr-x 19 Polkitd Fantj 4096 September 4 11:38 logsCopy the code
4. Start
sudo docker-compose up -d
Copy the code
accesshttp://fantj.gitlab.top:9999
5. Set the password and log in
After the password is set, the default super user account is root.
The login
6. Set and use
Settings -> Settings Set SSH and HTTP services set registration service switch set item limit Set avatar source and so onCopy the code
Memory modify
See how much ram it eats before you change it…
[fantj@lalala workspace]$ free -h
total used free shared buff/cache available
Mem: 15Gi 8.9Gi 246Mi 1.5Gi 6.4Gi 4.8Gi
Swap: 7.8Gi 4.0Mi 7.8Gi
Copy the code
There are two modification methods: one is to enter docker interactive mode for modification, and the other is to set parameters in docker-compose.
Note: * * * * because I did the docker data volume mapping in local/home/fantj/app/docker/compose/gitlab/config directory, so you just need to modify the config/gitlab. The parameters of rb.
1. Reduce the number of processes
Modify worker_processes in configuration file gitlab.rb:
unicorn['worker_processes'] = 2
Copy the code
The default value is commented out. It is recommended that this value be the number of CPU cores plus one to improve the server response speed. If the memory is only 4 GB or there are other services running on the server, do not change this value. In addition, the minimum value of this parameter is 2. If set to 1, the server may freeze.
Reduce the database cache
The default value is 256MB
postgresql['shared_buffers'] = "256MB"
Copy the code
3, reduce the number of database concurrency
The default value is 8
postgresql['max_worker_processes'] = 8
Copy the code
Reduce sidekiq concurrency
The default value is 25, which can be reduced as appropriate
sidekiq['concurrency'] = 25
Copy the code
Restart the service
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
Copy the code
If you like my article, please pay attention to my official account, which focuses on the analysis of architect technology. The official account is still in the initial stage, thank you for your support.
Java architecture