Last active
February 23, 2016 04:45
-
-
Save jalquisola/2e78b9f1c04a862e8ba1 to your computer and use it in GitHub Desktop.
How to deploy Expressjs application using AWS Opsworks?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Login to your aws account. | |
2. Visit Opsworks, https://console.aws.amazon.com/opsworks/home. | |
3. Create new stack. | |
4. In Stack's Configuration Management, provide the following custom JSON: | |
{ | |
"environment_variables": { | |
"NODE_ENV": "production" | |
}, | |
"deploy": { | |
"YOUR_APP_NAME": { | |
"environment_variables": { | |
"NODE_ENV": "production", | |
"PORT": "80" | |
} | |
} | |
} | |
} | |
Note: Nodejs Opsworks require your app to run in port 80 and 443(for https). | |
5. Add Node.js App Server Layer to the newly created stack. | |
6. Add new App with Node.js Type and provide your application source. | |
7. If you generate your application using Express generator, e.g. 'express YOUR_APP_NAME', your app will run using bin/www file. | |
However, Nodejs Opsworks require you to have server.js to run your application. Hence, we need to copy bin/www file to 'YOUR_APP_NAME'/server.js . | |
8. Deploy App. | |
That's all folks. Happy Coding. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment