From 3eca91a2f917df8b83ce0a239169c72eec605ace Mon Sep 17 00:00:00 2001 From: Andreas Streichardt Date: Wed, 8 Jun 2016 14:59:14 +0200 Subject: [PATCH 1/2] Restructure Docker chapter --- .../Books/Manual/Deployment/Docker.mdpp | 24 ----------------- .../Books/Manual/Deployment/Single.mdpp | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Documentation/Books/Manual/Deployment/Docker.mdpp b/Documentation/Books/Manual/Deployment/Docker.mdpp index 3f442dea13..38ce4193f3 100644 --- a/Documentation/Books/Manual/Deployment/Docker.mdpp +++ b/Documentation/Books/Manual/Deployment/Docker.mdpp @@ -1,30 +1,6 @@ !SECTION ArangoDB and Docker -!SUBSECTION Authentication -To start the official docker container you will have to decide on an authentication method. Otherwise the container won't start. - -Provide one of the arguments to docker as an environment variable. - -There are three options: - -1. ARANGO_NO_AUTH=1 - - Disable authentication completely. Useful for local testing or for operating in a trusted network (without a public interface). - -2. ARANGO_ROOT_PASSWORD=password - - Start ArangoDB with the given password for root - -3. ARANGO_RANDOM_ROOT_PASSWORD=1 - - Let ArangoDB generate a random root password - -To get quickly going: - -`docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 arangodb` - -For an in depth guide about docker and arangodb please check the official documentation: https://hub.docker.com/r/_/arangodb/ !SUBSECTION Networking diff --git a/Documentation/Books/Manual/Deployment/Single.mdpp b/Documentation/Books/Manual/Deployment/Single.mdpp index 590c8bbe6c..69e43a216c 100644 --- a/Documentation/Books/Manual/Deployment/Single.mdpp +++ b/Documentation/Books/Manual/Deployment/Single.mdpp @@ -4,6 +4,32 @@ TODO: !SUBSECTION Docker +!SUBSUBSECTION Authentication + +To start the official docker container you will have to decide on an authentication method. Otherwise the container won't start. + +Provide one of the arguments to docker as an environment variable. + +There are three options: + +1. ARANGO_NO_AUTH=1 + + Disable authentication completely. Useful for local testing or for operating in a trusted network (without a public interface). + +2. ARANGO_ROOT_PASSWORD=password + + Start ArangoDB with the given password for root + +3. ARANGO_RANDOM_ROOT_PASSWORD=1 + + Let ArangoDB generate a random root password + +To get quickly going: + +`docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 arangodb` + +For an in depth guide about docker and arangodb please check the official documentation: https://hub.docker.com/r/_/arangodb/ + Basically show the startup of a Docker image and explain about authentication options. From 496454df3fc838c92890d4dc2cfa564b2685aa87 Mon Sep 17 00:00:00 2001 From: Andreas Streichardt Date: Wed, 8 Jun 2016 15:26:53 +0200 Subject: [PATCH 2/2] /_admin/shutdown will now need a DELETE request --- .../Books/Manual/ReleaseNotes/UpgradingChanges30.mdpp | 4 ++++ .../DocuBlocks/Rest/Administration/JSF_get_api_initiate.md | 2 +- arangod/RestHandler/RestShutdownHandler.cpp | 5 +++++ js/apps/system/_admin/aardvark/APP/api-docs.json | 2 +- js/client/modules/@arangodb/testing.js | 6 ++++-- utils/generateExamples.js | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges30.mdpp b/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges30.mdpp index eb63b7fd22..365b63caf1 100644 --- a/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges30.mdpp +++ b/Documentation/Books/Manual/ReleaseNotes/UpgradingChanges30.mdpp @@ -718,6 +718,10 @@ API: - `/_api/structure`: an older unfinished and unpromoted API for data format and type checks, superseded by Foxx applications. +!SUBSECTION Administration APIs + +- `/_admin/shutdown` now needs to be called with the DELETE method + !SUBSECTION Handling of CORS requests It can now be controlled in detail for which origin hosts CORS (Cross-origin resource diff --git a/Documentation/DocuBlocks/Rest/Administration/JSF_get_api_initiate.md b/Documentation/DocuBlocks/Rest/Administration/JSF_get_api_initiate.md index 336ace3303..d2e602bb8d 100644 --- a/Documentation/DocuBlocks/Rest/Administration/JSF_get_api_initiate.md +++ b/Documentation/DocuBlocks/Rest/Administration/JSF_get_api_initiate.md @@ -2,7 +2,7 @@ @startDocuBlock JSF_get_api_initiate @brief initiates the shutdown sequence -@RESTHEADER{GET /_admin/shutdown, Initiate shutdown sequence} +@RESTHEADER{DELETE /_admin/shutdown, Initiate shutdown sequence} @RESTDESCRIPTION This call initiates a clean shutdown sequence. diff --git a/arangod/RestHandler/RestShutdownHandler.cpp b/arangod/RestHandler/RestShutdownHandler.cpp index 111e842cfd..1f14cd3026 100644 --- a/arangod/RestHandler/RestShutdownHandler.cpp +++ b/arangod/RestHandler/RestShutdownHandler.cpp @@ -42,6 +42,11 @@ bool RestShutdownHandler::isDirect() const { return true; } //////////////////////////////////////////////////////////////////////////////// HttpHandler::status_t RestShutdownHandler::execute() { + if (_request->requestType() != GeneralRequest::RequestType::DELETE_REQ) { + generateError(GeneralResponse::ResponseCode::METHOD_NOT_ALLOWED, 405); + return HttpHandler::status_t(HANDLER_DONE); + } + ApplicationServer::server->beginShutdown(); try { diff --git a/js/apps/system/_admin/aardvark/APP/api-docs.json b/js/apps/system/_admin/aardvark/APP/api-docs.json index 93aa6a1775..1e773b97a4 100644 --- a/js/apps/system/_admin/aardvark/APP/api-docs.json +++ b/js/apps/system/_admin/aardvark/APP/api-docs.json @@ -2333,7 +2333,7 @@ } }, "/_admin/shutdown": { - "get": { + "delete": { "description": "\n\nThis call initiates a clean shutdown sequence.\n\n", "parameters": [], "responses": { diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index 3592d44c67..12753acd15 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -1146,9 +1146,11 @@ function shutdownArangod(arangod, options) { } if (arangod.exitStatus === undefined || arangod.exitStatus.status === "RUNNING") { + const requestOptions = makeAuthorizationHeaders(options); + requestOptions.method = "DELETE"; + print(arangod.url + "/_admin/shutdown"); - download(arangod.url + "/_admin/shutdown", "", - makeAuthorizationHeaders(options)); + download(arangod.url + "/_admin/shutdown", "", requestOptions); } else { print("Server already dead, doing nothing."); } diff --git a/utils/generateExamples.js b/utils/generateExamples.js index 1137e3a9e9..0e80459b75 100644 --- a/utils/generateExamples.js +++ b/utils/generateExamples.js @@ -193,7 +193,7 @@ function main(argv) { if (startServer) { if (typeof(instanceInfo.exitStatus) === 'undefined') { - download(instanceInfo.url + "/_admin/shutdown", ""); + download(instanceInfo.url + "/_admin/shutdown", "", {method: "DELETE"}); print("Waiting for server shut down"); count = 0;