GitLab使用記錄

GitLab修改root用戶密碼
GitLab是一個私有的Git倉庫,具備較好的項目管理和用戶管理能力。
對於普通用戶而言,經過系統的重置密碼,接受郵件便可解決,但是GitLab的管理員帳號,缺省的郵箱是一個不存在的郵箱地址,因此沒有辦法經過郵箱來複位。
經過在服務器上,能夠修改用戶的密碼:
官方修改密碼:(http://docs.gitlab.com/ce/security/reset_root_password.html)
不過,筆者經過該方法是,發現,不能使用引號來包括密碼。
具體方法以下:
1. 在root用戶下,執行
gitlab-rails console production
得到用戶數據,修改用戶密碼
[root@svr34 bin]# gitlab-rails console production
Loading production environment (Rails 4.2.5.2)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id: 1, email: "admin@example.com", ...
irb(main):002:0> user.password=12345678
=> 12345678
irb(main):003:0> user.password_confirmation=12345678
=> 12345678
irb(main):004:0> user.save!
=> true
irb(main):005:0> quit
注意:密碼沒有使用引號,奇怪的是使用單引號或雙引號,密碼就無效,估計是包含了這個字符,不包含,就沒有問題。
3. 保存用戶數據
 html

1.ubuntu修改主機名和用戶名:https://www.cnblogs.com/zeusmyth/p/6231350.html
2.ubuntu下載命令:wget http://...linux

3.ubuntu docker 免sudo資料:https://blog.csdn.net/ppppfly/article/details/51742129
 
4.查看docker守護進程狀態: sudo status docker 
 
5.Gitlab文檔docker install gitlab:https://docs.gitlab.com/omnibus/docker/README.html
 
6.錯誤:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
   緣由:沒有啓動docker服務:service docker start
 
7.ubuntu安裝docker參考:https://www.cnblogs.com/lighten/p/6034984.html
 
8.ubuntu安裝docker錯誤:https://stackoverflow.com/questions/39645118/docker-unable-to-locate-package-docker-engine
 
9.docker沒法掛載問題:https://www.linuxidc.com/Linux/2015-03/115124.htm
 
10.docker安裝gitlab-runner:https://docs.gitlab.com/runner/install/docker.html
 git

gitlab 502 錯誤:
端口被佔用或者是系統沒有達到要求具體參見官網要求:https://docs.gitlab.com.cn/ce/install/requirements.html#unicorn-workers
 
緣由一,若端口被佔用
1.查看gitlab端口使用狀況:gitlab-ctl tail unicorn跟蹤unicorn的狀態
2.若是端口被佔用則殺死該端口
 
緣由二,配置有問題
還有就是gitlab.rb配置文件相關配置以下:
參見百度雲gitlab服務器中的gitlab.rb文件
 
緣由三,系統配置不行
解決方案:配置SWAP交換分區(虛擬內存)
配置方法:
一、檢查 Swap 空間,先檢查一下系統裏有沒有既存的 Swap 文件
swapon -s
若是返回的信息概要是空的,則表示 Swap 文件不存在。docker

二、肯定swap文件的大小,單位爲M。將該值乘以1024獲得塊大小。例如,64MB的swap文件的塊大小是65536。ubuntu

三、建立 Swap 文件,下面使用 dd 命令來建立 Swap 文件。
dd if=/dev/zero of=/swapfile bs=1024 count=4194304vim

【參數說明】
if=文件名:輸入文件名,缺省爲標準輸入。即指定源文件。< if=input file >
of=文件名:輸出文件名,缺省爲標準輸出。即指定目的文件。< of=output file >
bs=bytes:同時設置讀入/輸出的塊大小爲bytes個字節
count=blocks:僅拷貝blocks個塊,塊大小等於bs指定的字節數。windows

四、建立好Swap文件,還須要格式化後才能使用。運行命令:
mkswap /swapfile服務器

五、激活 Swap ,運行命令:
swapon /swapfilegitlab

六、若是要機器重啓的時候自動掛載 Swap ,那麼還須要修改 fstab 配置。
用 vim 打開 /etc/fstab 文件,在其最後添加以下一行:
/swapfile   swap   swap    defaults 0 0ui

當下一次系統啓動時,新的swap文件就打開了。

七、添加新的swap文件並開啓後,檢查 cat /proc/swaps 或者free命令的輸出來查看swap是否已打開。

八、最後,賦予 Swap 文件適當的權限:
chown root:root /swapfile
chmod 0600 /swapfile

九、刪除SWAP分區
$ swapoff  /swapfile  #卸載swap文件
$ 並修改/etc/fstab文件 #從配置總刪除
$ rm -rf /swapfile  #刪除文件
 
 

 搭建windows gitlab-runner:1.下載 gitlab-runner-windows-amd64.exe 並安裝:https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/windows.md

相關文章
相關標籤/搜索