Amazon Beanstalk installs node and npm into really obscure places - and I'm not sure they won't change if EB decides to use a newer version of node, which would cause my application to break.
These are the locations for node and npm:
/opt/elasticbeanstalk/node-install/node-v0.8.24-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v0.8.24-linux-x64/bin/npm
I'm worried about the 0.8.24
part changing and I'd rather not grep for things in cron or monit scripts when trying to find something that is normally just /usr/bin/XXX
.
how do I get a consistent filepath for these executables? and why does EB do this?
for reference, I tried setting the NodeVersion
option in an .ebextensions/app.config
, it had no effect on the install location.
By default, Elastic Beanstalk installs dependencies in production mode ( npm install --production ).
To do this, let's go to the AWS Console and sign in. Select “IAM” from the list of services. Under the IAM service, let's click on the “Users” section on the left menu and click “Add user”. In this section, let's name our user as “deploy-eb” and select “Programmatic access”.
In Elastic Beanstalk, where does it store the application files and server log files? Application files are stored in S3. The server log files can only be stored in the attached EBS volumes of the EC2 instances, which were launched by AWS Elastic Beanstalk. Application files are stored in S3.
You can add the most recent node and npm binaries to $PATH with a command like this:
PATH=$PATH:`ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin
I couldn't figure out how to prevent beanstalk commands from resetting the $PATH back again.
If you are so inclined you can probably create a symlink with a command similar to the above and use that as your reference point in cron scripts etc.
Agreed, it is very very annoying.
Following Peter Johnson & Greg Tatum replies I created a symlink to the latest node executable:
container_commands: 01_node_binary: command: "ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With