Event Store on Azure VM Quick Start Guide

Posted on Posted in Event Store

We recent­ly start­ed work on an event-sourced appli­ca­tion that will run in Azure and we need­ed to get a quick Event Store instance up for devel­op­ment. We had a hard time find­ing infor­ma­tion about the details of stand­ing up Event Store in Azure, so this post will walk through the var­i­ous steps required to go from noth­ing to a work­ing dev instance.

Note that this post does not cov­er best prac­tices for an instance of Event Store, sim­ply get­ting Event Store going for devel­op­ment and test­ing. As such, con­sid­er­a­tions such as authen­ti­ca­tion and per­for­mance are not cov­ered.

Create and configure Azure VM

Creating the VMAs a first step, we'll cre­ate a new Win­dows Serv­er 2012 R2 Dat­a­cen­ter VM that uses the Resource Man­ag­er deploy­ment mod­el. Since this is for devel­op­ment use, we don't need much in the way of per­for­mance or scal­a­bil­i­ty. We'll sized the VM as a small Basic A1 instance. I do want to be able to eas­i­ly reach my Event Store repo from my devel­op­ment box­es, so we'll also change the Pub­lic IP address to sta­t­ic. The rest of the options will be left at their defaults. Once the VM is cre­at­ed, the serv­er blade will open. We'll take note of the Pub­lic IP assigned to the VM for lat­er use.

While still in the por­tal, let's con­fig­ure the net­work to allow Event Store traf­fic. Con­nec­tions to the Event Store repo take place over TCP port 1113. The Event Store admin­is­tra­tion web­site is host­ed on port 2113. We need to be able to read and write to the Event Store repo from exter­nal box­es, so let's open TCP port 1113 to my new VM.

Inbound port ruleWe'll click on All resources from the main menu blade. When the esde­mo VM was cre­at­ed, it auto­mat­i­cal­ly cre­at­ed an esde­mo net­work secu­ri­ty group. We'll select that from the resources list, click on Inbound secu­ri­ty rules, and click Add to cre­ate the new rule. The Pro­to­col should be set to TCP and the Des­ti­na­tion port range to 1113.

If we want­ed to be able to remote­ly admin­is­ter the Event Store instance via the web inter­face, we would add a sec­ond rule for TCP port 2113 as well. Since I plan to only admin­is­ter the instance local­ly by remot­ing into the VM, we will only apply the first rule and con­tin­ue on.

Note that since we are not cov­er­ing secu­ri­ty and authen­ti­ca­tion for Event Store, you may wish to lim­it which IP address­es can access Event Store through the net­work con­fig­u­ra­tion. This can be done using the CIDR block or Tag options of the Source set­ting when cre­at­ing the inbound secu­ri­ty rule.

Installing and Configuring Event Store on our VM

Now that the VM and net­work con­fig­u­ra­tion is ready, let's RDP in and install Event Store as a ser­vice. Before installing, we'll need to cre­ate a local, non-admin user to run the ser­vice under (hereto­fore referred to as "ser­vice user account"). Since the user needs no spe­cial rights yet, let's cre­ate a stan­dard account and make sure to uncheck the User must change pass­word option so the account doesn't have any issues start­ing the ser­vice.

>Next, we will cre­ate a C:\EventStore direc­to­ry to hold the Event Store instal­la­tion and repos­i­to­ry. Down­load the lat­est release of Event Store and unzip it into the direc­to­ry. Event Store does not have any built-in sup­port for run­ning as a ser­vice, so we'll also down­load the lat­est release of NSSM to run Event Store as a ser­vice and unzip it into the same Event Store direc­to­ry. We'll need to grant the ser­vice user account we just cre­at­ed Full Con­trol access to this new C:\EventStore direc­to­ry.

Installing the serviceTo install Event Store as a ser­vice, let's open a com­mand prompt and change to the C:\EventStore direc­to­ry where NSSM has been unzipped. Run­ning nssm install EventStore allows me to spec­i­fy the exe­cutable to run as a new ser­vice.

For Path, we'll browse to the EventStore_­Clus­terN­ode exe­cutable where we unzipped Event Store. Start­up direc­to­ry will be the direc­to­ry where the exe­cutable is locat­ed. By default, Event Store will only lis­ten for con­nec­tions on the local inter­faces (local­host and 127.0.0.1). Since we want Event Store to be exter­nal­ly acces­si­ble, we will tell it to lis­ten on all inter­faces by spec­i­fy­ing --ext-ip "0.0.0.0" in the Argu­ments field.

Last­ly, switch to the Log on tab and have the ser­vice log in as the ser­vice user account we pre­vi­ous­ly cre­at­ed. Click Install ser­vice and we're almost ready to start up Event Store.

When Event Store starts up, it will attempt to reg­is­ter with HTTP.SYS to lis­ten on port 2113 for the admin­is­tra­tion web­site. We need to grant our ser­vice user account per­mis­sions to reg­is­ter that port. To do so, we'll run netsh http add urla­cl url=http://*:2113/ user=esuser from the Com­mand Prompt.

Windows Firewall ruleAnd final­ly, we need to make sure port 1113 is open in the Win­dows Fire­wall by cre­at­ing a new TCP port rule to allow 1113 inbound. We would also cre­ate a rule for 2113 if we want­ed the admin­is­tra­tion web­site to be remote­ly acces­si­ble.

Testing our service

Event Store admin siteAt this point, the ser­vice is ready to go! We can start it up using net start EventStore from the com­mand prompt or using the Ser­vices con­trol pan­el. Once start­ed, we'll open a brows­er on the VM and attempt to local­ly browse the web admin­is­tra­tion web­site. We go to http://localhost:2113/ and are greet­ed by the Event Store admin­is­tra­tion page.

The default admin user­name is admin and the default pass­word is changeit. The first order of busi­ness will be to change that pass­word, espe­cial­ly if you've opened port 2113 for exter­nal access.

Brows­ing the web admin­is­tra­tion site shows that the Event Store ser­vice is run­ning and acces­si­ble inter­nal­ly, but we need to con­firm that Event Store is avail­able exter­nal­ly as well. For this, we'll open IE on our local desk­top and browse to our pub­lic IP address, port 1113.
Remotely accessing Event Store with a browser

We're send­ing a sim­ple GET request and not a prop­er Event Store request, so we will receive back an Invalid TCP frame received error, but this is con­fir­ma­tion that we're able to reach the Event Store ser­vice exter­nal­ly. Note that if try­ing this test with Chrome, the error does not show up in the brows­er win­dow, but instead trig­gers a down­load of a text file that con­tains the error text. Just save your­self the trou­ble and test in IE.

That's it! At this point, Event Store is ready to be a repos­i­to­ry for your event-sourced dev appli­ca­tions. I'll cov­er some best prac­tices for pro­duc­tion deploy­ments and con­fig­u­ra­tion in a future post.

3 thoughts on “Event Store on Azure VM Quick Start Guide

  1. Great guide. One gotcha I ran into was a crash when I first tried to run the ser­vice and pull up the webui. This left the ser­vice in a "paused" state in the ser­vices con­trol pan­el. The root cause end­ed up being the C:EventStorelog and C:EventStoredb fold­ers that were pre­vi­ous­ly cre­at­ed when run­ning the ser­vice from a con­sole. The fix was to delete the two fold­ers and allow the ser­vice to recre­ate them when it start­ed up.

    1. Good find, Kamil. Test­ing the ser­vice with your own cre­den­tials may cre­ate the direc­to­ries with inad­e­quate per­mis­sions. When in doubt, delete and start over. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *