diff --git a/README.md b/README.md index a97a30bb79..eea8bde509 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Skybreak -Skybreak is an ultra-simple framework for building modern websites and web applications. What once took weeks, now takes hours in Skybreak. +Skybreak is an ultra-simple environment for building modern web +applications. With Skybreak you write apps: @@ -8,13 +9,13 @@ With Skybreak you write apps: * that send data over the wire, rather than HTML * using your choice of popular open-source libraries -**Have a look at the main Skybreak documentation here:** +Please, do not share or blog about Skybreak yet. It is experimental, +pre-release software. We hope it shows the direction of our thinking, +and much of it will to change. We'd love to hear your feedback. -http://preview.skybreakplatform.com +Documentation is available at http://preview.skybreakplatform.com -**This is still pre-release software. If you use it please, PLEASE sign up on the website above. Especially if you deploy a web site with ```skybreak deploy```** - -## Quick Start (normal install process) +## Quick Start Install Skybreak (only OS X, for now): @@ -33,35 +34,40 @@ Deploy it to the world, for free: skybreak deploy try-skybreak.skybreakplatform.com - ## Slow Start (for developers) -If you want to run on the bleeding edge, or help develop Skybreak, you can run Skybreak directly from a git checkout. +If you want to run on the bleeding edge, or help develop Skybreak, you +can run Skybreak directly from a git checkout. git clone git@github.com:skybreak/skybreak.git cd skybreak -If you're the sort of person who likes to build everything from scratch, you can build all the Skybreak dependencies (node.js, npm, mongodb, etc) with the provided script. If you do not run this script, Skybreak will automatically download pre-compiled binaries when you first run it. +If you're the sort of person who likes to build everything from scratch, +you can build all the Skybreak dependencies (node.js, npm, mongodb, etc) +with the provided script. If you do not run this script, Skybreak will +automatically download pre-compiled binaries when you first run it. # OPTIONAL ./admin/generate-dev-bundle.sh -Now you can run skybreak directly from the checkout (if you did not build the dependency bundle above, this will take a few moments to download a pre-build version). +Now you can run skybreak directly from the checkout (if you did not +build the dependency bundle above, this will take a few moments to +download a pre-build version). ./skybreak --help -Or install to ```/usr/local``` like the normal install process. This will cause ```skybreak``` to be in your ```PATH```. +Or install to ```/usr/local``` like the normal install process. This +will cause ```skybreak``` to be in your ```PATH```. ./install.sh skybreak --help - - ## Developer Resources Get in touch! We'd love to hear what you think. You can get involved in several ways: +* Announcement list: sign up at http://preview.skybreakplatform.com/ * Google group for discussion: http://groups.google.com/group/skybreak-users * IRC: ```#skybreak``` on ```irc.freenode.net``` * Email us: ```info@skybreakplatform.com``` diff --git a/app/skybreak/run.js b/app/skybreak/run.js index dde4f3dd06..45ab38960e 100644 --- a/app/skybreak/run.js +++ b/app/skybreak/run.js @@ -49,8 +49,8 @@ Status = { ////////// Outer Proxy Server ////////// -var start_proxy = function (outer_port, inner_port) { - httpProxy.createServer(function (req, res, proxy) { +var start_proxy = function (outer_port, inner_port, callback) { + var p = httpProxy.createServer(function (req, res, proxy) { if (Status.running) { // server is running. things are hunky dory! proxy.proxyRequest(req, res, { @@ -74,11 +74,25 @@ var start_proxy = function (outer_port, inner_port) { }); res.end(); - } - }).listen(outer_port, function () { - process.stdout.write("Running on: http://localhost:" + outer_port + "/\n"); }); + + p.on('error', function (err) { + if (err.code == 'EADDRINUSE') { + process.stderr.write("Can't listen on port " + outer_port + + ", perhaps another Skybreak is running?\n"); + process.stderr.write("\n"); + process.stderr.write("Running two copies of Skybreak in the same application directory\n"); + process.stderr.write("will not work. If something else is using port " + outer_port + ", you can\n"); + process.stderr.write("specify an alternative port with --port .\n"); + } else { + process.stderr.write(err + "\n"); + } + + process.exit(1); + }); + + p.listen(outer_port, callback); }; ////////// MongoDB ////////// @@ -371,42 +385,44 @@ exports.run = function (app_dir, bundle_path, bundle_opts, port) { } }; - process.stdout.write("[[[[[ " + files.pretty_path(app_dir) + " ]]]]]\n\n"); - if (!files.in_checkout()) start_update_checks(); - start_proxy(outer_port, inner_port); - var server; - var restart_server = function () { - if (server) - kill_server(server); - server_log = []; + start_proxy(outer_port, inner_port, function () { + process.stdout.write("[[[[[ " + files.pretty_path(app_dir) + " ]]]]]\n\n"); + process.stdout.write("Running on: http://localhost:" + outer_port + "/\n"); - try { - bundle(); - } catch (e) { - log_to_clients({system: e.stack}); - Status.hard_crashed(); - return; - } + var server; + var restart_server = function () { + if (server) + kill_server(server); + server_log = []; - server = start_server(bundle_path, inner_port, mongo_url, function () { - Status.soft_crashed(); - if (!Status.crashing) - restart_server(app_dir); - }); - }; + try { + bundle(); + } catch (e) { + log_to_clients({system: e.stack}); + Status.hard_crashed(); + return; + } - var launch = function () { - launch_mongo(app_dir, mongo_port, - function () { // On Mongo startup complete - restart_server(); - }, - function () { // On Mongo dead - // XXX wait a sec to restart. - setTimeout(launch, 1000); - }); - }; - launch(); + server = start_server(bundle_path, inner_port, mongo_url, function () { + Status.soft_crashed(); + if (!Status.crashing) + restart_server(app_dir); + }); + }; + + var launch = function () { + launch_mongo(app_dir, mongo_port, + function () { // On Mongo startup complete + restart_server(); + }, + function () { // On Mongo dead + // XXX wait a sec to restart. + setTimeout(launch, 1000); + }); + }; + launch(); + }); }; diff --git a/app/skybreak/skybreak.js b/app/skybreak/skybreak.js index 9a3148dc5d..232fc1acf3 100644 --- a/app/skybreak/skybreak.js +++ b/app/skybreak/skybreak.js @@ -363,11 +363,11 @@ Commands.push({ .boolean('url') .boolean('U') .alias('url', 'U') - .describe('url', 'request a Mongo URL') + .describe('url', 'return a Mongo database URL') .usage( "Usage: skybreak mongo [--url] [site]\n" + "\n" + -"Open a Mongo shell to view or manipulate collections.\n" + +"Opens a Mongo shell to view or manipulate collections.\n" + "\n" + "If site is specified, this is the hosted Mongo database for the deployed\n" + "Skybreak site.\n" + @@ -427,15 +427,27 @@ Commands.push({ var opt = require('optimist') .boolean('password') .alias('password', 'P') - .describe('password', 'set a password for the deployment') + .describe('password', 'set a password for this deployment') .boolean('delete') .alias('delete', 'D') - .describe('delete', "permanently delete this project and its data from Skybreak") + .describe('delete', "permanently delete this deployment") .usage( -"Usage: skybreak deploy \n" + +"Usage: skybreak deploy [--password] [--delete]\n" + "\n" + -"Deploy the current code in your tree to the specified subdomain of\n" + -"skybreakplatform.com.\n" +"Deploys the project in your current directory to Skybreak's servers.\n" + +"\n" + +"You can deploy to any available name under 'skybreakplatform.com'\n" + +"without any additional configuration, for example,\n" + +"'myapp.skybreakplatform.com'. If you deploy to a custom domain, such as\n" + +"'myapp.mydomain.com', then you'll also need to configure your domain's\n" + +"DNS records. See the Skybreak docs for details.\n" + +"\n" + +"The --delete flag permanently removes a deployed application, including\n" + +"all of its stored data.\n" + +"\n" + +"The --password flag sets an administrative password for the domain. Once\n" + +"set, any subsequent 'deploy', 'logs', or 'mongo' command will prompt for\n" + +"the password. You can change the password with a second 'deploy' command.\n" ); new_argv = opt.argv; @@ -462,7 +474,7 @@ Commands.push({ process.stdout.write( "Usage: skybreak logs \n" + "\n" + -"Retrieves the logs for the requested site.\n"); +"Retrieves the server logs for the requested site.\n"); process.exit(1); }