Overview
GitLab is an open source code management platform that uses Git as a version control tool and provides a web interface and multiple functions, such as wiki, issue tracking, CI/CD, etc.
GitLab can be self-hosted or use a SaaS service and supports a variety of operating systems and executors.
GitLab can help software development teams improve collaboration efficiency and quality.
Docker deployment GitLab
Docker installation:Install Pagoda panel and Docker (including MySQL, Redis) in CentOs7
Pull image
docker pull gitlab/gitlab-ce:latest
Start container
To run GitLab Community Edition in a container, run the GitLab CE image in the container and bind it to the host's 9980 and 9922 ports.
Store GitLab's configuration files, logs, and data files in the host's /home/gitlab/etc, /home/gitlab/log, and /home/gitlab/opt directories.
The container will automatically restart on startup and run in privileged mode.
docker run -itd \
-p 9980:80 -p 9922:22 \
-v /home/gitlab/etc:/etc/gitlab \
-v /home/gitlab/log:/var/log/gitlab \
-v /home/gitlab/opt:/var/opt/gitlab \
--restart always \
--privileged=true \
--name gitlab \
gitlab/gitlab-ce
Change setting
Get inside the container
docker exec -it gitlab /bin/bash
# 修改 gitlab.rb,键盘按 i 进入编辑模式
vi /etc/gitlab/gitlab.rb
# 添加配置
# gitlab 访问地址,可以写域名。不写端口默认为 80 端口
external_url 'http://192.168.101.3'
# ssh主机 ip
gitlab_rails['gitlab_ssh_host'] = '192.168.101.3'
# ssh 连接端口
gitlab_rails['gitlab_shell_ssh_port'] = 9922
按Esc
,Import :wq
,Save
Running in Docker, the address of gitlab should be http:192.168.101.3
# 修改 http 和 ssh 配置
vi /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
# 在 yml 修改
gitlab:
host: 192.168.101.3
port: 9980 # 端口改为9980
https: false
After the modification is completed, restart gitlab and then exit the container.
# 重启 gitlab
gitlab-ctl restart
# 退出容器
exit
access
Browser access (http://<your ip address>:9980)
http://192.168.101.3:9980
change Password
# 进入容器
docker exec -it gitlab /bin/bash
# 进入控制台
gitlab-rails console -e production
# 查询 id 为 1 的用户,id 为 1 的用户是超级管理员
user = User.where(id:1).first
# 修改密码为 gitlab
user.password='gitlab@2023'
# 保存
user.save!
# 退出
exit
Log in
Log in to gitlab, username: root
, password: gitlab@2023
(the value modified above)
Related operations
Create project
upper right corner new Project
Create a blank project
Fill in the project name, related description, and visible range, and click Create project
Create Project
Created successfully
idea connect gitlab
Idea is out in version 2023. The new UI of idea is used below. Now use idea to connect to gitlab to complete the push of the code.
Submit code
Connect to the gitlab remote repository, right-click on the project, select Git, and select Manage Repository
Enter the url, click ok, and the url is obtained in gitlab
Port 9980 is missing here, it is actually http://192.168.101.3:9980/root/gitlab-test-demo.git
url pay attention to add the port
Enter username and password to log in
connection succeeded
Click the local master and click push. You can also right-click the project, find Git, and select push.
Click push
You can view the project content in gitlab. By default, gitlab is the branch of main. When you pushed just now, you pushed to the master of gitlab, so first modify the branch to master, and then you can see the project code.
At the same time, you can also view the submission status of the remote warehouse in idea
at last
nightingale monitoring
Recommend to everyone a cloud-native monitoring and analysis system - Nightingale Monitoring
Nightingale Monitoring is a domestic, open-source, cloud-native monitoring and analysis system that adopts an All-In-One design and integrates data collection, visualization, monitoring and alarming, and data analysis. It was developed and open sourced by Didi, and was donated to the China Computer Federation Open Source Development Committee (CCF ODC) on May 11, 2022, becoming the first open source project to receive donations after the establishment of CCF ODC.
The core development team of Nightingale Monitor is also the original core developer of the Open-Falcon project. It supports multiple data collection methods, including Agent, SNMP, JMX, etc. At the same time, it also supports a variety of alarm methods, including email, SMS, WeChat, etc. Nightingale Monitoring provides a wealth of visual charts and dashboards to help users better understand monitoring data.
Install
Use docker-compose to deploy, and githubfast is recommended for cloning.
# 使用 github 克隆
git clone https://github.com/ccfos/nightingale.git
cd nightingale/docker
# 考虑到 github 访问可能不通,这里推荐使用 githubfast
git clone https://githubfast.com/ccfos/nightingale.git
# 进入项目中
cd nightingale/docker
# 启动 Docker Compose 配置文件中定义的所有服务
# up 用于创建并启动容器
# -d 有台运行
docker-compose up -d
Appears after success
access
Remember to open the firewall if access is blocked
address:http://192.168.101.3:17000
Purchase number:root
,Secret number:root.2020
Linux open port related commands
Open the specified port (to reload the firewall)
firewall-cmd --zone=public --add-port=17000/tcp --permanent
Reload firewall
firewall-cmd --reload
Enter the login page
Enter your account password to enter the background
other
The server in this article uses the virtual machine CentOS7.9. For the process of building a virtual machine, please refer to the column.
For information on gitee warehouse operations, please view articles