1# query-ui
2
3This repository contains the resources used for the Couchbase Query Workbench,
4which is a plug-in for the Couchbase Administrative Console. This code can also 
5be run in a stand-alone mode, for users who are not administrators. This document 
6primarily describes the latter use, in stand-alone mode.
7
8## Steps to create a build
9
10You will need to have golang installed on your platform.
11
12### Get a working repository
13
14     $ mkdir $HOME/standalone
15     $ export GOPATH=$HOME/standalone
16     $ mkdir -p $GOPATH/src/github.com/couchbase/
17     $ cd $HOME/standalone
18     $ mkdir bin pkg
19
20Clone the git repo into the current working directory, to get the
21source, so as to be able to make a build. This clones it into query:
22
23     $ cd $GOPATH/src/github.com/couchbase/
24     $ git clone ssh://github.com/couchbase/query-ui query-ui
25     $ cd query-ui
26     $ go get .
27     $ cd $GOPATH
28     $ go install -v -gcflags "-N -l" ./src/github.com/couchbase/query-ui
29
30This creates an executable called 'query-ui' in the $GOPATH/bin directory.
31
32## Running the tool with Couchbase
33
34To run in standalone mode, you need to tell the executable where to find a
35Couchbase server, and where to find all the web resources.
36
37    $GOPATH/bin/query-ui -webcontent=$GOPATH/src/github.com/couchbase/query-ui/ -datastore=http://localhost:8091
38    
39which should produce the following output messages:
40    
41    Launching query web service.
42    Using CB Server at: http://localhost:8091
43    Using N1QL query service on: localhost:8093
44    Using mgmt query service on: localhost:8091
45    Using web content at: /Users/eben/src/standalone/src/github.com/couchbase/query-ui/query-ui
46    Launching UI server, to use, point browser at http://localhost:8095
47
48If you want to have it use a specific query engine, you can specify that instead:
49
50    $GOPATH/bin/query-ui -webcontent=$GOPATH/src/github.com/couchbase/query-ui/ -queryEngine=http://localhost:8093
51    
52The UI will be accessible via a web browser, by default on http://localhost:8095.
53
54The UI is the same as is found in the Couchbase administrative console.
55
56
57## Running the tool with CBAS
58
59This UI can also run against an instance of CBAS, where you give it the URL for CBAS as the -queryengine, and tell it the REST prefix to use instead of /query:
60
61    $GOPATH/bin/query-ui -webcontent=$GOPATH/src/github.com/couchbase/query-ui/ -queryEngine=http://localhost:8095 -queryPrefix=/analytics -localPort=:8096
62    
63Because CBAS defaults to port 8095 as well, you need to tell it to put the UI on a different port, in this example 8096.    
64
65