Deploying a Node app in a subdirectory on AWS Elastic Beanstalk

Viewed 664

I am currently in the process of setting up my first Elastic Beanstalk Node application and I have hit a snag.

I followed this tutorial to get a working Express application running with no view-engine (going to be using React):

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html

However, I want to move it to the /app directory so that eventually I can install a Wordpress instance in the root directory to use as a quick public facing intro to our application with a blog.

The project looks like this:

my-app

    // Wordpress Files Here

    /.ebextensions
    /app
        /bin
        /client

            // React Files Here

        /node_modules
        /public
        /routes
        /app.js
        /package-lock.json
        /package.json

With all of the Node files in the root directory, everything works as expected. When I move everything to the app directory and add this to the .ebextensions/01_nodeconfig.config file:

commands:
01_npm_install:
  command: npm install
  cwd: app/

I get this error on eb deploy:

2018-11-09 17:39:35 INFO Environment update is starting.

2018-11-09 17:40:15 INFO Deploying new version to instance(s).

2018-11-09 17:40:22 ERROR [Instance: i-0eedebf7a339e69ca] Command failed on instance. Return code: 1 Output: [Errno 2] No such file or directory: 'app/'. EBExtension failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

2018-11-09 17:40:23 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].

2018-11-09 17:40:23 ERROR Unsuccessful command execution on instance id(s) 'i-0eedebf7a339e69ca'. Aborting the operation.

2018-11-09 17:40:23 ERROR Failed to deploy application.

When I look in the log, here is what is returned:

[2018-11-09T17:40:20.819Z] INFO [26711] - [Application update app-4f25-181109_123930@15/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Activity execution failed, because: [Errno 2] No such file or directory: 'app/' (ElasticBeanstalk::ExternalInvocationError)

Does anyone have an idea on why it cannot find the app directory even though it is right there?

Thanks.

0 Answers
Related