GitLab 除了可以版控程式碼
如何建立GitLab 與 GitLab-Runner 請看這篇
【Gitlab】使用 Docker-Compose 建置 GitLab+GitLab-Runner
另一個便利的點就是 .md 檔可以直接在上面瀏覽
設計一套系統不太可能只有幾個 .md 檔就可以描述清楚
因此可以利用 GitBook 來生成電子書
GitBook 可以使用 npm 直接安裝
npm install gitbook-cli -g
初始化文件
gitbook init
在本機執行模擬網站
gitbook serve
如果不執行只要建置, 可使用建置語法
gitbook build
當然使用 GitLab 存放 GitBook 目的就是要使用 GitLab的 CI/CD, 以及 Pages
但如果是內部私人網路沒有Domain狀況下
可以使用 GitLab 內建的 Nginx, 並調整 gitlab-pages.conf
/var/opt/gitlab/nginx/conf/gitlab-pages.conf
################################### ## configuration ## ################################### server { listen 80088; server_name 192.168.99.100; server_tokens off; ## Don't show the nginx version number, a security best practice ## Disable symlink traversal disable_symlinks on; ## Real IP Module Config ## http://nginx.org/en/docs/http/ngx_http_realip_module.html ## Individual nginx logs for this GitLab vhost access_log /var/log/gitlab/nginx/gitlab_pages_access.log gitlab_access; error_log /var/log/gitlab/nginx/gitlab_pages_error.log; # Pass everything to pages daemon location / { root /var/opt/gitlab/gitlab-rails/shared/pages; index index.html; } # Define custom error pages error_page 403 /403.html; error_page 404 /404.html; }
設定完畢後重啟 Nginx
gitlab-ctl restart nginx
最後訪問網址如下
http://192.168.99.100:80088/gitlab帳號/專案名稱/public