node.js code implementation
Budjetti €30-250 EUR
I have this code:
var http = require('http')
, url = require('url')
, util = require('util')
, exec = require('child_process').exec;
var site = [url removed, login to view](80, "[url removed, login to view]", false);
var req = [url removed, login to view]("GET", "/");
[url removed, login to view]();
[url removed, login to view]('response', function(res){
if([url removed, login to view] !== 200){
// launch a new instance
var ec2 = require("ec2")
, fs = require("fs");
// Read in the configuration above.
var configuration =
[url removed, login to view]([url removed, login to view]("[url removed, login to view]", "utf8"));
// Create an ec2 function that uses your configuration.
ec2 = ec2(configuration)
// Run an instance and wait for it to become ready.
ec2("RunInstances", {
ImageId: "ami-XXXXXX"
, KeyName: "micros-ie"
, InstanceType: "[url removed, login to view]"
, MinCount: 1
, MaxCount: 1
}, function (error, response) {
if (error) {
throw error
}
ready();
});
} else {
[url removed, login to view]('data', function(chunk){
function puts(error, stdout, stderr) { [url removed, login to view](stdout) }
exec("my command", puts);
});
}
});
basically, i would like to launch a new EC2 instance if the status code is not equal to 200. this works ok, but my problem is that when the code goes into the 'else' loop, i would like to check if the 'site' still returns a 200 status code.
So, i need this to be put into a function and then use recursion.
Also, the output of the exec("my command", puts); needs to be fed into a redis database.
7 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön
We have an expert team for javascript and database handling.... Please provide a chance to work with you. Hope for good response.
I have great easperience working with nodejs ( also i've had some contribtutions to the node-mongodb-native driver). You can check out some public work done here: [url removed, login to view] Thanks
Not much experience with node as well as handling EC2 instances but what you require seems simple enough to increase my node-foo. Please pick while keeping in mind the aforementioned factor. :)