Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsqd/nsqlookupd: support running as windows service #718

Merged
merged 1 commit into from
Feb 24, 2016

Conversation

judwhite
Copy link
Contributor

This approach expunges the main.go and main_windows.go files, keeping only the original nsqd.go and nsqlookupd.go which can be built on all platforms.

The // +build responsibility is moved to the github.com/judwhite/go-svc/svc package. This package exposes two interfaces and a single Run function. Replaces #676.

@mreiferson
Copy link
Member

this is beautiful

}

signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine for now, but perhaps users of go-svc want to specify what signals they want to handle? Right now it's hardcoded https://github.com/judwhite/go-svc/blob/master/svc/svc_other.go#L19

@mreiferson mreiferson changed the title nsqd/nsqlookupd: support running as windows service (new) nsqd/nsqlookupd: support running as windows service Feb 21, 2016
@mreiferson
Copy link
Member

LGTM, any concerns about this approach @jehiah?

This should also make it trivial to package official windows binaries, if you want to update the builds in dist.sh @judwhite ?

@judwhite
Copy link
Contributor Author

I tried running dist.sh unmodified on CentOS 6.7. I'm getting a test failure (tried 3x) and mktemp is grumpy. Happen to know what's causing this? If not I'll look into it.

nsqadmin/http_test.go#TestHTTPEmptyChannelPOST

        http_test.go:53: http_test.go:490:
                        exp: 1
                        got: 0
... building v0.3.7-alpha for linux/amd64
mktemp: too few X's in template `nsq'

@jehiah
Copy link
Member

jehiah commented Feb 23, 2016

👍

@mreiferson
Copy link
Member

Happen to know what's causing this? If not I'll look into it.

I've seen that test flake out in travis, too. It's probably time dependent :(

re: mktemp - I only ever run it from OSX, so it might depend on BSD's mktemp?

@ploxiln
Copy link
Member

ploxiln commented Feb 23, 2016

Indeed, OS X / FreeBSD mktemp and linux mktemp are slightly different. Here's a way to get the same result on either platform:

mktemp -d ${TMPDIR:-/tmp}/nsq.XXXXXX

Less ugly linux-only variants, if you're curious (the former does something slightly different on OS X, and the latter doesn't work on OS X):

mktemp -d -t nsq.XXXXXX
mktemp --tmpdir nsq.XXXXXX

@mreiferson
Copy link
Member

@ploxiln to the rescue

@judwhite
Copy link
Contributor Author

@mreiferson I'm using /vendor in go-svc so you'll need to build with Go 1.6, or Go 1.5 with GO15VENDOREXPERIMENT=1 when targeting windows.

If you want to build with older versions of Go I think adding golang.org/x/sys/windows to Godeps should be enough.

@mreiferson
Copy link
Member

hmmm, was thinking about building the next release with Go 1.6 but that might be a little aggressive.

@mreiferson
Copy link
Member

@judwhite just tested dist.sh w/ windows, this LGTM

I'll open a separate PR for those updates + the flakey test, thanks!

mreiferson added a commit that referenced this pull request Feb 24, 2016
nsqd/nsqlookupd: support running as windows service
@mreiferson mreiferson merged commit 4bb085b into nsqio:master Feb 24, 2016
@judwhite
Copy link
Contributor Author

Tried out the official release on Windows, only thing is the binaries need to have a .exe extension. After renaming everything works 💯. Thanks for your patience with this one.

soar added a commit to soar/nsq that referenced this pull request Nov 3, 2017
ploxiln pushed a commit to ploxiln/nsq that referenced this pull request Nov 5, 2017
ploxiln pushed a commit to soar/nsq that referenced this pull request Nov 5, 2017
gola pushed a commit to gola/nsq that referenced this pull request Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants