1

tl;博士;

我正在尝试使用 wercker 将 nginx 作为本地服务运行到我的开发管道,但我找不到正确的方法。

任何人都可以指出一个包含 nginx 作为本地服务的 wercker 多容器应用程序的工作示例吗?


我的项目是一个 Django 应用程序,开发管道目前工作正常,只有一个数据库注册为服务。我正在努力将网络服务器容器化,我希望将其作为Local Service

基于本文档的“本地服务”部分:http: //devcenter.wercker.com/docs/services/advanced-services.html,我尝试了以下方法:

项目文件夹结构:

| (several other files) 
|-- .web-container 
|   |-- nginx-prd.conf 
|   `-- wercker.yml 
`-- wercker.yml       <------------ this is my 'main' wercker file 

wercker 内部:

dev:
  services:
    - id: nginx
      url: file://.web-container/#dev
  steps:
    - script:
   (all the rest)

.web-container/wercker.yml 包含:

box: library/nginx
dev:
  steps:
    - script:
        name: Copy config files
        code: |
            cp ./nginx-prd.conf /etc/nginx/nginx.conf
     - internal/watch:
        code: tail -f /var/log/nginx/error.log;

当我运行时,我在发送命令之前$ wercker --verbose dev收到消息ERROR Session finished: [mkdir -p "/pipeline/output"]

当容器没有可用的 /bin/bash 时,我发现有关同一消息的问题报告,但事实并非如此。

我尝试了一些小的更改,例如定义入口点,定义不同的 cmd,但没有任何效果。


wercker dev 详细输出:

$ wercker --verbose dev
--> No Docker host specified, checking: /var/run/docker.sock
--> Executing pipeline
--> Copied working dir: 0.00s
--> Running step: setup environment
Running wercker version: 1.0.560 (Compiled at: 2016-07-14T18:47:38Z, Git commit: 45904587eedbad1503e0cf69fc151a551a888d88)
Using config:
box: pitervergara/geodjango:nexchange

dev:
  services:
    - id: nginx
      url: file://.web-container#dev
  steps:
    - script:
    ......... ommited ............
Pulling from pitervergara/geodjango: nexchange
Digest: sha256:df27f5f336a7a8b70f652205687c1f6cfb939d1061ac009d25cd36b100fe53d2
Status: Image is up to date for pitervergara/geodjango:nexchange
--> Fetched docker.io/pitervergara/geodjango:nexchange: 4.97s
--> Executing pipeline
--> Copied working dir: 0.05s
--> Running step: setup environment
Running wercker version: 1.0.560 (Compiled at: 2016-07-14T18:47:38Z, Git commit: 45904587eedbad1503e0cf69fc151a551a888d88)
Using config:
box: library/nginx
dev:
    steps:
        - script:
            name: Copy config files
            code: |
                cp ./nginx-prd.conf /etc/nginx/nginx.conf

        - internal/watch:
            code: tail -f /var/log/nginx/error.log;

WARNING Ignoring dev step: internal/watch
Pulling from library/nginx: latest
Digest: sha256:0fe6413f3e30fcc5920bc8fa769280975b10b1c26721de956e1428b9e2f29d04
Status: Image is up to date for nginx:latest
--> Fetched docker.io/library/nginx:latest: 3.97s
--> Source -> Staging Area: 0.00s
--> Cache -> Staging Area: 0.00s
--> Cache -> Staging Area: 0.00s
--> Prepared step: wercker-init 0.00s
--> Prepared step: script 0.00s
--> Copying source to container
--> Source+Cache -> Guest: 0.06s
export WERCKER="true"
export WERCKER_ROOT="/pipeline/source"
export WERCKER_SOURCE_DIR="/pipeline/source"
export WERCKER_CACHE_DIR="/pipeline/cache"
export WERCKER_OUTPUT_DIR="/pipeline/output"
export WERCKER_PIPELINE_DIR="/pipeline"
export WERCKER_REPORT_DIR="/pipeline/report"
export WERCKER_APPLICATION_ID="web-container"
export WERCKER_APPLICATION_NAME="web-container"
export WERCKER_APPLICATION_OWNER_NAME="wercker"
export WERCKER_APPLICATION_URL="https://app.wercker.com/#applications/web-container"
export TERM="xterm-256color"
export BUILD="true"
export CI="true"
export WERCKER_RUN_ID="d11db6b2-2849-4633-9860-012ec61d0fcb"
export WERCKER_RUN_URL="https://app.wercker.com/#wercker/web-container/dev/d11db6b2-2849-4633-9860-012ec61d0fcb"
export WERCKER_GIT_DOMAIN=""
export WERCKER_GIT_OWNER=""
export WERCKER_GIT_REPOSITORY=""
export WERCKER_GIT_BRANCH="feature/nginx"
export WERCKER_GIT_COMMIT="e60aea409e710d72fc8f66eef984ffc8f235a342"
export WERCKER_BUILD_ID="d11db6b2-2849-4633-9860-012ec61d0fcb"
export WERCKER_BUILD_URL="https://app.wercker.com/#wercker/web-container/dev/d11db6b2-2849-4633-9860-012ec61d0fcb"
--> Step passed: setup environment 4.82s
--> Running step: wercker-init
export WERCKER_STEP_ROOT="/pipeline/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8"
export WERCKER_STEP_ID="wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8"
export WERCKER_STEP_OWNER="wercker"
export WERCKER_STEP_NAME="wercker-init"
export WERCKER_REPORT_NUMBERS_FILE="/report/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/artifacts"
source "/pipeline/wercker-init-2d5de15f-8c44-4d98-a0cd-addb8c584ee8/init.sh"
--> Step passed: wercker-init 0.03s
--> Running step: Copy config files
export WERCKER_STEP_ROOT="/pipeline/script-76c410b5-7832-4409-ac98-8cf6b93d9872"
export WERCKER_STEP_ID="script-76c410b5-7832-4409-ac98-8cf6b93d9872"
export WERCKER_STEP_OWNER="wercker"
export WERCKER_STEP_NAME="script"
export WERCKER_REPORT_NUMBERS_FILE="/report/script-76c410b5-7832-4409-ac98-8cf6b93d9872/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/script-76c410b5-7832-4409-ac98-8cf6b93d9872/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/script-76c410b5-7832-4409-ac98-8cf6b93d9872/artifacts"
source "/pipeline/script-76c410b5-7832-4409-ac98-8cf6b93d9872/run.sh" < /dev/null
--> Step passed: Copy config files 0.05s
--> Steps passed: 7.37s
--> Exported Cache: 1.07s
--> Pipeline finished: 8.44s
--> Fetched run-d11db6b2-2849-4633-9860-012ec61d0fcb:feature_nginx: 15.10s
--> Source -> Staging Area: 0.00s
--> Cache -> Staging Area: 0.00s
--> Cache -> Staging Area: 0.00s
--> Prepared step: wercker-init 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: npm-install 0.04s
--> Prepared step: npm-run 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: script 0.00s
--> Prepared step: watch 0.00s
--> Starting service nginx: /bin/bash
--> Copying source to container
ERROR Session finished before sending commands: [mkdir -p "/pipeline/output"]
ERROR --> Step failed: setup environment 21.41s
context canceled
ERROR context canceled
WARNING Service container has already stopped.
WARNING Box container has already stopped.
FATAL Exiting.
4

0 回答 0