<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Getting started with Auto DevOps > 原文:[https://docs.gitlab.com/ee/topics/autodevops/quick_start_guide.html](https://docs.gitlab.com/ee/topics/autodevops/quick_start_guide.html) * [Configure your Google account](#configure-your-google-account) * [Create a new project from a template](#create-a-new-project-from-a-template) * [Create a Kubernetes cluster from within GitLab](#create-a-kubernetes-cluster-from-within-gitlab) * [Install Ingress and Prometheus](#install-ingress-and-prometheus) * [Enable Auto DevOps (optional)](#enable-auto-devops-optional) * [Deploy the application](#deploy-the-application) * [Monitor your project](#monitor-your-project) * [Work with branches](#work-with-branches) * [Conclusion](#conclusion) # Getting started with Auto DevOps[](#getting-started-with-auto-devops "Permalink") 本分步指南將幫助您使用[Auto DevOps](index.html)將 GitLab.com 上托管的項目部署到 Google Kubernetes Engine. 您將使用 GitLab 的本地 Kubernetes 集成,因此您無需使用 Google Cloud Platform 控制臺手動創建 Kubernetes 集群. 您將創建并部署一個從 GitLab 模板創建的簡單應用程序. 這些說明也適用于自我管理的 GitLab 實例; 您只需要確保[配置了](../../ci/runners/README.html)自己的[Runners](../../ci/runners/README.html)并[啟用了 Google OAuth](../../integration/google.html) . ## Configure your Google account[](#configure-your-google-account "Permalink") 在創建 Kubernetes 集群并將其連接到 GitLab 項目之前,您需要一個[Google Cloud Platform 帳戶](https://console.cloud.google.com) . 使用現有的 Google 帳戶登錄,例如用于訪問 Gmail 或 Google 云端硬盤的帳戶,或創建一個新帳戶. 1. 請按照 Kubernetes Engine 文檔的["開始之前"一節](https://cloud.google.com/kubernetes-engine/docs/quickstart#before-you-begin)中描述的步驟來啟用所需的 API 和相關服務. 2. 確保您已使用 Google Cloud Platform 創建了一個[結算帳戶](https://cloud.google.com/billing/docs/how-to/manage-billing-account) . **提示:**每個新的 Google Cloud Platform(GCP)帳戶都會獲得[$ 300 的信用額](https://console.cloud.google.com/freetrial) ,并且與 Google 合作,GitLab 能夠為新的 GCP 帳戶提供額外的$ 200,以開始使用 GitLab 的 Google Kubernetes Engine Integration. [點擊此鏈接](https://cloud.google.com/partners/partnercredit/?pcn_code=0014M00001h35gDQAQ#contact-form)并申請信用. ## Create a new project from a template[](#create-a-new-project-from-a-template "Permalink") 我們將使用 GitLab 的項目模板之一來開始. 顧名思義,這些項目提供了基于某些知名框架的準系統應用程序. 1. 在 GitLab 中,單擊加號( ),然后選擇**新建項目** . 2. 轉到**從模板創建**選項卡,您可以在其中選擇 Ruby on Rails,Spring 或 NodeJS Express 項目. 對于本教程,請使用 Ruby on Rails 模板. [![Select project template](https://img.kancloud.cn/3e/64/3e64160b446a2ba2fa28ff4e1ab439d1_1596x982.png)](img/guide_project_template_v12_3.png) 3. 給您的項目起一個名字,或者選擇一個描述,并將其公開,以便您可以利用[GitLab Gold 計劃](https://about.gitlab.com/pricing/#gitlab-com)中的可用功能. [![Create project](https://img.kancloud.cn/e4/f4/e4f48d3a67d0d27836cd7856fb789d69_1586x1158.png)](img/guide_create_project_v12_3.png) 4. Click **建立專案**. 現在,您已經創建了一個項目,接下來將創建 Kubernetes 集群以將該項目部署到該集群. ## Create a Kubernetes cluster from within GitLab[](#create-a-kubernetes-cluster-from-within-gitlab "Permalink") 1. 在項目的登錄頁面上,單擊**添加 Kubernetes 集群** (請注意,當您導航到 **操作> Kubernetes** ). [![Project landing page](https://img.kancloud.cn/e2/b7/e2b7a18c21a28dcf06f70f32c511d961_893x448.png)](img/guide_project_landing_page_v12_10.png) 2. 在" **添加 Kubernetes 集群集成"**頁面上,單擊" **創建新集群"**選項卡,然后單擊" **Google GKE"** . 3. 與您的 Google 帳戶關聯,然后單擊" **允許"**以允許訪問您的 Google 帳戶. (此授權請求僅在您第一次將 GitLab 與您的 Google 帳戶連接時顯示.) 授權訪問后,將顯示" **添加 Kubernetes 集群集成"**頁面. 4. 在**輸入 Kubernetes 集群的詳細信息**部分中,提供有關集群的詳細信息: * **Kubernetes cluster name** * **環境范圍** -保留此字段不變. * **Google Cloud Platform 項目** -選擇一個項目. 在[配置 Google 帳戶后](#configure-your-google-account) ,應該已經為您創建了一個項目. * **區域** -要在其中創建群集的[區域/區域](https://cloud.google.com/compute/docs/regions-zones/) . * **節點數** * **機器類型** -有關[機器類型的](https://cloud.google.com/compute/docs/machine-types)更多信息,請參閱 Google 文檔. * **為 Anthos 啟用 Cloud Run-**選中此復選框以對該集群使用[Cloud Run](../../user/project/clusters/add_gke_clusters.html#cloud-run-for-anthos) ,Istio 和 HTTP Load Balancing 加載項. * **由 GitLab 管理的群集** -選中此復選框以[允許 GitLab 管理](../../user/project/clusters/index.html#gitlab-managed-clusters)該群集的[名稱空間和服務帳戶](../../user/project/clusters/index.html#gitlab-managed-clusters) . 5. Click **創建一個 Kubernetes 集群**. 幾分鐘后,將創建集群. 您還可以在[GCP 儀表板上](https://console.cloud.google.com/kubernetes)查看其狀態. 接下來,您將在群集上安裝一些需要充分利用 Auto DevOps 的應用程序. ## Install Ingress and Prometheus[](#install-ingress-and-prometheus "Permalink") 集群運行后,您可以安裝第一個應用程序. 在本指南中,我們將安裝 Ingress 和 Prometheus: * 入口-在后臺使用 NGINX 提供負載平衡,SSL 終止和基于名稱的虛擬主機. * Prometheus-一種用于監視已部署應用程序的開源監視和警報系統. **注意:**我們不會在此快速入門指南中安裝 GitLab Runner,因為該指南使用了 GitLab.com 提供的共享 Runners. 要安裝應用程序: * 單擊**Ingress**的**安裝**按鈕. * 顯示**入口端點時** ,復制 IP 地址. * 添加您的**基本域** . 對于本指南,我們將使用 GitLab 建議的域. * Click **保存更改**. [![Cluster Base Domain](https://img.kancloud.cn/4e/76/4e764554519bff570b93c4f319ccf060_1652x902.png)](img/guide_base_domain_v12_3.png) ## Enable Auto DevOps (optional)[](#enable-auto-devops-optional "Permalink") 默認情況下啟用 Auto DevOps 時,可以在實例級別(對于自我管理的實例)和組級別禁用 Auto DevOps. 完成以下步驟以啟用 Auto DevOps(如果已禁用): 1. 導航 **設置> CI / CD>自動 DevOps** ,然后點擊**擴展** . 2. 選擇**默認為自動 DevOps 管道**以顯示更多選項. 3. 在" **部署策略"中** ,選擇所需的[連續部署策略](index.html#deployment-strategy) ,以在管道成功在`master`分支上運行之后將應用程序部署到生產中. 4. Click **保存更改**. [![Auto DevOps settings](https://img.kancloud.cn/41/57/4157720e64ebd5ca62884fc75d08eeaa_1682x870.png)](img/guide_enable_autodevops_v12_3.png) 保存更改后,GitLab 將創建一個新管道. 要查看它,請轉到 **CI / CD>管道** . 在下一節中,我們將解釋管道中每個作業的作用. ## Deploy the application[](#deploy-the-application "Permalink") 當管道運行時,它在做什么? 要查看管道中的作業,請單擊管道的狀態標記. 的 圖標在管道作業運行時顯示,并在不刷新頁面的情況下進行更新 (成功)或 (失敗)作業完成時. 作業分為以下幾個階段: [![Pipeline stages](https://img.kancloud.cn/a7/c5/a7c5131342e10f5eb9bc55c8125b8baf_2000x861.png)](img/guide_pipeline_stages_v13_0.png) * **構建** -應用程序將構建 Docker 映像并將其上傳到項目的[Container Registry](../../user/packages/container_registry/index.html) ( [Auto Build](stages.html#auto-build) ). * **測試** -GitLab 在應用程序上運行各種檢查: * `test`作業通過檢測語言和框架來運行單元測試和集成測試( [自動測試](stages.html#auto-test) ) * `code_quality`作業檢查代碼質量,并允許失敗( [自動代碼質量](stages.html#auto-code-quality-starter) ) * `container_scanning`作業檢查 Docker 容器是否存在任何漏洞并被允許失敗( [自動容器掃描](stages.html#auto-container-scanning-ultimate) ) * `dependency_scanning`作業檢查應用程序是否具有易受漏洞影響的任何依賴關系,并允許其失敗( [自動依賴關系掃描](stages.html#auto-dependency-scanning-ultimate) ) * 后綴為`-sast`作業在當前代碼上運行靜態分析,以檢查潛在的安全問題,并允許其失敗( [Auto SAST](stages.html#auto-sast-ultimate) ) * `secret-detection`作業會檢查泄漏的機密并允許其失敗( [自動機密檢測](stages.html#auto-secret-detection-ultimate) ) * `license_management`作業搜索應用程序的依存關系,以確定其每個許可證并被允許失敗( [自動許可證合規](stages.html#auto-license-compliance-ultimate) )**注意:**除`test`外,所有作業均允許在測試階段失敗. * **回顧** -對輸水管道`master`包括這個階段有`dast_environment_deploy`工作. 要了解更多信息,請參閱[動態應用程序安全性測試(DAST)](../../user/application_security/dast/index.html) . * **生產** -測試和檢查完成后,該應用程序將在 Kubernetes 中進行部署( [Auto Deploy](stages.html#auto-deploy) ). * **性能** -性能測試在已部署的應用程序上運行( [自動瀏覽器性能測試](stages.html#auto-browser-performance-testing-premium) ). * **清理** -對輸水管道`master`包括這個階段有`stop_dast_environment`工作. 在運行管道之后,您應該查看已部署的網站并學習如何對其進行監視. ### Monitor your project[](#monitor-your-project "Permalink") 成功部署您的應用程序后,您可以通過導航到" **環境"**頁面來查看其網站并檢查其運行狀況. **運營>環境** . 該頁面顯示有關已部署應用程序的詳細信息,右側列顯示將您鏈接到常見環境任務的圖標: [![Environments](https://img.kancloud.cn/9b/3a/9b3a4c34a996ea20d8bb5186afd6db96_2058x610.png)](img/guide_environments_v12_3.png) * **開放的現場環境** ( )-打開生產環境中部署的應用程序的 URL * **Monitoring** () - Opens the metrics page where Prometheus collects data about the Kubernetes cluster and how the application affects it in terms of memory usage, CPU usage, and latency * **部署到** ( )-顯示可以部署到的環境的列表 * **終端** ( )-在運行應用程序的容器內打開[Web 終端](../../ci/environments/index.html#web-terminals)會話 * **重新部署到環境** ( )-有關更多信息,請參閱[重試和回滾](../../ci/environments/index.html#retrying-and-rolling-back) * **停止環境** ( )-有關更多信息,請參閱[停止環境](../../ci/environments/index.html#stopping-an-environment) GitLab 在環境信息下方顯示[部署板](../../user/project/deploy_boards.html) ,并用正方形表示 Kubernetes 集群中的 Pod,并用顏色編碼以顯示其狀態. 將鼠標懸停在部署板上的正方形上會顯示部署的狀態,單擊該正方形會將您帶到窗格的日志頁面. **提示:**該示例目前僅顯示一個托管應用程序的 Pod,但是您可以通過在以下[`REPLICAS`](customize.html#environment-variables)定義[`REPLICAS`變量](customize.html#environment-variables)來添加更多 Pod **設置> CI / CD>環境變量** . ### Work with branches[](#work-with-branches "Permalink") 按照[GitLab 流程](../gitlab_flow.html#working-with-feature-branches) ,您接下來應該創建一個功能分支以向您的應用程序添加內容: 1. 在項目的存儲庫中,導航到以下文件: `app/views/welcome/index.html.erb` . 該文件應僅包含一個段落: `<p>You're on Rails!</p>` . 2. 打開 GitLab [Web IDE](../../user/project/web_ide/index.html)進行更改. 3. 編輯文件,使其包含: ``` <p>You're on Rails! Powered by GitLab Auto DevOps.</p> ``` 4. 暫存文件. 添加提交消息,然后通過單擊**Commit**創建一個新分支和一個合并請求. [![Web IDE commit](https://img.kancloud.cn/47/58/47582932fdcc601a11c0d8599259d4cd_2510x1566.png)](img/guide_ide_commit_v12_3.png) 提交合并請求后,GitLab 運行你的管道,而在這一切的工作,如[前文所述](#deploy-the-application) ,除了僅在比其他分支多跑幾個`master` . [![Merge request](https://img.kancloud.cn/eb/85/eb857eab0790157a08a9a5b5991159fe_1922x1780.png)](img/guide_merge_request_v12_3.png) 幾分鐘后,您會注意到測試失敗,這意味著您的更改"破壞了"測試. 單擊失敗的`test`作業以查看有關它的更多信息: ``` Failure: WelcomeControllerTest#test_should_get_index [/app/test/controllers/welcome_controller_test.rb:7]: <You're on Rails!> expected but was <You're on Rails! Powered by GitLab Auto DevOps.>.. Expected 0 to be >= 1. bin/rails test test/controllers/welcome_controller_test.rb:4 ``` 要修復損壞的測試: 1. 返回到合并請求的" **概述"**頁面,然后單擊" **在 Web IDE 中打開"** . 2. 在文件的左側目錄中,找到`test/controllers/welcome_controller_test.rb`文件,然后單擊將其打開. 3. 更改第 7 行,說" `You're on Rails! Powered by GitLab Auto DevOps.` `You're on Rails! Powered by GitLab Auto DevOps.` 4. Click **Commit**. 5. 在左側列的"未**分段的更改"下** ,單擊選中標記圖標( )進行更改. 6. 編寫提交消息,然后單擊**提交** . 返回到合并請求的" **概述"**頁面,您不僅應該看到測試通過,而且應該看到部署為[審閱應用程序的應用程序](stages.html#auto-review-apps) . 您可以通過單擊**查看應用程序**來訪問它 按鈕以查看已部署的更改. [![Review app](https://img.kancloud.cn/87/cd/87cddd277269670e03e453e47d2c18c9_1926x1456.png)](img/guide_merge_request_review_app_v12_3.png) 合并合并請求后,GitLab 在`master`分支上運行管道,然后將應用程序部署到生產環境. ## Conclusion[](#conclusion "Permalink") 實施該項目之后,您應該對 Auto DevOps 的基礎有深入的了解. 您從構建和測試開始,到在 GitLab 中全部部署和監視應用程序. 盡管具有自動特性,但也可以配置和自定義 Auto DevOps 以適合您的工作流程. 以下是一些有用的資源,供您進一步閱讀: 1. [Auto DevOps](index.html) 2. [Multiple Kubernetes clusters](index.html#using-multiple-kubernetes-clusters) 3. [Incremental rollout to production](customize.html#incremental-rollout-to-production-premium) 4. [Disable jobs you don’t need with environment variables](customize.html#environment-variables) 5. [Use a static IP for your cluster](../../user/clusters/applications.html#using-a-static-ip) 6. [Use your own buildpacks to build your application](customize.html#custom-buildpacks) 7. [Prometheus monitoring](../../user/project/integrations/prometheus.html)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看