AWSinAction / code

Code of Amazon Web Services in Action, 1st edition
https://www.manning.com/books/amazon-web-services-in-action
MIT License
269 stars 162 forks source link

Chapter 5: etherpad won't run on new AMI due to node version conflict #9

Closed knguyen0105 closed 6 years ago

knguyen0105 commented 7 years ago

After deploying etherpad on elasticbeanstalk and going to the address of the application, i get 'bad gateway' error.

I check the log and in the first few lines:

npm ERR! npm owner ls etherpad-lite npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /var/app/current/npm-debug.log

etherpad-lite@ start /var/app/current bin/run.sh

You're running a wrong version of node, or io.js is not installed. You're using v6.10.0, we need v0.8.x, v0.10.x, v0.11.x or v0.12.x

npm ERR! Linux 4.4.44-39.55.amzn1.x86_64

A quick solution is downgrading the environment to an older version of the AMI on the web mangement interface. I used the v2015 one.

michaelwittig commented 7 years ago

We recently fixed something in the example. When did you run the commands?

knguyen0105 commented 7 years ago

I were working on the chapter today. The problem is with version 2016 of the AMI.

michaelwittig commented 7 years ago

you need to run:

aws elasticbeanstalk create-application --application-name etherpad

aws elasticbeanstalk create-application-version --application-name etherpad --version-label 1.5.2 --source-bundle S3Bucket=awsinaction,S3Key=chapter5/etherpad.zip

aws elasticbeanstalk list-available-solution-stacks --output text --query "SolutionStacks[?contains(@, 'running Node.js')] | [0]"

# replace $SolutionStackName with the output from above
aws elasticbeanstalk create-environment --environment-name etherpad --application-name etherpad --option-settings Namespace=aws:elasticbeanstalk:environment,OptionName=EnvironmentType,Value=SingleInstance --solution-stack-name "$SolutionStackName" --version-label 1.5.2
mslifka commented 6 years ago

I successfully ran the app. but when I go the CNAME (http://etherpad.9s8gyiik3w.us-east-1.elasticbeanstalk.com/), its taking me to a Node.js landing page:

"Congratulations Your first AWS Elastic Beanstalk Node.js application is now running on your own dedicated environment in the AWS Cloud"

What could possibly be wrong? My environment output is below:

{ "Environments": [ { "ApplicationName": "etherpad", "EnvironmentName": "etherpad", "VersionLabel": "1.6.2", "Status": "Ready", "EnvironmentArn": "arn:aws:elasticbeanstalk:us-east-1:520104956268:environment/etherpad/etherpad", "EnvironmentLinks": [], "PlatformArn": "arn:aws:elasticbeanstalk:us-east-1::platform/Node.js running on 64bit Amazon Linux/4.4.0", "EndpointURL": "34.225.75.140", "SolutionStackName": "64bit Amazon Linux 2017.09 v4.4.0 running Node.js", "EnvironmentId": "e-qs3znpu2cp", "CNAME": "etherpad.9s8gyiik3w.us-east-1.elasticbeanstalk.com", "AbortableOperationInProgress": false, "Tier": { "Version": "1.0", "Type": "Standard", "Name": "WebServer" }, "Health": "Green", "DateUpdated": "2017-12-16T22:31:20.197Z", "DateCreated": "2017-12-16T22:27:09.908Z" } ]

mslifka commented 6 years ago

The output I'm receiving from:

aws elasticbeanstalk list-available-solution-stacks --output text --query "SolutionStacks[?contains(@, 'running Node.js')] | [0]"

is "64bit Amazon Linux 2017.09 v4.4.0 running Node.js"

Is this the $SolutionStackName ?????

mslifka commented 6 years ago

dahhh! I fixed it! no idea how. but i redid, and its working :)