How to run Strapi v4 on AWS ElasticBeanstalk - node.js

I'm trying to run Strapi (v.4.4.3) on AWS ElasticBeanstalk with a Node.js v16 runtime environment. The build is performed by using AWS CodePipeline.
The build is completed successfully however the deployment to AWS ElasticBeanstalk (EB) times out with no particular error in the logs. I've checked all available AWS EB logs.
Locally the code can be built and is running fine.
Is there anyone facing the same issue or did find a solution to this behaviour?

Related

How to hide `/var/app/current` source code in elastic beanstalk?

I am trying to deploy a basic react application in elastic beanstalk and when I inspect the browser I can see the source code:
The content of the react app is the default one from create-react-app with default package.json scripts.
The platform on elastic beanstalk is that one Node.js 16 running on 64bit Amazon Linux 2/5.6.3.
Despite I tried to add GENERATE_SOURCEMAP=false in npm build script, and try to configure nginx using proxy.conf, I'm unable to hide the var/app/current folder that is being deployed and has the source code of my react application.
Does someone know how avoid source code to be exposed on elastic beanstalk when deploying it in Node.js platform?

what happens when the command gcloud app deploy --version v1 is issued to deploy a nodejs application?

Can any one help me understand gcloud app deploy? I tried deploying an application but it gave me the error:
ERROR: (gcloud.app.deploy) Error Response: [13] An internal error
occurred while creating a Google Cloud Storage bucket.
Thanks,
-VR
gcloud is google sdk command to interact with its cloud services, you can read more about it here https://cloud.google.com/sdk/gcloud/
you can run gcloud commands either by installing gcloud sdk or from a gcloud shell where sdk is pre-installed.
gcloud app deploy looks for app.yaml which can be configured based on this documentation https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
To address the error try running this command gcloud config set app/use_deprecated_preparation True; and give a try.
once we run gcloud app deploy --version v1 a version of the application is created and can be accessed by the corresponding url from version column.
one can even login to the running instance of VM by accessing respective instance ssh.
this command will tar ball the folder containing app.yaml and will be used to create the running nodejs instance; the entire deployment depends on PORT being used as part of NodeJS application for running production instance, and a proper package.json which will have all the dependencies listed and contains a start script to run the application.


Amazon AWS Elastic Beanstalk NodeJS app

I have created a NodeJS app in Amazon AWS Elastic Beanstalk. Everytime I deploy the app I get following error (in logs):
2016-09-06T15:56:48.332Z] INFO [17369] : Command processor returning results:
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"/bin/sh: npm: command not found. \ncontainer_command 01-install-dependencies in .ebextensions/install.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":127,"events":[]}]}
Any idea what must be causing it?
When deploying a NodeJS application to elastic beanstalk npm install is run automatically for you. You haven't posted the contents of your 01-install-dependencies but guessing from the name and the error message that script runs npm install.
I did some investigation a while back into which npm scripts are automatically run by elastic beanstalk - npm scripts on elastic beanstalk

Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version

I have today a strange issue for Amazon Elastick BeanStalk: for my instances I cannot upload application:
XXX#-Vostro-2520:~/git_projects/ProjectBlog (test-env)$ git aws.push --environment Project-Blog-test
Updating the AWS Elastic Beanstalk environment Project-Blog-test...
Error: Failed to create the AWS Elastic Beanstalk application version
I did test it for 2 instances: PHP and RoR apps.
I solved this on my own:)
Amazon EB allows only for 500 Application Versions. So I logged in to console -> Elastick BeanStalk -> Action -> View Application Versions
On these page I selected and deleted some of olded files uploaded to Amazon EB. After it I was able to upload new versions with EB scripts.
Heads up that the error may also appear if you have invalid characters in the commit description. Not sure what these are to AWS, but I got the same error with the characters "http://".

Deploy yeoman node.js application to Elastic Beanstalk

I have a NodeJS application that I developed using a Yeoman generator that I'm attempting to deploy to an Elastic Beanstalk instance. I'm fairly new to this stack so my apologies if the question seems scattered. I was able to deploy my application using this process: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html. However, when I hit my homepage I just have a blank Node application. I'm guessing this is because the deploy comes straight from my Git repository and my Grunt build process hasn't been run. Is there any way to tell Elastic Beanstalk to run Grunt build after receiving the deployable?
You'll need to setup Grunt to run with a deployment hook on AWS. This is done with container commands.
Checkout this answer: How to automatically restart delayed_job when deploying a rails project on Amazon Elastic Beanstalk?
And this relevant blog post: http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/

Resources