差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:gitlabtips [2021/01/26 20:03] – jonathan | tech:gitlabtips [2024/11/16 22:17] (目前版本) – 非正式 SSL 憑證 jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
====== GitLab 安裝相關紀錄 ====== | ====== GitLab 安裝相關紀錄 ====== | ||
+ | * 安裝環境 : Alpine 3.20 + docker compose | ||
- | 採用 | + | ===== docker |
+ | * docker-compose.yml < | ||
+ | services: | ||
+ | gitlab: | ||
+ | | ||
+ | container_name: | ||
+ | restart: always | ||
+ | hostname: ' | ||
+ | environment: | ||
+ | GITLAB_OMNIBUS_CONFIG: | ||
+ | # Add any other gitlab.rb configuration here, each on its own line | ||
+ | external_url ' | ||
+ | ports: | ||
+ | - ' | ||
+ | - ' | ||
+ | - ' | ||
+ | volumes: | ||
+ | - ' | ||
+ | - ' | ||
+ | - ' | ||
+ | shm_size: ' | ||
+ | </ | ||
+ | * 啟動服務 < | ||
+ | docker | ||
+ | docker compose logs -f | ||
+ | </ | ||
+ | * 查看自動產生的 root 密碼 < | ||
+ | cat config/ | ||
+ | </ | ||
- | ===== Gitlab | + | ===== docker |
- | * 採用 Gitlab 官方 | + | * 目錄配置< |
- | | + | . |
- | * GITLAB_OMNIBUS_CONFIG 可設定 | + | ├── .env |
- | | + | ├── cloudflare.ini |
- | * Prometheus 監控 : prometheus_monitoring[' | + | ├── |
- | * Container Registry : gitlab_rails['gitlab_default_projects_features_container_registry'] = false; | + | ├── [config] |
- | * 預設的 root 密碼 : gitlab_rails['initial_root_password'] = '<< | + | ├── [data] |
- | * CI/CD Pipeline : gitlab_rails['gitlab_default_projects_features_builds'] = 'false' | + | ├── [logs] |
- | * Docker | + | ├── [ssl] |
- | | + | </ |
- | * name : gitlab | + | * 建立 ssl 目錄與權限< |
- | * restart | + | rm -rf ssl/* |
- | | + | mkdir -p ssl |
- | | + | chmod 777 ssl |
- | * / | + | </ |
- | | + | * 編輯 docker-compose.yml < |
- | | + | services: |
- | sudo docker run --env GITLAB_OMNIBUS_CONFIG=" | + | gitlab: |
- | | + | |
- | | + | container_name: gitlab |
- | | + | |
- | | + | |
- | | + | environment: |
- | --volume | + | GITLAB_OMNIBUS_CONFIG: |
- | --volume | + | |
- | --volume | + | |
- | | + | nginx['ssl_certificate'] = "/ |
+ | nginx['ssl_certificate_key'] = "/etc/ | ||
+ | nginx['enable'] = true | ||
+ | nginx['redirect_http_to_https'] = true | ||
+ | | ||
+ | - '80:80' | ||
+ | - '443:443' | ||
+ | - '9022:22' | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | shm_size: ' | ||
+ | networks: | ||
+ | - gitlab-network | ||
+ | |||
+ | | ||
+ | | ||
+ | container_name: | ||
+ | volumes: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | - -c | ||
+ | - | | ||
+ | trap exit TERM; | ||
+ | while :; do | ||
+ | | ||
+ | | ||
+ | -m ${CF_EMAIL} || true; | ||
+ | |||
+ | if [ -f /etc/letsencrypt/live/ | ||
+ | cp /etc/letsencrypt/ | ||
+ | cp / | ||
+ | chmod 644 / | ||
+ | |||
+ | apk add --no-cache curl | ||
+ | echo " | ||
+ | until curl -s http://gitlab:80/-/health > /dev/null; do | ||
+ | sleep 5 | ||
+ | done | ||
+ | |||
+ | echo " | ||
+ | curl -s --show-error --fail -X POST http://gitlab:80/-/api/v4/ | ||
+ | fi | ||
+ | sleep 24h; | ||
+ | done | ||
+ | networks: | ||
+ | - gitlab-network | ||
+ | |||
+ | networks: | ||
+ | gitlab-network: | ||
+ | driver: bridge | ||
+ | </ | ||
+ | * 編輯 | ||
+ | DOMAIN_NAME=gitlab.ichiayi.com #Gitlab 網址 | ||
+ | [email protected] #Cloudflare 帳號 | ||
+ | </ | ||
+ | * 編輯 cloudflare.ini 檔案 Exp. < | ||
+ | dns_cloudflare_api_token = kvm8***********************************o | ||
+ | </ | ||
+ | * 設定 .env 與 cloudflare.ini 權限 < | ||
+ | chmod 600 .env | ||
+ | chmod 600 cloudflare.ini | ||
+ | </ | ||
+ | * 啟動服務 < | ||
+ | docker compose up -d | ||
</ | </ | ||
===== 參考網址 ===== | ===== 參考網址 ===== | ||
+ | * https:// | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * https:// | ||
{{tag> | {{tag> |