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

Added Windows Support #259

Merged
merged 5 commits into from
Jan 20, 2016
Merged

Added Windows Support #259

merged 5 commits into from
Jan 20, 2016

Conversation

Ginja
Copy link
Contributor

@Ginja Ginja commented Dec 30, 2015

  • Fixes Windows install on 64-bit fails #236
  • Added Windows Support (binary install_method only) using NSSM
    to manage the service. NSSM runs consul as the local SYSTEM user.
    Support for running it as another user can/should be added later.
  • Prevented the firewall cookbook from creating rules for disabled
    ports
  • Added & Updated spec tests
  • Disabled Style/ModuleFunction cop
  • Simplified how attributes with paths for values are set
  • Added version check to windows binary installation so that it can
    be upgraded

@codecov-io
Copy link

Current coverage is 55.20%

Merging #259 into master will increase coverage by +6.57% as of 5fa290d

@@            master   #259   diff @@
=====================================
  Files            6      7     +1
  Stmts          329    317    -12
  Branches         0      0       
  Methods          0      0       
=====================================
+ Hit            160    175    +15
  Partial          0      0       
+ Missed         169    142    -27

Review entire Coverage Diff as of 5fa290d

Powered by Codecov. Updated on successful CI builds.

default['consul']['config']['data_dir'] = '/var/lib/consul'
default['consul']['config']['ca_file'] = '/etc/consul/ssl/CA/ca.crt'
default['consul']['config']['cert_file'] = '/etc/consul/ssl/certs/consul.crt'
case node['os']

This comment was marked as outdated.

This comment was marked as outdated.

@Ginja
Copy link
Contributor Author

Ginja commented Jan 4, 2016

Rebased this PR to resolve conflicts.

@gdavison
Copy link
Contributor

gdavison commented Jan 4, 2016

@Ginja, this looks great. One problem I've found is that building all the file paths with prefix_path puts some things in the wrong place on Linux. For example, the Consul data should be under the /var/lib/consul hierarchy, rather than /etc/consul

@Ginja
Copy link
Contributor Author

Ginja commented Jan 4, 2016

@gdavison you're right, and there was brief discussion to change it here.

In order to keep everything clean & standardized on both platforms (i.e. consul data lives within the data folder underneath the prefix folder), I changed the values. I'd like to see it stay, but I can simply enforce that for my environment in our wrapper cookbook.

@kamaradclimber
Copy link
Contributor

@johnbellone how can we help this PR getting merged?

@gdavison
Copy link
Contributor

+1 on merging. It works great on our Windows boxes

@johnbellone
Copy link
Contributor

Would you mind re-basing again?

@johnbellone johnbellone added this to the 1.4 milestone Jan 19, 2016
@@ -4,18 +4,23 @@
#
# Copyright 2014-2016, Bloomberg Finance L.P.
#
::Chef::Node.send(:include, ConsulCookbook::Helpers)

This comment was marked as outdated.

This comment was marked as outdated.

* Fixes #236
* Added Windows Support (binary install_method only) using NSSM
  to manage the service. NSSM runs consul as the local SYSTEM user.
  Support for running it as another user can/should be added later.
* Prevented the firewall cookbook from creating rules for disabled
  ports
* Added & Updated spec tests
* Disabled Style/ModuleFunction cop
* Simplified how attributes with paths for values are set
* Changed default values for data_dir attribute to keep everything
  simple
* Added version check to windows binary installation so that it can
  be upgraded
Added a Windows only attribute that allows
cookbook users to override and/or add their own
nssm parameters. Added logic for comparing
nssm parameters as the nssm resource doesn't
currently do this. Reverted the change to the
default path for the data directory. Borrowed
some of these ideas from @gdavison, thanks!
Added exit code 1 as an acceptable return code within
`nssm_service_installed?`. If AppRotateOnline is not set
for nssm, it will only rotate the logs when the service
is restarted. Changed the default nssm parameters so
that logs are rotated when they reach 20 MB in size.
@gdavison
Copy link
Contributor

One issue: consul_definition resources have to have their path set manually on Windows. (And the Linux version doesn't use the config_dir parameter, but that's a separate issue).

Not a show-stopper, though

@Ginja
Copy link
Contributor Author

Ginja commented Jan 20, 2016

I've got a PR incoming that'll fix that. Thanks for the head's up. I just noticed the nssm resource doesn't start services if they're stopped. So I added that check into the Windows provider. We should look at contributing some of these changes back to the nssm cookbook.

Added a check to start Consul via nssm if it's not running. And
updated consul_definition resource/provider with the new helper
methods.
johnbellone added a commit that referenced this pull request Jan 20, 2016
@johnbellone johnbellone merged commit f3d3df5 into sous-chefs:master Jan 20, 2016
@legal90
Copy link
Contributor

legal90 commented Jan 29, 2016

Be aware - this PR introduces a backward incompatibility:

# Previous default value
default['consul']['config']['data_dir'] = '/var/lib/consul'

# New default value
default['consul']['config']['data_dir'] = join_path data_prefix_path, 'data'
# e.q. '/var/lib/consul/data'

cc: @johnbellone

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows install on 64-bit fails
6 participants