1
0
Fork 0

fixed Web-Front-End access via /

This commit is contained in:
Frank Celler 2012-05-13 15:18:21 +02:00
parent a0da951b7a
commit 1f7d7ea334
11 changed files with 205 additions and 79 deletions

View File

@ -1,5 +1,6 @@
> ./arango --port 8529 /tmp/vocbase
2011-12-05T09:58:31Z [2690] INFO ArangoDB (version 1 (9711)) is ready for business
2011-12-05T09:58:31Z [2690] INFO HTTP client port: 8529
2011-12-05T09:58:31Z [2690] INFO HTTP admin port: localhost:8530
2011-12-05T09:58:31Z [2690] INFO Have Fun!
> ./arangod /tmp/vocbase
2012-05-13T12:37:08Z [8145] INFO no user init file '/home/fceller/.arango/arango.conf' found
2012-05-13T12:37:08Z [8145] INFO using built-in JavaScript startup files
2012-05-13T12:37:08Z [8145] INFO ArangoDB (version 0.5.0) is ready for business
2012-05-13T12:37:08Z [8145] INFO HTTP client/admin port: 127.0.0.1:8529
2012-05-13T12:37:08Z [8145] INFO Have Fun!

View File

@ -388,7 +388,7 @@ WIKI = \
ShellEdge \
ShellIndex \
SimpleQueries \
UserManualServer \
UserManual \
UserManualServerBasics \
UserManualShell \
UserManualShellStartStop \

View File

@ -981,7 +981,7 @@ WIKI = \
ShellEdge \
ShellIndex \
SimpleQueries \
UserManualServer \
UserManual \
UserManualServerBasics \
UserManualShell \
UserManualShellStartStop \

View File

@ -1,7 +1,7 @@
# ArangoDB
We recently started a new open source project a nosql database
called ArangoDB which became ArangoDB in May 2012. ArangoDB is
We recently started a new open source project - a nosql database
called AvocadoDB which became ArangoDB in May 2012. ArangoDB is
currently pre-alpha. We want to have a version 1 ready by end of May
2012, a multi server version is planned for the third quarter of
2012. For details see the roadmap.
@ -11,8 +11,8 @@ Key features include:
* Schema-free schemata let you combine the space efficiency of MySQL with the performance power of NoSQL
* Use ArangoDB as an application server and fuse your application and database together for maximal throughput
* JavaScript for all: no language zoo, you can use one language from your browser to your back-end
* ArangoDB is multi-threaded exploit the power of all your cores
* Flexible data modeling: model your data as combination of key-value pairs, documents or graphs perfect for social relations
* ArangoDB is multi-threaded - exploit the power of all your cores
* Flexible data modeling: model your data as combination of key-value pairs, documents or graphs - perfect for social relations
* Free index choice: use the correct index for your problem, be it a skip list or a n-gram search
* Configurable durability: let the application decide if it needs more durability or more performance
* No-nonsense storage: ArangoDB uses all of the power of modern storage hardware, like SSD and large caches
@ -21,7 +21,7 @@ Key features include:
For more in-depth information
* read more on the [design goals of ArangoDB](http://www.arangodb.org/2012/03/07/arangodbs-design-objectives)
* [watch the video](http://vimeo.com/36411892) Martin Schoenert, architect of ArangoDB, gives an introduction of what the ArangoDB project is about.
* [watch the video](http://vimeo.com/36411892) - Martin Schoenert, architect of ArangoDB, gives an introduction of what the ArangoDB project is about.
* or give it a try.
## Compilation

View File

@ -42,25 +42,36 @@
/// @warning
/// ArangoDB is currently pre-alpha. We want to have a version 1 ready by end
/// of May 2012, a multi server version is planned for the third quarter of
/// 2012. The document is far from complete.
/// 2012. The document is still far from complete. Please contact
/// <a href="http://www.arangodb.org/connect">us</a>, if you have any questions.
///
/// @section ArangoDBServer ArangoDB Server (Version @VERSION)
/// @section ArangoDBUserManual ArgangoDB's User Manuals (Version @VERSION)
///////////////////////////////////////////////////////////////////////////
///
/// <ul>
/// <li>@ref UserManual (<a href="http://www.arangodb.org/manuals/user-manual.pdf">pdf</a>)</a></li>
/// <li>@ref Glossary</li>
/// </ul>
///
/// @section ArangoDBAdminManual ArangoDB's Administrator Manuals (Version @VERSION)
////////////////////////////////////////////////////////////////////////////////////
///
/// <ul>
/// <li>@ref InstallManual (<a href="http://www.arangodb.org/manuals/install-manual.pdf">pdf</a>)</li>
/// <li>@ref UserManualServer (<a href="http://www.arangodb.org/manuals/user-manual-server.pdf">pdf</a>)</a></li>
/// <li>@ref Glossary</li>
/// </ul>
///
/// @section ArangoDBAPIManual ArangoDB's Developer Manuals (Version @VERSION)
//////////////////////////////////////////////////////////////////////////////
///
/// <ul>
/// <li>@ref ImplementorManual (<a href="http://www.arangodb.org/manuals/implementor-manual.pdf">pdf</a>)</li>
/// <li>@ref RefManual</li>
/// <li>@ref Glossary</li>
/// </ul>
///
/// @section ArangoDB ArangoDB Shell
///
/// <ul>
/// <li>@ref UserManualShell</li>
/// </ul>
///
/// @section HomeApi API
////////////////////////
///
/// @subsection HomeCLINQ C\# / LINQ
///
@ -85,14 +96,15 @@
/// https://groups.google.com/forum/#!forum/ashikawa
///
/// @section HomeStayInContact Stay in Contact
//////////////////////////////////////////////
///
/// Frank is twittering for the project on Twitter using <a
/// href="http://www.twitter.com/fceller">@@fceller</a>. We've also a
/// "generic" twitter account mainly for announcements called <a
/// href="http://www.twitter.com/fceller">@@fceller</a>. We've also a "generic"
/// twitter account mainly for announcements called <a
/// href="http://www.twitter.com/arangodb">@@arangodb</a>
///
/// You can also subscribe to a low traffic announcement list on the
/// <a href="http://www.arangodb.org/connect">connect page</a>.
/// You can also subscribe to a low traffic announcement list on the <a
/// href="http://www.arangodb.org/connect">connect page</a>.
////////////////////////////////////////////////////////////////////////////////
// Local Variables:

View File

@ -25,23 +25,6 @@
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @page UserManualServer ArangoDB's User Manual
///
/// @if LATEX
/// <ul>
/// <li>@ref UserManualServerBasics</li>
/// <li>ArangoQueryLanguage</li>
/// <li>@ref Glossary</li>
/// </ul>
/// @else
/// @copydetails UserManualServerBasicsTOC
/// <ul>
/// <li>Arango Query Language</li>
/// </ul>
/// @endif
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @page UserManualServerBasicsTOC
///
@ -61,26 +44,74 @@
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @page UserManualServerBasics Basics
/// @page UserManualServerBasics About ArangoDB
///
/// The ArangoDB groups documents into collections. Each collection can be
/// accessed using queries. For simple queries involving just one collection,
/// you can use a simple interface from within JavaScript code, see ArangoDB
/// shell user manual. This interface allows you to select documents from one
/// collection based on simple search criteria. For more complex queries, you
/// can use the Arango Query Language, which is an evolution of SQL resp. UNQL.
/// We recently started a new open source project - a universal nosql database
/// called AvocadoDB which became ArangoDB in May 2012.
///
/// Key features include:
///
/// <ul>
/// <li> Schema-free schemata let you combine the space efficiency of MySQL with
/// the performance power of NoSQL</li>
/// <li> Use ArangoDB as an application server and fuse your application and
/// database together for maximal throughput</li>
/// <li> JavaScript for all: no language zoo, you can use one language from your
/// browser to your back-end</li>
/// <li> ArangoDB is multi-threaded - exploit the power of all your cores</li>
/// <li> Flexible data modeling: model your data as combination of key-value pairs,
/// documents or graphs - perfect for social relations</li>
/// <li> Free index choice: use the correct index for your problem, be it a skip
/// list or a n-gram search</li>
/// <li> Configurable durability: let the application decide if it needs more
/// durability or more performance</li>
/// <li> No-nonsense storage: ArangoDB uses all of the power of modern storage
/// hardware, like SSD and large caches</li>
/// <li> It is open source (Apache Licence 2.0)</li>
/// </ul>
///
/// For more in-depth information
///
/// <ul>
/// <li> read more on the <a href="http://www.arangodb.org/2012/03/07/arangodbs-design-objectives">
/// design goals of ArangoDB</a></li>
/// <li> <a href="http://vimeo.com/36411892">watch the video</a> - Martin Schoenert,
/// architect of ArangoDB, gives an introduction of what the ArangoDB project
/// is about.</li>
/// <li> or give it a @ref InstallManual "try".</li>
/// </ul>
///
/// The ArangoDB database groups documents into collections. Each collection can
/// be accessed using queries. For simple queries involving just one collection
/// and one search criteria, you can use a simple interface from within
/// JavaScript code or other languages supported by an API. This interface
/// allows you to select documents from one collection based on simple search
/// criteria. For more complex queries, you can use the Arango Query Language,
/// which is an evolution of SQL resp. UNQL for the NoSQL world.
///
/// The ArangoDB database packages comes with various programs:
///
/// - @LIT{arangod}: The ArangoDB database daemon. This server program is
/// intended to run as daemon process and to server the various clients
/// connection to the server via TCP / HTTP. See @ref
/// UserManualServerStartStop.
/// - @LIT{arangosh}: The ArangoDB shell. A client that implements a
/// read-eval-print loop (REPL) and provides functions to access and
/// administrate the ArangoDB server. See @ref UserManualShellStartStop.
/// - @LIT{arangoimp}: A buld importer for the ArangoDB server.
/// See @ref UserManualImporterStartStop.
///
/// @EMBEDTOC{UserManualServerBasicsTOC}
///
/// @section UserManualServerStartStop Starting the ArangoDB
/////////////////////////////////////////////////////////////
/// @section UserManualServerStartStop Starting the ArangoDB Server
///////////////////////////////////////////////////////////////////
///
/// The ArangoDB has two modes of operation: as server, where it will answer to
/// client requests and an emergency console, where you can access the database
/// directly. The latter should - as the name suggests - only be used in case of
/// an emergency, for example, a corrupted collection. Using the emergency
/// console allows you to issue all commands normally available in actions and
/// transactions.
/// The ArangoDB database server has two modes of operation: as server, where it
/// will answer to client requests and an emergency console, where you can
/// access the database directly. The latter should - as the name suggests -
/// only be used in case of an emergency, for example, a corrupted
/// collection. Using the emergency console allows you to issue all commands
/// normally available in actions and transactions.
///
/// You should never start more than one server for the same database,
/// independent from the mode of operation.
@ -88,12 +119,19 @@
/// @subsection UserManualServerStartStopHttp Starting the HTTP Server
//////////////////////////////////////////////////////////////////////
///
/// The following command starts the ArangoDB in server mode. You will be able
/// to access the server using HTTP request on port 8529. See below for a list
/// of frequently used options, see @ref CommandLine "here" for a complete list.
/// The following command starts the ArangoDB database in server mode. You will
/// be able to access the server using HTTP request on port 8529. See @ref
/// UserManualServerStartStopOptions "below" for a list of frequently used
/// options, see @ref CommandLine "here" for a complete list.
///
/// @verbinclude option-database-directory
///
/// After starting the server, point your favorite browser to:
///
/// @LIT{http://localhost:8529/}
///
/// to access the administration front-end.
///
/// @subsection UserManualServerStartStopDebug Starting the Emergency Console
/////////////////////////////////////////////////////////////////////////////
///

View File

@ -150,7 +150,7 @@ static TRI_action_options_t ParseActionOptions (TRI_v8_global_t* v8g,
v8::Handle<v8::Object> options) {
TRI_action_options_t ao;
// check "parameter" field
// check "parameters" field
if (options->Has(v8g->ParametersKey)) {
v8::Handle<v8::Value> parameters = options->Get(v8g->ParametersKey);
@ -159,6 +159,14 @@ static TRI_action_options_t ParseActionOptions (TRI_v8_global_t* v8g,
}
}
// check the "prefix" field
if (options->Has(v8g->PrefixKey)) {
ao._prefix = TRI_ObjectToBoolean(options->Get(v8g->PrefixKey));
}
else {
ao._prefix = false;
}
// and return the result
return ao;
}
@ -179,7 +187,7 @@ static TRI_action_options_t ParseActionOptions (TRI_v8_global_t* v8g,
////////////////////////////////////////////////////////////////////////////////
/// @brief defines a new action
///
/// @FUN{defineSystemAction(@FA{name}, @FA{queue}, @FA{callback}, @FA{parameter})}
/// @FUN{defineAction(@FA{name}, @FA{queue}, @FA{callback}, @FA{parameter})}
///
/// Possible queues are:
/// - "CLIENT"
@ -206,10 +214,6 @@ static v8::Handle<v8::Value> JS_DefineAction (v8::Arguments const& argv) {
string name = *utf8name;
if (name.empty()) {
return scope.Close(v8::ThrowException(v8::String::New("<name> must be non-empty")));
}
// extract the action queue
v8::String::Utf8Value utf8queue(argv[1]);
@ -339,14 +343,24 @@ TRI_action_t const* TRI_LookupActionVocBase (triagens::rest::HttpRequest* reques
// check if we know a callback
vector<string> suffix = request->suffix();
bool poped = false;
// find longest prefix
while (true) {
string name = StringUtils::join(suffix, '/');
map<string, TRI_action_t*>::iterator i = Actions.find(name);
if (i != Actions.end()) {
return i->second;
TRI_action_t* action = i->second;
if (action->_options._prefix) {
return action;
}
else {
if (! poped) {
return action;
}
}
}
if (suffix.empty()) {
@ -354,6 +368,7 @@ TRI_action_t const* TRI_LookupActionVocBase (triagens::rest::HttpRequest* reques
}
suffix.pop_back();
poped = true;
}
return 0;
@ -621,6 +636,7 @@ void TRI_InitV8Actions (v8::Handle<v8::Context> context, char const* actionQueue
v8g->ContentTypeKey = v8::Persistent<v8::String>::New(v8::String::New("contentType"));
v8g->HeadersKey = v8::Persistent<v8::String>::New(v8::String::New("headers"));
v8g->ParametersKey = v8::Persistent<v8::String>::New(v8::String::New("parameters"));
v8g->PrefixKey = v8::Persistent<v8::String>::New(v8::String::New("prefix"));
v8g->RequestBodyKey = v8::Persistent<v8::String>::New(v8::String::New("requestBody"));
v8g->RequestTypeKey = v8::Persistent<v8::String>::New(v8::String::New("requestType"));
v8g->ResponseCodeKey = v8::Persistent<v8::String>::New(v8::String::New("responseCode"));

View File

@ -183,10 +183,12 @@ TRI_action_parameter_t;
typedef struct TRI_action_options_s {
TRI_action_options_s ()
: _parameters() {
: _parameters(),
_prefix(false) {
}
std::map<std::string, TRI_action_parameter_t> _parameters;
bool _prefix;
}
TRI_action_options_t;

View File

@ -86,6 +86,7 @@ typedef struct TRI_v8_global_s {
ContentTypeKey(),
JournalSizeKey(),
ParametersKey(),
PrefixKey(),
ResponseCodeKey(),
WaitForSyncKey(),
DocumentIdRegex(),
@ -342,6 +343,12 @@ typedef struct TRI_v8_global_s {
v8::Persistent<v8::String> ParametersKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "prefix" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> PrefixKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "requestBody" key name
////////////////////////////////////////////////////////////////////////////////

View File

@ -36,6 +36,31 @@ var actions = require("actions");
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief returns system status information for the server
////////////////////////////////////////////////////////////////////////////////
actions.defineHttp({
url : "",
context : "admin",
prefix : false,
callback : function (req, res) {
var dest = "/_admin/html/index.html";
res.responseCode = actions.HTTP_MOVED_PERMANENTLY;
res.contentType = "text/html";
res.body = "<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href=\""
+ dest
+ "\">"
+ dest
+ "</a>.</p></body></html>";
res.headers = { location : dest };
}
});
////////////////////////////////////////////////////////////////////////////////
/// @fn JSF_GET_admin_status
/// @brief returns system status information for the server

View File

@ -51,6 +51,11 @@ var console = require("console");
/// @FA{options.url} is a prefix of the given url and no longer definition
/// matches.
///
/// @FA{options.prefix}
///
/// If @LIT{false}, then only use the action for excat matches. The default is
/// @LIT{true}.
///
/// @FA{options.context}
///
/// The context to which this actions belongs. Possible values are "admin",
@ -89,7 +94,7 @@ var console = require("console");
///
/// @FA{options.parameters}
///
/// Normally the paramaters are passed to the callback as strings. You can
/// Normally the parameters are passed to the callback as strings. You can
/// use the @FA{options}, to force a converstion of the parameter to
///
/// - @c "collection"
@ -103,7 +108,8 @@ function DefineHttp (options) {
var url = options.url;
var contexts = options.context;
var callback = options.callback;
var parameter = options.parameter;
var parameters = options.parameters;
var prefix = options.prefix || false;
var userContext = false;
if (! contexts) {
@ -134,6 +140,8 @@ function DefineHttp (options) {
return;
}
var parameter = { parameters : parameters, prefix : prefix };
// console.debug("callback: %s", callback);
for (var i = 0; i < contexts.length; ++i) {
@ -535,18 +543,35 @@ exports.POST = "POST";
exports.PUT = "PUT";
// HTTP 2xx
exports.HTTP_OK = 200;
exports.HTTP_CREATED = 201;
exports.HTTP_ACCEPTED = 202;
exports.HTTP_OK = 200;
exports.HTTP_CREATED = 201;
exports.HTTP_ACCEPTED = 202;
exports.HTTP_PARTIAL = 203;
exports.HTTP_NO_CONTENT = 204;
// HTTP 3xx
exports.HTTP_MOVED_PERMANENTLY = 301;
exports.HTTP_FOUND = 302;
exports.HTTP_SEE_OTHER = 303;
exports.HTTP_NOT_MODIFIED = 304;
exports.HTTP_TEMPORARY_REDIRECT = 307;
// HTTP 4xx
exports.HTTP_BAD = 400;
exports.HTTP_NOT_FOUND = 404;
exports.HTTP_METHOD_NOT_ALLOWED = 405;
exports.HTTP_CONFLICT = 409;
exports.HTTP_BAD = 400;
exports.HTTP_UNAUTHORIZED = 401;
exports.HTTP_PAYMENT = 402;
exports.HTTP_FORBIDDEN = 403;
exports.HTTP_NOT_FOUND = 404;
exports.HTTP_METHOD_NOT_ALLOWED = 405;
exports.HTTP_CONFLICT = 409;
exports.HTTP_PRECONDITION_FAILED = 412;
exports.HTTP_UNPROCESSABLE_ENTIT = 422;
// HTTP 5xx
exports.HTTP_SERVER_ERROR = 500;
exports.HTTP_SERVER_ERROR = 500;
exports.HTTP_NOT_IMPLEMENTED = 501;
exports.HTTP_BAD_GATEWAY = 502;
exports.HTTP_SERVICE_UNAVAILABLE = 503;
// copy error codes
for (var name in internal.errors) {