Skip to content

Setup EventStore on Windows Azure

Dan Leech edited this page Dec 16, 2014 · 11 revisions

 

 

 

DOCS HAVE MOVED

This wiki is no longer maintained and should not be used. Read the Event Store docs at docs.geteventstore.com.

 

 

 

Prerequisites

  1. Windows Azure account
  2. Basic knowledge of create virtual machine on Azure
  3. Basic knowledge of Linux

Create a new Linux Virtual Machine

This guideline is using a small instance of Ubuntu Server 14.04 LTS virtual machine.

Create VM

The DNS name in this part is important, please write it down as you are going to use it later.

Edit Endpoints

By default, new virtual machine only setup an endpoint for SSH. You need to add two new entries for EventStore, TCP port 2113 and 1113.

Endpoints

Add eventStore user and group

Use the following commands to add an user and a group called eventStore

sudo groupadd eventStore
sudo useradd -m -g eventStore -s /bin/bash eventStore
sudo passwd eventStore

Attach a data drive

If you want to persist EventStore data, it is recommended to add a new data disk to the virtual machine. The following guideline should help you in this situation: http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-how-to-attach-disk/

After following the guideline, you should end up with a mount /datadrive. Grant ownership of the /datadrive directory to the eventStore user, so Event Store can create all necessary directories when it runs:

sudo chown -R eventStore:eventStore /datadrive

Install Nginx

Nginx will be used as a reverse proxy server to proxy traffics between client and event store.

  1. Install Nginx:

    sudo apt-get install nginx
  2. Delete nginx default config

    sudo rm /etc/nginx/sites-available/default
    sudo rm /etc/nginx/sites-enabled/default
  3. Create the logging directory

    sudo mkdir -p /var/log/www/get-event-store/log/
  4. Create an get-event-store config file with following content in /etc/nginx/sites-available/ directory:

server { listen 80; server_name get-event-store.cloudapp.net;

  access_log /var/log/www/get-event-store/log/nginx.access.log;
  error_log /var/log/www/get-event-store/log/nginx.error.log;

  location / {
      proxy_pass http://127.0.0.1:2113;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $remote_addr;
  }

}


5. Link the config file created to sites-available:
 ```bash
 sudo ln -s /etc/nginx/sites-available/get-event-store /etc/nginx/sites-enabled/get-event-store
  1. Verify configuration and reload
    sudo nginx -t
    sudo service nginx reload

Install EventStore release binaries

Install binaries

  1. Download EventStore Binaries

    su - eventStore
    cd /datadrive
    wget http://download.geteventstore.com/binaries/EventStore-OSS-Linux-v3.0.1.tar.gz
    tar -xzvf EventStore-OSS-Linux-v3.0.1.tar.gz
    rm EventStore-OSS-Linux-v3.0.1.tar.gz
    cd EventStore-OSS-Linux-v3.0.1
  2. Update EvenStore configuration. Fire up your favourite editor and create a eventStore.config with following content:

    #Database and logs path
    Db: /datadrive/eventStore/db
    Log: /datadrive/eventStore/logs
    
    #Run all projections
    RunProjections: All

Start EventStore

Exit the session running as user eventStore from the previous two steps, and create /etc/init/event-store.conf with following content:

description "Event Store"

start on (filesystem and net-device-up eth0)
stop on runlevel [!2345]

# Path to Event Store installation
env EVENTSTORE_DIR='/datadrive/EventStore-OSS-Linux-v3.0.1/'

# Path to Event Store Configuration file
env EVENTSTORE_CONFIG='/datadrive/EventStore-OSS-Linux-v3.0.1/eventStore.config'

# Path to v8 and js1
env LD_LIBRARY_PATH='/datadrive/EventStore-OSS-Linux-v3.0.1/'

# Name (and local user) to run Event Store as
setuid eventStore

# Keep the process alive, limit to 5 restarts in 60s
respawn
respawn limit 5 60

# Start
chdir /datadrive/EventStore-OSS-Linux-v3.0.1
exec ${EVENTSTORE_DIR}clusternode

Then issue command sudo start event-store

Now visit http://your_dns/ and you should see the EvenStore admin interface. Enjoy the new UI!

Clone this wiki locally