Skip to content

Manually Provisioning the .NET App

&y edited this page Oct 25, 2015 · 2 revisions

These instructions assume you already setup the Node.js app, and that you chose to install Visual Studio. Time links (n m n s) in each section take you to a companion video to aid in installation.

Install Couchbase

Make sure you install v 2.2.0. Newer versions will not work with our project, and may also not work with elasticsearch.

Download couchbase 2.2.0 64 bit or couchbase 2.2.0 32 bit

Installation 0m38s

  1. Execute the setup file
  2. Accept the defaults
  3. Say yes to increase the number of ephemeral ports, if you are asked 1m0s
  4. When you get to the "Configure Server" step: 1m12s
    • Make changes to the file locations, if you wish
    • Choose "Start a new cluster"
    • You can choose a smaller RAM quota if you want
  5. When you get to the "Sample Buckets" step: 2m0s
    • It's up to you if you want to load them. They will not be used in this course.
  6. When you get to the "Create Default Bucket" step: 2m7s
    • Set the Per Node RAM Quota to 100 MB
    • Enable Flush
  7. When you get to the "Secure this Server" step: 2m37s
    • Make sure to keep track of your username and password - I will not help you recover it.
    • It's probably easiest if you stick with Administrator and password as your username and password - it will make working on the group project with one another much easier

Bucket Creation 3m2s

  1. From the top menu, choose "Data Buckets"
  2. Click, "Create New Data Bucket"
  3. Set the Bucket name to "moviq"
  4. Set the Per Node RAM Quota to something small - 128-256 MB.

Install Fiddler 4m43s

This will be used as part of the elasticsearch configuration

Download Fiddler for .NET4

  1. Execute the setup file
  2. Accept the defaults

Install the Java JDK 5m2s

You might already have this, if you took or are taking a Java programming class

Download Java JDK (i.e. SE Development kit 8)

  1. Execute the setup file.
  2. Accept the defaults.
  3. When it's finished, open an Explorer window (windows+e)
  4. Right-click "This PC" and choose, "Properties" 5m46s
  5. Click "Change Settings"
  6. Open the "Advanced" Tab
  7. Click the "Environment Variables" button
  8. Look for a variable named, "JAVA_HOME"
  9. If you find one, "Edit" it, otherwise click "New"
  10. Make sure "Variable value" is set to your JDK path (i.e. C:\Program Files\Java\jdk1.8.0_25)

Install Elasticsearch 6m48s

As with Couchbase, the version that you install is critical - follow these instructions explicitly

Download elasticsearch 1.0.1

  1. Unzip Elasticsearch to a location that you want it to run from (i.e. C:\dev-tools\)
  2. Open a command prompt (windows+r, then type cmd and press enter)
  3. Navigate to the "bin" folder where you unzipped elasticsearch to (i.e. cd C:\dev-tools\elasticsearch-1.0.1\bin)
  4. Type service install
    • Keep this cmd window open - we're going to use it again in the next section
  5. Open Windows Services (windows+r, then type services.msc and press enter)
  6. Double-click the Elasticsearch service
  7. Set the Startup type to "Automatic"
  8. You should be able to navigate to Elasticsearch now: http://localhost:9200/_plugin/head

Install Couchbase Elasticsearch Plugin 8m14s

These are based on the Couchbase plugin instructions

  • In the cmd window from the Elasticsearch instructions, above, paste the following code and execute:
bin/plugin -install transport-couchbase -url http://packages.couchbase.com.s3.amazonaws.com/releases/elastic-search-adapter/1.3.0/elasticsearch-transport-couchbase-1.3.0.zip
  • Open an Explorer window (windows+e)
  • Navigate to your Elasticsearch directory, and then into the config folder
  • Open "elasticsearch.yml" in a code editor, such as Atom 10m33s
  • Paste the following code at the bottom of that file and save (replace the username and password with your own, if they are different):
################################ Couchbase Config ############################
couchbase.username: Administrator
couchbase.password: password
couchbase.maxConcurrentRequests: 1024

Configure Elasticsearch

Add the moviq bucket 14m35s

  • Open Fiddler
  • Turn off capturing (bottom left corner)
  • Open the "Composer" tab
  • Set the verb to PUT
  • Set the URI to http://localhost:9200/moviq
  • Set the headers (just below the URI)
Content-Type: application-json
User-Agent: Fiddler
Host: localhost:9200
Content-Length: 0
  • Execute
  • You should see a 200 response

Setup the Couchbase Template 16m17s

  • In the "Composer" tab
  • Set the verb to PUT
  • Set the URI to http://localhost:9200/_template/couchbase
  • The headers should match the headers from above.
  • In the Request Body, Add the following line, replacing the file path with the correct file path for your Couchbase plugin template:
<@INCLUDE *C:\dev-tools\elasticsearch-1.0.1\plugins\transport-couchbase\couchbase_template.json*@>
  • Execute
  • You should see a 200 response

Set the Cross-Data-Center-Replication (XDCR) Max Concurrent Replications in Couchbase 18m5s

  • In the "Composer" tab
  • Set the verb to POST
  • Set the URI to http://localhost:8091/internalSettings
  • Set the headers (just below the URI)
Content-Type: application-json
User-Agent: Fiddler
Host: localhost:8091
Content-Length: 26
Authorization: Basic [BASE64 AUTH HERE]
  • Base64 Encode your username and password
    • From the top menu, choose Tools, and then TextWizard
    • In the textarea at the top, type Administrator:password (or your username colon your password)
    • Choose "To Base64"
    • Copy the encoding
    • Paste it in place of [BASE64 AUTH HERE], in the Authorization header
    • (Alternatively, you can execute btoa('Administrator:password') in a Chrome Developer Tools Console)
  • In the Request Body, Add the following line { xdcrMaxConcurrentReps: 8 }

Setup XDCR in Couchbase 19m48s

These are based on the Couchbase indexing instructions

  1. In Chrome, navigate to http://localhost:8091, and login
  2. Click the XDCR menu item at the top of the page
  3. Create a Cluster Reference
    • Name it "elasticsearch"
    • Set the IP/hostname to: 127.0.0.1:9091
    • If you get an error, try restarting your Elasticsearch service
  4. Create Replication
    • Choose the moviq Bucket
    • Choose the elasticsearch Cluster
    • Set the To Bucket to moviq
    • In Advanced settings, set the XDCR Protocol to Version 1
  5. Follow along with the video to test your setup 22m19s

Add Data to your moviq Bucket 9m17s

  1. Open a command prompt (windows+r, then type cmd and press enter)
  2. Navigate to the Couchbase bin directory: cd C:\Program Files\Couchbase\Server\bin
  3. Restore the Couchbase database from this repo:
cbrestore "[THE PATH TO YOUR DATABASE BACKUP]" http://localhost:8091/ -u [YOUR USERNAME (default is Administrator)] -p [YOUR PASSWORD]

For instance:

cbrestore "D:\dev_git\Heinz95729\Moviq\App_Data\moviq-20141020" http://localhost:8091/ -u Administrator -p password

Edit Your Hosts File

To follow along with the videos in this course, and to run the app in the same manner in which I do in the videos, you need make a change to your hosts file:

  1. Navigate to %windir%\System32\drivers\etc
  2. Copy the "hosts" file to your desktop
  3. Open the "hosts" file on your desktop
  4. Paste the following line at the bottom: 127.0.0.1 heinz95729.local
  5. Save
  6. Copy the "hosts" file from your desktop back to %windir%\System32\drivers\etc
  7. Provide administrator privileges to overwrite

Optional Installs