EventStore on Azure and Ubuntu - it's a piece of cake! #1

EventStore is a well known, open-sourced and a solid database designed to be the very foundations of event-driven systems. What is great about it is the fact, that it can be built against both Windows and Ubuntu systems, what widens technology stack it can be used with. If you prefer Linux solutions and would like to build an event sourced solution based on ES, there's nothing that will stop you. In this short series of posts I will present how to quickly install, configure and manage EventStore using Ubuntu VMs from Azure.

Getting VM

You can obtain Ubuntu 14.04 VM from the marketplace in Azure Portal. There's nothing special about its configuration or size - for the purpose of testing it can be whichever you like and you're comfortable with. Once you fill in all fields and provision the whole environment, we can connect to the machine and try to install the database.

Installation

To connect to the VM you need an SSH client and credentials you provided during VM installation process. I personally recommend using PuTTY in Windows environment since it's lightweight and completely free. Once you're logged in, we can start installing EventStore instance.

Firstly run following command:

/
curl -s https://packagecloud.io/install/repositories/EventStore/EventStore-OSS/script.deb.sh | sudo bash

Once you have EventStore preconfigured, you can install it:

/
sudo apt-get install eventstore-oss=3.9.3

You can choose any version you like, in this particular post I selected 3.9.3 since it was the most recent one available.

Once EventStore is installed we can run it using this command:

/
sudo service eventstore start

and use curl to sent testing event to make sure everything is all right. To make things easier, take following JSON from the documentation:

/
[
  {
    "eventId": "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4",
    "eventType": "event-type",
    "data": {
      "a": "1"
    }
  }
]

and use following command to send an event:

/
vi event.txt
curl -i -d @event.txt "http://127.0.0.1:2113/streams/newstream" -H "Content-Type:application/vnd.eventstore.events+json"

Note that we're using vi to quickly create events.txt file using JSON from above. When you execute the command, you should receive HTTP 201 Created response:

/
HTTP/1.1 201 Created
Access-Control-Allow-Methods: POST, DELETE, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Requested-With, X-Forwarded-Host, X-PINGOTHER, Authorization, ES-LongPoll, ES-ExpectedVersion, ES-EventId, ES-EventType, ES-RequiresMaster, ES-HardDelete, ES-ResolveLinkTo
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ES-Position, ES-CurrentVersion
Location: http://127.0.0.1:2113/streams/newstream/0
Server: Mono-HTTPAPI/1.0
Date: Wed, 22 Feb 2017 08:09:26 GMT
Content-Type: text/plain
Content-Length: 0
Keep-Alive: timeout=15,max=100

Note that the configuration file used by EventStore is located in /etc/eventstore/eventstore.conf and since it's read-only, you will have to use sudo command to change something in it. For now, leave it as it is.

What's next?

In the next posts I will present how to access EventStore from your local computer and what to change to be able to send and receive messages from it. We'll end this series running a simple cluster of EventStore instances on 3 different Ubuntu machines.

Building your Big Data playground with Azure

Let's say you were assigned a task, which requires you to provision a whole new environment using technologies, which are not "cool" when used on your dev machine. Let's take into consideration Hadoop - it becomes more and more popular, yet it's still a black box for many(including me) people. What if you'd like to play with it a little? Well, here's the instruction what you have to do to install and run it on Windows. Trust me - it's doable... This is the only "good" part of the whole process.

Do it for me?

I don't like wasting my time and my computer's resources on temporary things, which I need only for a few hours. What I like, is to make something to do it for me. If you take a look at Azure Marketplace, you'll see plenty of available software images, many of them including OSS software. It can be installed and used without any additional charges. Does it include Hadoop? Yes it does. Let's grab it and install it.

Do I have money for it?

If you have an Azure subscription, feel no worries to install this image. As I said - it charges you only for the resources you're using. If you're done with it you can either delete the whole resource group with resources provisioned or disable a VM used by Hadoop - it will save you time when it will be needed next time and the cost is negligible in such case.

Got it! What's next?

The Linux VM instance used to install Hadoop on it is accessible through SSH client and requires passing SSH key to connect to it(you can use whichever client you like like PuTTY or even terminal from SourceTree) or a password, which you provided. Once connected to it, you can run tasks and scripts designed for Hadoop.

Just to make things clear - in Azure Portal, when you go to the Overview tab in VM provisioned for Hadoop, you'll se public IP address, which can be used to connect to it. What is more, you can use SFTP to upload file to the VM or download them. Go to your FTP client and use your_VM_IP:22 as host and enter your credentials. You'll see the default directory of your VM. From this point everything is set - you have your very own Hadoop playground, which you can use whenever you want.