elastic beanstalk node application within subdirec

2019-06-27 05:09发布

How can I force elastic beanstalk nodejs application to look for the server application within a subdirectory server?

I'm building a modern SPA which has server and client application within one git project. Thus elastic beanstalk must not look for the server application within the root of the repository but within the subfolder ./server/. Client SPA is coded within ./client/ and build into an public folder within the server folder structure during build process. The fully build client version is checked in into git and must not be build while roleout.

So elastic beanstalk must npm install and npm run within the server sub directory.

Example folder structure:

~ git-root
|-- client
|    |-- ...
|
|-- server
|   |-- package.json
|   |-- src
|   |-- public
|   |-- (node_modules)

1条回答
三岁会撩人
2楼-- · 2019-06-27 05:43

Elastic beanstalk is using some server configuration which can be changed. To change that configuration you can ssh to that machine or you can force proper configuration every application deployment.

The second approach is possible with adding custom code into .ebextensions folder placed in the root folder of your app.

More info about custom commands .ebextensions can be found i.e here:

查看更多
登录 后发表回答