<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之旅 廣告
                # Using Dpl as deployment tool > 原文:[https://docs.gitlab.com/ee/ci/examples/deployment/README.html](https://docs.gitlab.com/ee/ci/examples/deployment/README.html) * [Requirements](#requirements) * [Basic usage](#basic-usage) * [Using Dpl with Docker](#using-dpl-with-docker) * [Usage in staging and production](#usage-in-staging-and-production) * [Storing API keys](#storing-api-keys) # Using Dpl as deployment tool[](#using-dpl-as-deployment-tool "Permalink") [Dpl](https://github.com/travis-ci/dpl) (發音為 DPL)是由 Travis CI 開發和使用的,用于連續部署的部署工具,但也可以與 GitLab CI / CD 一起使用. Dpl 可用于部署到任何[受支持的提供程序](https://github.com/travis-ci/dpl#supported-providers) . ## Requirements[](#requirements "Permalink") 要使用 Dpl,您至少需要具備安裝 gem 的 Ruby 1.9.3. ## Basic usage[](#basic-usage "Permalink") 可以將 Dpl 安裝在具有以下條件的任何計算機上: ``` gem install dpl ``` 這使您可以從本地終端測試所有命令,而不必在 CI 服務器上進行測試. 如果您沒有安裝 Ruby,則可以在兼容 Debian 的 Linux 上執行以下操作: ``` apt-get update apt-get install ruby-dev ``` Dpl 為大量服務提供支持,包括:Heroku,Cloud Foundry,AWS / S3 等. 要使用它,只需定義提供者和提供者所需的任何其他參數. 例如,如果要使用它將應用程序部署到 Heroku,則需要將`heroku`指定為提供者,并指定`api-key`和`app` . 所有可能的參數都可以在這里找到: [https](https://github.com/travis-ci/dpl#heroku-api) : [//github.com/travis-ci/dpl#heroku-api](https://github.com/travis-ci/dpl#heroku-api) . ``` staging: stage: deploy script: - gem install dpl - dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY ``` 在上面的示例中,我們使用 Dpl 通過存儲在`HEROKU_STAGING_API_KEY`安全變量中的 API 密鑰將`my-app-staging`部署到 Heroku 服務器. 要使用其他提供程序,請查看一整列[受支持的提供程序](https://github.com/travis-ci/dpl#supported-providers) . ## Using Dpl with Docker[](#using-dpl-with-docker "Permalink") 在大多數情況下,您將配置[GitLab Runner](https://docs.gitlab.com/runner/)以使用服務器的 Shell 命令. 這意味著所有命令都在本地用戶的上下文中運行(例如`gitlab_runner`或`gitlab_ci_multi_runner` ). 這也意味著最有可能在 Docker 容器中沒有安裝 Ruby 運行時. 您將必須安裝它: ``` staging: stage: deploy script: - apt-get update -yq - apt-get install -y ruby-dev - gem install dpl - dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY only: - master ``` 第一行`apt-get update -yq`更新可用軟件包的列表,第二行`apt-get install -y ruby-dev`在系統上安裝 Ruby 運行時. 上面的示例對所有與 Debian 兼容的系統均有效. ## Usage in staging and production[](#usage-in-staging-and-production "Permalink") 在開發工作流程中具有暫存(開發)和生產環境是很常見的 讓我們考慮以下示例:我們希望將`master`分支部署到`staging`并將所有標簽部署到`production`環境. 該設置的最終`.gitlab-ci.yml`如下所示: ``` staging: stage: deploy script: - gem install dpl - dpl --provider=heroku --app=my-app-staging --api-key=$HEROKU_STAGING_API_KEY only: - master production: stage: deploy script: - gem install dpl - dpl --provider=heroku --app=my-app-production --api-key=$HEROKU_PRODUCTION_API_KEY only: - tags ``` 我們創建了兩個在不同事件上執行的部署作業: 1. `staging` is executed for all commits that were pushed to `master` branch, 2. 對所有推送的標簽執行`production` . 我們還使用兩個安全變量: 1. `HEROKU_STAGING_API_KEY` -Heroku API 密鑰,用于部署登臺應用程序, 2. `HEROKU_PRODUCTION_API_KEY` -Heroku API 密鑰,用于部署生產應用程序. ## Storing API keys[](#storing-api-keys "Permalink") 可以通過在項目的**設置?CI / CD?變量中**添加安全**變量** . 項目設置中定義的變量與構建腳本一起發送到 Runner. 安全變量存儲在存儲庫之外. 切勿將機密存儲在項目的`.gitlab-ci.yml` . 將秘密的值隱藏在作業日志中也很重要. 您可以通過使用`$` (在非 Windows 運行程序上)或`%` (對于 Windows 批處理運行程序)前綴名稱來訪問添加的變量: 1. `$VARIABLE`用于非 Windows 運行器 2. `%VARIABLE%` -用于 Windows 批處理運行器 閱讀有關[CI 變量的](../../variables/README.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>

                              哎呀哎呀视频在线观看