angularjs - how to deploy a yeoman build to aws node.js -
i'm new yeoman , trying basic yeoman generated angularjs site deployed elastic beanstalk. @ moment when deploy receive 502: bad gateway. able deploy simple nodejs app aws like
server.js
var http = require("http"); http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.write("hello world"); response.end(); }).listen(process.env.port || 8888);
without specifying port in url, page works fine. not sure if relevant issue.
the process using yeoman angular generator pretty standard ie.
yo angular yo angular:controller testcontroller ..add directives / views etc.. grunt server -- serves pages correctly on port 9000 grunt -- creates dist folder
at stage have working angularjs app locally, here follow same workflow deployed earlier hello world sample correctly ( commit git repo, provision image elastic beanstalk cli..etc..). made repo based on contents of /dist folder , deployed 502..
there 2 leads have here, firstly should listening on port 80 - although earlier sample on :8888 worked think next requirement relevant, file named server.js in root directory.
the grunt build output \dist contains:
bower_components views styles scripts 25e920e4.modules.js 5e188624.scripts.js 76c21dca.plugins.js
so i'm not sure next step. noticed app.js not part of dist output have these 3 new script js files. need configure make nodejs container serve new structure?
here's original app.js
'use strict'; angular.module('nodealphaapp', []) .config(function ($routeprovider) { $routeprovider .when('/', { templateurl: 'views/main.html', controller: 'mainctrl' }) .otherwise({ redirectto: '/' }); });
let me know if can provide more info
cheers!
i had same exact problem! want use grunt buildcontrol
there no option aws. grunt buildcontrol
pushes remote, not how elastic beanstalk deploys.
when type eb deploy
, deploy within .git directory, not dist/
directory. work-around create local git repository within dist/
.
- remove elastic beanstalk files in repo. fyi, they're hidden.
- using terminal,
cd dist/
project's root folder. - run
git init
create local git repo. - make initial commit, because
dist/
has been .gitignore-d. - run
eb init
,eb create
,eb deploy
normal withindist/
. - set environmental variables, if need them; app doesn't.
eb open
, fingers crossed.
Comments
Post a Comment