Giter Club home page Giter Club logo

couchmart-demo's Introduction

Couchbase Connect EU Demo - Start a Revolution

This is the code for the live demo at Couchbase Connect EU - 'Start a Revolution'.

This code was created purely for demo purposes and does not necessarily represent Couchbase best practices.

Website Setup

Initial Setup

  1. Install and setup Couchbase Server 5.0+ on your nodes.

  2. Install couchbase and tornado python modules. e.g:

    pip install couchbase tornado
    
  3. Adjust settings.py to point towards the servers/users/buckets that you are using for 'aws' and 'azure'. If not using XDCR, you can just point towards one cluster.

  4. Create the appropriate bucket on your server, ensuring that a user is created with full access to that bucket.

  5. Run the create_dataset.py script to populate the bucket with the necessary documents:

    python create_dataset.py
    
  6. Start the web server:

    python web-server.py
    

    (note: If running the web-server on port 80, you must run this using sudo)

  7. Access the web page at http://localhost:8888 (or whichever port you have chosen). The nodes visualiser can be accessed at /nodes and the latest orders can be found at /query_vis.html. Note that the node visualiser has been orchestrated specifically for the demo and may not display the correct output in all cases.

Query Setup

  1. Add a Query/Index node into the cluster (if there is not one already).

  2. Create the following index:

    CREATE INDEX category ON couchmart(category)
    

Search Setup

  1. Add a search node into the cluster (if there is not one already)

  2. Create a search index called English.

Mobile Setup

  1. Start up Sync Gateway 1.5 against your cluster, using the configuration found at android/sync-gateway-config-xattrs.json. Ensure that you update the access credentials to be correct for your environment.

  2. Open the folder android in Android Studio.

  3. Import the relevant dependencies and setup the project.

  4. Set the mSyncGatewayUrl in android/app/src/main/java/com/couchbase/shop/Application.java to point towards your Sync Gateway.

  5. 'Run' the project, either on a real android device or a simulator.

Demo Queries

  1. Find the most popular products that have been ordered:

    SELECT   COUNT(1) `order`, product
    FROM couchmart UNNEST `order` as product
    WHERE couchmart.`type` = "order"
    GROUP BY product
    ORDER BY COUNT(1) DESC 
    LIMIT 5;
    
  2. Find out who had the most expensive shopping basket:

    SELECT b.name name, SUM(a.price) price, b.`order` basket FROM couchmart b 
    JOIN couchmart a ON KEYS b.`order`
    WHERE b.type="order"
    GROUP BY meta(b).id,b.name,b.`order`
    ORDER BY price DESC
    LIMIT 10
    
  3. Set a category of items to be out of stock:

    UPDATE couchmart SET stock=0 WHERE category="drinks"
    

couchmart-demo's People

Contributors

mattcarabine avatar tom-cb avatar danielbullcb avatar krugster avatar

Stargazers

Rob Hedgpeth avatar Raymundo Flores Medina avatar Fahim Shariar Shoumik avatar Brian Kane avatar  avatar Ellis Breen avatar David Haikney avatar

Watchers

Hideki Itakura avatar Steve Yen avatar Thuan Nguyen avatar Richard Smedley avatar Sarath Lakshman avatar Matthew D. Groves avatar Denis Rosa avatar Venkat avatar Leo Schuman avatar  avatar Tommie McAfee avatar Mike Wiederhold avatar Jeffry Morris avatar Priya Rajagopal avatar Chris Harris avatar Jake Rawsthorne avatar Abhishek Singh avatar Dmitrii Chechetkin avatar James Cloos avatar Dean Proctor avatar Donald Scott avatar  avatar Subhashni Balakrishnan avatar  avatar Alex Ma avatar Artem Stemkovski avatar Clarence J M Tauro avatar Sandip Nandi avatar Brett Lawson avatar  avatar  avatar Tai  avatar Rohinton Kazak avatar  avatar  avatar  avatar Ali Alsuliman avatar Jack Harper avatar Wayne Siu avatar Rob Hedgpeth avatar Sarath Kumar Sivan avatar Fabrice Leray avatar Elliot Scribner avatar Sundar Sridharan avatar  avatar  avatar Cyrus Hanlon avatar Matt Hall avatar  avatar Gilda avatar Arun Vijayraghavan avatar  avatar  avatar Richard Ponton avatar Sriram Ganesan avatar  avatar Daniel James avatar Adam S Levy avatar Daniel Nicholson avatar  avatar James H avatar  avatar  avatar James Powenski avatar Phil Stott avatar Dan Owen avatar Manu Dhundi avatar Guy Klages avatar Naitik Shah avatar  avatar Anji avatar Andrew Reslan avatar Arunkumar Senthilnathan avatar  avatar Jesse Roberson avatar  avatar Balakumaran G avatar Austin Gonyou avatar  avatar Hussain Towaileb avatar vickiezeng avatar  avatar  avatar Isaac Lowe avatar Shovik Guha avatar Ashwin avatar Roi Katz avatar  avatar Karim Meliani avatar Daniel Ma avatar  avatar  avatar  avatar Vijay Girish avatar Korrigan Clark avatar Jayahari Vavachan avatar Pranav Mayuram avatar  avatar Keshav Murthy avatar Pascal Gasp avatar

couchmart-demo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.