1

The working directory to execute container_command defined in the application's .ebextensions is /tmp on the sample custom platform NodePlatform_Ubuntu, while I expected it to be the staging directory as stated in this document.

How can I change the working directory to the staging (the root of unzipped source code) directory?

This is .ebextensions/foo.config of the test app to see the working directory.

container_commands:
  10-test:
    command: env

Then, this is its output in /var/log/eb-activity.log.

[2018-04-30T04:26:54.394Z] INFO  [19153] - [Application update test-app-4@4/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cocci_custom_eb_test/Command 10-test] : Starting activity...
[2018-04-30T04:26:54.399Z] INFO  [19153] - [Application update test-app-4@4/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cocci_custom_eb_test/Command 10-test] : Completed activity. Result:
  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
  PWD=/tmp
  SHLVL=1
  HOME=/root
  EB_IS_COMMAND_LEADER=true
  _=/usr/bin/env

[2018-04-30T04:26:54.618Z] INFO  [19153] - [Application update test-app-4@4/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cocci_custom_eb_test/Command 20-check-process] : Starting activity...
1
  • It seems the working directory is defined by app_staging_dir. sudo /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir returns /tmp. But now, how can I set app_staging_dir?
    – kanji
    Apr 30, 2018 at 5:57

1 Answer 1

0

I could change it by specifying it in platform.yaml file of the custom platform.

container:
  app_staging_dir: "/var/app/staging"

The log of container_command;

[2018-04-30T09:49:14.452Z] INFO  [1482]  - [Application deployment test-app-4@2/StartupStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_cocci_custom_eb_test/Command 10-test] : Completed activity. Result:
  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
  PWD=/var/app/staging
  SHLVL=1
  HOME=/root
  EB_IS_COMMAND_LEADER=false
  _=/usr/bin/env

I'm guessing that other options can be specified in the same way.

ubuntu@ip-xxxxxx:~$ sudo /opt/elasticbeanstalk/bin/get-config container --output YAML
---
app_staging_dir: "/var/app/staging"
instance_port: '80'
config_staging_dir: "/tmp"
common_log_list:
- "/var/log/eb-activity.log"
log_group_name_prefix: "/aws/elasticbeanstalk"
source_bundle: "/opt/elasticbeanstalk/deploy/appsource/source_bundle"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.