You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Brunjes, Lee (lmb7s)" <lm...@virginia.edu> on 2009/11/12 18:11:46 UTC

Windows service

Hey everyone,

 I was going to ask a quick opinion question to the team, I am a windows guy, and am running couchdb on win 2k8 server.

I have taken a few minutes and hacked together a basic service in .net that move running the couch out of user land.  I found that on 2k8 the .net 3 service ran better than the 2.0 service I started with so I am using that right now personally the code should work in either version of .net.

Essentially I run a service that executes the .bat file that Mark Hammond wrote. It is at present neither pretty to install or tied to a gui of any type

I wanted to discuss two things 
	first is any one else doing something similar?
	And second would adding a .net dependency to things be a bad idea in the long term. 

In the environment I am using .net 3 is installed in the base image. I talked to Mark Hammond about this a while ago, and he suggested switching from C# to C++ so I could use the same dependencies as openssl.

I have not had any time to play with this really since then so prior to doing any more work I thought I would solicit opinions about the direction I should be go in.

The source and all available here:

http://people.virginia.edu/~lmb7s/couch/CouchDbStarter.zip
Install instructions in the bin/Release directory if you want to try it out.

-Lee





Re: Windows service

Posted by Nathan Stott <nr...@gmail.com>.
.NET dependency in the windows world is definitely not bad imo.

On Thu, Nov 12, 2009 at 11:11 AM, Brunjes, Lee (lmb7s)
<lm...@virginia.edu>wrote:

> Hey everyone,
>
>  I was going to ask a quick opinion question to the team, I am a windows
> guy, and am running couchdb on win 2k8 server.
>
> I have taken a few minutes and hacked together a basic service in .net that
> move running the couch out of user land.  I found that on 2k8 the .net 3
> service ran better than the 2.0 service I started with so I am using that
> right now personally the code should work in either version of .net.
>
> Essentially I run a service that executes the .bat file that Mark Hammond
> wrote. It is at present neither pretty to install or tied to a gui of any
> type
>
> I wanted to discuss two things
>        first is any one else doing something similar?
>        And second would adding a .net dependency to things be a bad idea in
> the long term.
>
> In the environment I am using .net 3 is installed in the base image. I
> talked to Mark Hammond about this a while ago, and he suggested switching
> from C# to C++ so I could use the same dependencies as openssl.
>
> I have not had any time to play with this really since then so prior to
> doing any more work I thought I would solicit opinions about the direction I
> should be go in.
>
> The source and all available here:
>
> http://people.virginia.edu/~lmb7s/couch/CouchDbStarter.zip<http://people.virginia.edu/%7Elmb7s/couch/CouchDbStarter.zip>
> Install instructions in the bin/Release directory if you want to try it
> out.
>
> -Lee
>
>
>
>
>

RE: Windows service

Posted by "Brunjes, Lee (lmb7s)" <lm...@virginia.edu>.
This seems like the best option. Works on everything I have tried it on. 
-Lee


-----Original Message-----
From: Juhani Ränkimies [mailto:juhani@juranki.com] 
Sent: Sunday, November 15, 2009 2:37 AM
To: dev@couchdb.apache.org; mhammond@skippinet.com.au
Subject: Re: Windows service

On Sun, Nov 15, 2009 at 3:15 AM, Mark Hammond <sk...@gmail.com> wrote:

>> erts-5.7.3\bin\erlsrv.exe add CouchDBProd -i couchdbprod -w
>> D:\couch_service\prod\bin -ar "-sasl errlog_type error -s couch"
>> sc.exe config couchdbprod obj= .\\imaginarycouchdbuser password=
>> evenmoreimaginarypasswordforcouchdbuser
>
> That's cool - I imagine there is also a way to configure for the LocalSystem
> user, meaning a password needn't be specified, meaning the installation
> process is fairly easy.  I'll play a little more with this...
>

erlsrv defaults to LocalSystem. Just skip the sc command. Then the -i
parameter is also unnecessary. I changed the user because I had some
problems I thought were permissions related (I'm not so sure anymore)

-juhani

Re: Windows service

Posted by Mark Hammond <sk...@gmail.com>.
On 15/11/2009 6:36 PM, Juhani Ränkimies wrote:
> On Sun, Nov 15, 2009 at 3:15 AM, Mark Hammond<sk...@gmail.com>  wrote:
>
>>> erts-5.7.3\bin\erlsrv.exe add CouchDBProd -i couchdbprod -w
>>> D:\couch_service\prod\bin -ar "-sasl errlog_type error -s couch"
>>> sc.exe config couchdbprod obj= .\\imaginarycouchdbuser password=
>>> evenmoreimaginarypasswordforcouchdbuser
>>
>> That's cool - I imagine there is also a way to configure for the LocalSystem
>> user, meaning a password needn't be specified, meaning the installation
>> process is fairly easy.  I'll play a little more with this...
>>
>
> erlsrv defaults to LocalSystem. Just skip the sc command. Then the -i
> parameter is also unnecessary. I changed the user because I had some
> problems I thought were permissions related (I'm not so sure anymore)

Thanks for the info.

I've cobbled something together, checked it into SVN and put a snapshot 
of 0.11 at:

http://people.apache.org/~mhammond/dist/snapshots

You will find setup-couchdb-0.11.0b880589.exe and its .md5 file.

This version offers you the choice of configuring as a service at 
install time.  Feedback welcome!

Cheers,

Mark.

Re: Windows service

Posted by Juhani Ränkimies <ju...@juranki.com>.
On Sun, Nov 15, 2009 at 3:15 AM, Mark Hammond <sk...@gmail.com> wrote:

>> erts-5.7.3\bin\erlsrv.exe add CouchDBProd -i couchdbprod -w
>> D:\couch_service\prod\bin -ar "-sasl errlog_type error -s couch"
>> sc.exe config couchdbprod obj= .\\imaginarycouchdbuser password=
>> evenmoreimaginarypasswordforcouchdbuser
>
> That's cool - I imagine there is also a way to configure for the LocalSystem
> user, meaning a password needn't be specified, meaning the installation
> process is fairly easy.  I'll play a little more with this...
>

erlsrv defaults to LocalSystem. Just skip the sc command. Then the -i
parameter is also unnecessary. I changed the user because I had some
problems I thought were permissions related (I'm not so sure anymore)

-juhani

Re: Windows service

Posted by Mark Hammond <sk...@gmail.com>.
On 13/11/2009 8:22 PM, Juhani Ränkimies wrote:
> On Thu, Nov 12, 2009 at 7:11 PM, Brunjes, Lee (lmb7s)
> <lm...@virginia.edu>  wrote:
>> I wanted to discuss two things
>>         first is any one else doing something similar?
>
> Yes.
>
>>         And second would adding a .net dependency to things be a bad idea in the long term.

I think it would be undesirable in this case for a number of reasons:

* The windows service API is native and not particularly complex.  .NET 
adds a layer of complexity for no good reason.  People hacking on 
couchdb itself must currently have some understanding of C (as it is 
already used) but may not be familiar with whatever language is used for 
the service impl.

* It adds a build-time dependency; additional compilers must be 
available and presumably hacked into the autoconf support.  The target 
.NET version may need to be installed on the developer's box, 
potentially making "buildbot" installations more difficult.

* It add a runtime dependency; there are no existing requirements for 
.NET and presumably the installer would need to either bundle and 
install the .NET runtime, or accept a limitation in the Windows versions 
it works on.

Which isn't to say I'm anti-.NET - I'd have the same reservations about 
building the service support around Python which (a) would be much 
easier than either .NET or custom C, and (b) I'm intimately familiar 
with :) or anything else which isn't erlang or C(++) :)

> I don't know, but erlang comes with a tool for installing a windows service.

Yay - this is obviously the killer reason.  I'd seen vague references to 
this, but this is the first time I've seen a concrete example.

> erts-5.7.3\bin\erlsrv.exe add CouchDBProd -i couchdbprod -w
> D:\couch_service\prod\bin -ar "-sasl errlog_type error -s couch"
> sc.exe config couchdbprod obj= .\\imaginarycouchdbuser password=
> evenmoreimaginarypasswordforcouchdbuser

That's cool - I imagine there is also a way to configure for the 
LocalSystem user, meaning a password needn't be specified, meaning the 
installation process is fairly easy.  I'll play a little more with this...

Thanks,

Mark

Re: Windows service

Posted by Juhani Ränkimies <ju...@juranki.com>.
On Thu, Nov 12, 2009 at 7:11 PM, Brunjes, Lee (lmb7s)
<lm...@virginia.edu> wrote:
> I wanted to discuss two things
>        first is any one else doing something similar?

Yes.

>        And second would adding a .net dependency to things be a bad idea in the long term.
>

I don't know, but erlang comes with a tool for installing a windows service.

-------------------
erts-5.7.3\bin\erlsrv.exe add CouchDBProd -i couchdbprod -w
D:\couch_service\prod\bin -ar "-sasl errlog_type error -s couch"
sc.exe config couchdbprod obj= .\\imaginarycouchdbuser password=
evenmoreimaginarypasswordforcouchdbuser
-------------------

This is for 0.11.0b831075 on win2003. 0.10 has more stuff in -ar parameter.
The logging configuration might need some tuning, haven't had time to
look at it yet. (watch for typos, I manually extracted this from a
bash script I use)

br,
-juhani

Re: Windows service

Posted by Cory Nelson <ph...@gmail.com>.
On Thu, Nov 12, 2009 at 9:11 AM, Brunjes, Lee (lmb7s)
<lm...@virginia.edu> wrote:
> Hey everyone,
>
>  I was going to ask a quick opinion question to the team, I am a windows guy, and am running couchdb on win 2k8 server.
>
> I have taken a few minutes and hacked together a basic service in .net that move running the couch out of user land.  I found that on 2k8 the .net 3 service ran better than the 2.0 service I started with so I am using that right now personally the code should work in either version of .net.
>
> Essentially I run a service that executes the .bat file that Mark Hammond wrote. It is at present neither pretty to install or tied to a gui of any type
>
> I wanted to discuss two things
>        first is any one else doing something similar?
>        And second would adding a .net dependency to things be a bad idea in the long term.

I'm using srvany.exe and instsrv.exe -- found in the free Windows
Resource Kit Tools download from Microsoft.  It's native and low
overhead.

http://support.microsoft.com/kb/137890

-- 
Cory Nelson