rsms / ec2-webapp Goto Github PK
View Code? Open in Web Editor NEWA template I use to quickly set up Node.js-backed web apps on Amazon EC2
A template I use to quickly set up Node.js-backed web apps on Amazon EC2
First let me say, big thanks for this project. Although I didn't use much of the move stuff, it's the perfect tutorial to get a node app on EC2 up and running!
I only noticed, that when generating a key in behalf of www-data
$ sudo git pull
doesn't seams to work. The key can't be found, since ssh
looking in /root/.ssh/
for the key.
When just doing sudo ssh-keygen -t rsa
everything is fine.
Or did I miss something?
I have followed your suggestions from a previous post (to restart, then check for a connection on Port 3000).
I suspect the move script may not actually be executing; after adding a few print statements, no visible results. Can you suggest a debug approach?
curl: (7) couldn't connect to host
Not an issue as much as a (few) comments...
First, thank you for your efforts. I have a similar "recipe" but did not have the forethought to share via GIT - my only-child mentality prevents me from sharing.
A few thoughts/additions...
edit /etc/ssh_config
uncomment Host *
uncomment ForwardAgent
change ForwardAgent no TO ForwardAgent yes
Thanks again
thanks!
Attempting to run a local build using node v0.6.5+ throws and error
node bin/myapp-httpd.mv
/you/myapp/bin/performance-httpd.mv:2
require.paths.unshift __dirname+'/../nodelib'
^^^^^^^^^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
It appears there may be simular issue as noted here:
bnoguchi/everyauth#109
Thanks for this write, i got it through to the step of creating a symbolic link here:
ubuntu$ sudo ln -s /var/myapp/init.d/myapp-httpd /etc/init.d/
my first run through i got this error:
update-rc.d: /etc/init.d/myapp-httpd: file does not exist
so i figured i should make the directory structure in the ln
command so:
ubuntu$ sudo mkdir /var/myapp/init.d/myapp-httpd
then again:
ubuntu$ sudo ln -s /var/myapp/init.d/myapp-httpd /etc/init.d/
ln: creating symbolic link `/etc/init.d/myapp-httpd': File exists
but then when i run the update-rc.d command i get this:
ubuntu$ sudo update-rc.d myapp-httpd defaults
update-rc.d: /etc/init.d/myapp-httpd: file does not exist
is there a step i'm missing? should I not be creating the init.d/myapp-httpd folder?
First of all, thank you for putting this together. I feel like I'm close and I wouldn't be if not for this guide.
I've followed all the steps on install.md. At the end I try to curl http://127.0.0.1 and I get:
502 Bad Gateway
I also don't see anything set up on port 3000.
(curl: (7) couldn't connect to host)
I tried adding the sample node.js from the node.js site to a file in nodelib called ws.js:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
But nothing come sup on port 8124 either.
I really don't know what I'm doing and I've learned a ton from executing the guide. As best I can tell, I've started both the myapp-httpd and myapp-processor(and maybe this is my mistake, it said optional and optionally so I did both). Any help would be greatly appreciated.
Since SSH isn't built into Windows (Boo!) it involves a few more steps to SSH into an EC2 instance. I could write a step by step guide that shows how to do it with putty/putty gen etc.
I'd make it a separate markdown document and just link to it in the INSTALL.md file.
Let me know and I'll update my fork and do a pull request.
Great work, thanks. I'm playing around with this to evaluate it for CI for my AWS apps, including modifying it for use with Tornado in place of Node.
However, I'm new to Node and am a little unclear on the directory structure here. In the Install.md instructions it's not quite clear what directory we're working from: ~, /var/www, /var/myapp, /var/ec2-webapp?
What should the final directory structure look like?
/var/www/
/var/www/src/node
/var/ec2-webapp/
/var/myapp/
Edit: or now that I've played around with it more, should it be:
/var/ec2-webapp/
/var/ec2-webapp/src/node
/var/ec2-webapp/src/myapp
Or something else?
Thanks!
Im a bit of a n00b so maybe I'm missing something.
When attempting to run through the workflow 1 an error message displayed when remotely restarting the services
cd src/myapp
git commit ...
ssh -i ~/.ssh/myapp.pem [email protected]:/var/myapp/update restart
# ssh: Could not resolve hostname myapp:/var/myapp/update: nodename nor servname provided, or not known
Changing the SSH command to the following worked for me.
cd src/myapp
git commit ...
git push origin master
ssh -i ~/.ssh/myapp.pem ubuntu@myapp '/var/performance/update restart'
# some stats ...
I think adding a simple post commit hook to execute the update restart
on my local makes this brain dead simple.
Thanks so much for this excellent project!
Hi, I was just following your instructions blindly
ubuntu@ip-10-88-163-66:~/node/src$ sudo npm install connect connect_json move
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: [email protected]
npm ERR! Required: {"node":">= 0.4.1 < 0.5.0"}
npm ERR! Actual: {"npm":"1.0.22","node":"v0.5.3-pre"}
npm ERR!
npm ERR! System Linux 2.6.35-24-virtual
npm ERR! command "node" "/usr/local/bin/npm" "install" "connect" "connect_json"
"move"
npm ERR! cwd /home/ubuntu/node/src
npm ERR! node -v v0.5.3-pre
npm ERR! npm -v 1.0.22
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ubuntu/node/src/npm-debug.log
npm not ok
/etc/nginx/sites-available/myapp-httpp
currently is:
location / {
root /var/myapp/public;
index index.html;
error_page 404 = @backend;
}
should:
location / {
root /var/myapp/public;
index index.html;
error_page 404 = @backend;
error_page 403 = @backend;
}
otherwise it is not possible return something from node.js on the root (i.e.: http://www.myapp.com/) of the domain, as nginx (if the 'public' folder exists) needs to handle an HTTP 403 instead of an HTTP 404.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.