10b8f1844SEben Haber# query-ui
20b8f1844SEben Haber
30b8f1844SEben HaberThis repository contains the resources used for the Couchbase Query Workbench,
40b8f1844SEben Haberwhich is a plug-in for the Couchbase Administrative Console. This code can also 
50b8f1844SEben Haberbe run in a stand-alone mode, for users who are not administrators. This document 
60b8f1844SEben Haberprimarily describes the latter use, in stand-alone mode.
70b8f1844SEben Haber
80b8f1844SEben Haber## Steps to create a build
90b8f1844SEben Haber
100b8f1844SEben HaberYou will need to have golang installed on your platform.
110b8f1844SEben Haber
120b8f1844SEben Haber### Get a working repository
130b8f1844SEben Haber
140b8f1844SEben Haber     $ mkdir $HOME/standalone
150b8f1844SEben Haber     $ export GOPATH=$HOME/standalone
160b8f1844SEben Haber     $ mkdir -p $GOPATH/src/github.com/couchbase/
170b8f1844SEben Haber     $ cd $HOME/standalone
180b8f1844SEben Haber     $ mkdir bin pkg
190b8f1844SEben Haber
200b8f1844SEben HaberClone the git repo into the current working directory, to get the
210b8f1844SEben Habersource, so as to be able to make a build. This clones it into query:
220b8f1844SEben Haber
230b8f1844SEben Haber     $ cd $GOPATH/src/github.com/couchbase/
240b8f1844SEben Haber     $ git clone ssh://github.com/couchbase/query-ui query-ui
250b8f1844SEben Haber     $ cd query-ui
260b8f1844SEben Haber     $ go get .
270b8f1844SEben Haber     $ cd $GOPATH
280b8f1844SEben Haber     $ go install -v -gcflags "-N -l" ./src/github.com/couchbase/query-ui
290b8f1844SEben Haber
300b8f1844SEben HaberThis creates an executable called 'query-ui' in the $GOPATH/bin directory.
310b8f1844SEben Haber
3296a7649fSEben Haber## Running the tool with Couchbase
330b8f1844SEben Haber
340b8f1844SEben HaberTo run in standalone mode, you need to tell the executable where to find a
350b8f1844SEben HaberCouchbase server, and where to find all the web resources.
360b8f1844SEben Haber
370b8f1844SEben Haber    $GOPATH/bin/query-ui -webcontent=$GOPATH/src/github.com/couchbase/query-ui/ -datastore=http://localhost:8091
380b8f1844SEben Haber    
390b8f1844SEben Haberwhich should produce the following output messages:
400b8f1844SEben Haber    
410b8f1844SEben Haber    Launching query web service.
420b8f1844SEben Haber    Using CB Server at: http://localhost:8091
430b8f1844SEben Haber    Using N1QL query service on: localhost:8093
440b8f1844SEben Haber    Using mgmt query service on: localhost:8091
450b8f1844SEben Haber    Using web content at: /Users/eben/src/standalone/src/github.com/couchbase/query-ui/query-ui
460b8f1844SEben Haber    Launching UI server, to use, point browser at http://localhost:8095
470b8f1844SEben Haber
4896a7649fSEben HaberIf you want to have it use a specific query engine, you can specify that instead:
4996a7649fSEben Haber
5096a7649fSEben Haber    $GOPATH/bin/query-ui -webcontent=$GOPATH/src/github.com/couchbase/query-ui/ -queryEngine=http://localhost:8093
5196a7649fSEben Haber    
520b8f1844SEben HaberThe UI will be accessible via a web browser, by default on http://localhost:8095.
530b8f1844SEben Haber
540b8f1844SEben HaberThe UI is the same as is found in the Couchbase administrative console.
550b8f1844SEben Haber
5696a7649fSEben Haber
5796a7649fSEben Haber## Running the tool with CBAS
5896a7649fSEben Haber
5996a7649fSEben HaberThis 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:
6096a7649fSEben Haber
6196a7649fSEben Haber    $GOPATH/bin/query-ui -webcontent=$GOPATH/src/github.com/couchbase/query-ui/ -queryEngine=http://localhost:8095 -queryPrefix=/analytics -localPort=:8096
6296a7649fSEben Haber    
6396a7649fSEben HaberBecause CBAS defaults to port 8095 as well, you need to tell it to put the UI on a different port, in this example 8096.    
6496a7649fSEben Haber
65