Where does elastic beanstalk t2 server store my node.js app files?

node.jsAmazon Ec2Amazon Elastic-Beanstalk

node.js Problem Overview


From an architecture perspective I'm trying to get a better understand of how and where files deployed to eb (t2) server are stored.

I see some .zip files in s3 that show when I upload something via the eb interface, though how/where exactly does this get end up on my ec2(t2) server?

node.js Solutions


Solution 1 - node.js

It's in the /tmp/deployment/application folder during deployment and the moved to /var/app/current afterward.

In case you search them, the node logs are in /var/log/nodejs/nodejs.log and the application will bind to 8081 no matter what PORT environment variable you set in the Environment Variables in the console.

Solution 2 - node.js

The top answer seems to be still working in November of 2020 for node app (nuxt app in my case)

/var/app/current

Solution 3 - node.js

As a more general answer (not node.js-specific), check eb-engine.log from your Elastic Beanstalk environment.

Where are the logs? In Elastic Beanstalk's online interface in the sidebar of your environment.

...
2021/06/12 22:40:34.097454 [INFO] app source bundle is zip file ...
2021/06/12 22:40:34.097460 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2021/06/12 22:40:34.097470 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2021/06/12 22:40:34.138333 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
...

Interpretation:

  1. app_source_bundle was uploaded to /opt/elasticbeanstalk/deployment/ initially
  2. app_source_bundle was extracted to /var/app/staging/

If Elastic Beanstalk deployment is successful, you can find the running app's code in /var/app/current (as Manuel pointed out).

Solution 4 - node.js

/var/app/current may be outdated. It doesn't exist on my instance.
As said there https://stackoverflow.com/questions/27973619/i-cant-find-my-web-app-when-i-ssh-to-my-aws-elastic-beanstalk-instance, for python the app is in /opt/python/bundle/2/app/
Otherwise use find to search for the location (look at the link).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJustinView Question on Stackoverflow
Solution 1 - node.jsManuel DarveauView Answer on Stackoverflow
Solution 2 - node.jsatazminView Answer on Stackoverflow
Solution 3 - node.jsJaradView Answer on Stackoverflow
Solution 4 - node.jsM. RichéView Answer on Stackoverflow