Run as a service?

Is there a recommended way to run the EventStore as a service? Or alternatively, a recommended way to have it run on startup?

Thanks,

Brian

You can run any console app as a service in both windows and Linux.

I believe it’s called svcany and a reg key in windows in Linux it’s daemonize http://linux.die.net/man/1/daemonize

Also topshelf is good for this…

Thanks :slight_smile: I was having some issues. I could install it as a service, but couldn’t get the dashboard to load up. I’ll give one (or both) of these a try and see what happens.

B

In windows needs to be admin

supervisor for linux/bsd

-Mike

You can also configure ACL of the http URL in windows to allow your user account. See the

https://github.com/EventStore/EventStore/blob/master/src/EventStore/Scripts/setup-http-permissions.cmd

Ports are hardcoded in the script. You need to run the script with an elevated admin token.

Hi All,

I wanted to give a quick update in case anyone else was having this same issue. I created a Topshelf host to install the EventStore as a service. When I click the Topshelf host .exe, and it gives me a UAC prompt, I can get the EventStore to run, browse the website, etc. The Topshelf logfile shows all the same output you’d see if you were running a console window.

When I install as a service and start it, I get a weird error message in my logfile:

2012-10-04 11:50:48.2020 Application Exiting…

2012-10-04 11:50:48.2020 Application Exit reason : Cannot create a file when that file already exists.

I am not sure if this is being logged by Topshelf or by the EventStore. Regardless, I am getting a little frustrated with this and have decided to take a break and ask if anyone else has managed to get the EventStore running as a windows service. If not, what is the recommended approach to have the EventStore to automatically start if a server crashes or is restarted?

Thanks,

Brian

Back again :slight_smile:

I have managed to completely hose my machine. After I start the service with EventStore SingleNode running, I get the error message in the logs as shown above, but at the same time I cannot browse localhost until I shut down the service. This means I can’t run the visual studio dev server or run my site using IIS Express. It’s also why I can’t browse the EventStore admin site. I also tried to connect to the EventStore via tcp using the C# client but that times out.

Now, what has happened is that somehow even after stopping and uninstalling the service, I am still unable to browse localhost. This is after numerous resets, and a bunch of other things I’ve tried.

I uploaded the Topshelf host I created to https://github.com/bmavity/EventStoreContrib if anyone wants to take a look, but at this point I have wasted so much time that the easiest thing for me may be to reinstall windows.

I’d still like to know if anyone has managed to get this working, or what the recommended way to accomplish restarting with the server is. Maybe a slightly expanded explanation if someone can spare the time. It seems I may need it. :stuck_out_tongue:

Thanks,

Brian

I have to admit I don't know well topshelf and can't speak on how to
integrate with them, I have never seen this message come out f the
Event Store. The Event Store does in windows need to run as admin or
you need to setup ACLs for http since it uses http.sys. This if not
done could possibly give different errors.

We can quite easily put a command line option to install itself as a
service (this is probably easiest). Or you can just host the process
as a service with windows itself via registry

Got my machine working again. Had to reset winsock, which worked even though I had tried it before and it didn’t work. Weird.

Anyway, I will explore the ACL route and see what happens. :slight_smile:

Thanks for the patience.

B