Alan's BLOG
  • archives
  • posts
  • tags
  • about
  • quote
  • search
Home » Tags

gitlab

使用Docker安裝GitLab

GitLab不僅是一個源代碼管理工具,它還提供了一個統一的平台,將開發、運營和安全等流程整合在一起。通過GitLab,可以在單一的應用程序中進行專案計劃、源代碼管理、分支控制、CI/CD等操作。不論角色為何,GitLab提供了一個統一的資訊來源,讓你輕鬆地管理和追蹤整個開發流程。它消除了工具鏈的複雜性,提高了端到端流程的可視性,從而幫助組織更快地實現變革。 本篇文章主要紀錄使用docker建立gitlab的教學 準備環境 環境 OS Ubuntu 20.04 LTS Gitlab Gitlab-ce:15.8.0-ce.0 Docker Engine 23.0.5 安裝gitlab 在安裝之前,先講解一下gitlab有哪些重要的資料需要掛載的,主要有以下三個路徑 /var/opt/gitlab: 這個路徑主要儲存GitLab的資料。包括Git repo、用戶資料、配置文件等。掛載到本地後,即使容器發生意外被刪除或重新創建,資料也能夠得到保留,達到數據持久化。 ./gitlab/logs:/var/log/gitlab: 這個路徑主要儲存GitLab的log。log包含GitLab的運行log、錯誤log等重要資訊。掛載到本地後,方便日後查看和管理log,並進行故障排除和監控。 /etc/gitlab: 這個路徑主要儲存GitLab的設定檔,包含系統設定、用戶權限、外部整合等設定。掛載到本地後,可根據需求進行自定義調整。 講解完以上重要的掛載路徑後,接下來講解使用docker建立gitlab docker版 docker run -d \ --name gitlab \ --restart always \ --privileged \ -p 8080:80 \ -p 443:443 \ -p 22:22 \ -v ./gitlab/data:/var/opt/gitlab \ -v ./gitlab/logs:/var/log/gitlab \ -v ./gitlab/config:/etc/gitlab \ gitlab/gitlab-ce:15.8.0-ce.0 docker-compose版 先建立docker-compose.yaml 將以下內容貼上 version: "3.6" services: gitlab: image: gitlab/gitlab-ce:15.8.0-ce.0 container_name: gitlab restart: always privileged: true hostname: 'localhost' ports: - '8080:80' - '443:443' - '22:22' volumes: - '....

2023-05-19 · 1 min · 98 words · Alan

Centos 7 安裝gitlab

安裝與設定所需依賴 安裝依賴套件 sudo yum install -y curl policycoreutils-python openssh-server perl 啟動 SSH 服務 sudo systemctl enable sshd sudo systemctl start sshd 防火牆開啟網頁要用的PORT網頁 sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo systemctl reload firewalld 安裝 SMTP Server (Postfix),發送通知email用 sudo yum install postfix sudo systemctl enable postfix sudo systemctl start postfix 添加gitlab repo以及安裝package Add Gitlab package 可自行選擇要安裝CE版還是EE版,如果要安裝EE版則把gitlab-ce改成gitlab-ee即可 curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash Install Gitlab 這邊建置是使用內網,因此使用http的方式下去做設定 sudo EXTERNAL_URL="http://{{ internal_ip }}" yum install -y gitlab-ce reference Download and install GitLab | GitLab

2023-01-23 · 1 min · 79 words · Alan

Gitlab 修改密碼

使用Rake task 將user_name改成要變更密碼的user name即可 sudo gitlab-rake "gitlab:password:reset[user_name]" 使用Rails console 開啟rails console sudo gitlab-rails console 取得user 透過username user = User.find_by_username 'user_name' 透過userID user = User.find(uid) 透過email user = User.find_by(email: 'user@example.com') 重置密碼 new_password = 'my_new_password' user.password = new_password user.password_confirmation = new_password 儲存修改 user.save! 退出console exit

2023-01-23 · 1 min · 43 words · Alan
© 2024 艾倫的程式之旅 Powered by Hugo & PaperMod