弹性 bean 跟踪 t2服务器在哪里存储我的 node.js 应用程序文件?

从架构的角度来看,我试图更好地理解部署到 eb (t2)服务器的文件是如何存储的以及存储在哪里的。

我看到了。S3中的 zip 文件,当我通过 eb 界面上传某些内容时,它们会显示出来,但是这些内容是如何/在哪里最终出现在我的 ec2(t2)服务器上的呢?

40109 次浏览

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.

/var/app/current may be outdated. It doesn't exist on my instance.
As said there I can't 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).

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

/var/app/current

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).