TL;博士;
我正在尝试使用wercker将nginx作为本地服务运行到我的dev管道,但我找不到正确的方法来执行此操作。
有人能指出一个包含nginx作为本地服务的wercker multicontainer应用程序的工作示例吗?
我的项目是一个Django应用程序,dev管道目前工作正常,只有一个数据库注册为服务。我正在努力将网络服务器容器化,我希望将其作为本地服务。
根据本文档的“本地服务”部分: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会话在发送命令之前完成:[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.