CodeDeploy: Script at specified location failed to close STDOUT

0

I am trying to add the following script to the ApplicationStart section of my CodeDeploy appspec.yml:

# collect_static_files.sh
#!/bin/bash

# source other files, change dir, activate python here

./manage.py collectstatic --noinput

With this file added deploys fail with

Script at specified location: scripts/deploy/collect_static_files.sh failed to close STDOUT

The log for the ApplicationStart event doesn't show anything other than the command output:

[stderr]You are using pip version 18.1, however version 21.3.1 is available.
[stderr]You should consider upgrading via the 'pip install --upgrade pip' command.
Script - scripts/deploy/collect_static_files.sh
[stdout]
[stdout]170 static files copied to '/var/www/mydir/static'.

I've tried turning off and redirecting output:

# ./manage.py collectstatic --noinput > /dev/null 2>&1
# ./manage.py collectstatic --noinput --verbosity 0

Neither of which clear the error and even if they did wouldn't really solve the problem as I would like the output added to the log.

There is something similar discussed on the codedeploy agent GitHub but for backgrounded commands. Also did a search for closing STDOUT but that doesn't seem like something I should be doing manually. What am I missing?

JP
질문됨 2년 전1902회 조회
1개 답변
0
수락된 답변

Increasing the timeout fixed it:

  ApplicationStart:
    - location: scripts/deploy/collect_static_files.sh
      timeout: 60

Previous values was 5. The command itself runs much quicker than that though so I'm not sure it was timing out.

JP
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠