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 #352

Closed
wants to merge 14 commits into from
Closed

Added windows support #352

wants to merge 14 commits into from

Conversation

KZachariassen
Copy link
Contributor

@KZachariassen KZachariassen commented Jul 14, 2017

This is an updated attempt to add windows support, it is based on the old branch feature/windows_support but has been updates and tested on server 2016.

Could we get this merged and mark windows support as experimental?

Fixes #195

@solarkennedy
Copy link
Contributor

Certainly! Can you rebase against current master first to resolve the merge conflicts?

Kristian Jensen added 2 commits July 17, 2017 10:28
# Conflicts:
#	manifests/config.pp
#	manifests/install.pp
#	manifests/params.pp
#	manifests/run_service.pp
@KZachariassen
Copy link
Contributor Author

Conflict should be solved now, I have simplified the logic around init_style for windows, so it reuse existing logic around $init_style = 'unmanaged'

case $::operatingsystem {
'windows': {
$binary_name = 'consul.exe'
$binary_mode = '0775'
Copy link
Contributor

Choose a reason for hiding this comment

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

why does windows need different permissions here?

If we already know what the group should be, I'm ok with making 775 being the default for both oses. Does 555 not work for running windows binaries?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just ran a test on the, and the binary_mode can be set to 755, but 555 does not work on windows 2016. I have pushed a version where I set it to 755 for both data_dir and binary

@KZachariassen
Copy link
Contributor Author

Let me do another test tomorrow and I'll let you know.

Kristian Jensen and others added 5 commits July 18, 2017 08:21
@robklg
Copy link

robklg commented Sep 11, 2017

Hey, I was just looking into adding windows support to this puppet module. I see this merge request was about to get merged, but hasn't yet?

Is there something I can do?
Does it needs some more testing first? We use Windows Server 2012.

@solarkennedy
Copy link
Contributor

The main blocker is that this PR installs nssm on behalf of the user, which I don't think this module should do.

@solarkennedy
Copy link
Contributor

OMG it looks like all my review comments are still pending because I didn't hit the "submit review" button... :(

class consul::windows_service (
$nssm_version = '2.24',
$nssm_download_url = undef,
$nssm_download_url_base = 'https://nssm.cc/release',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a large new dependency that I didn't expect.

I'm ok with depending on nssm if you think that is the right tool for the job on windows, but I don't think it is appropriate for the consul module to install it on the users behalf.

Please instead assume it is available, add documentation on how to install it via something like
https://github.com/opentable/puppet-nssm

And then change the consul code to do the parameter execing

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still a blocker for acceptance. The consul module should not presume to install nssm for the user.

However it can require it and assume it is available as long as it is documented in the README

provider => 'powershell',
notify => Exec['consul_service_set_parameters']
}
file { "${consul::bin_dir}/set_service_parameters.ps1":
Copy link
Contributor

Choose a reason for hiding this comment

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

It does look like are in good company using nssm for this
https://chocolatey.org/packages/consul

Can you "show" tools\chocolateyInstall.ps1 on that page and make sure there isn't anything we missed?

file { "${consul::bin_dir}/set_service_parameters.ps1":
ensure => 'present',
content => template('consul/set_service_parameters.ps1.erb'),
notify => Exec['consul_service_set_parameters']
Copy link
Contributor

Choose a reason for hiding this comment

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

Just do the ~> shorthand

command => "${consul::bin_dir}/set_service_parameters.ps1",
refreshonly => true,
logoutput => true,
provider => 'powershell',
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to assume powershell is installed already? even if not technically safe, please start a section for "Experimental Windows Support" in the readme and note this.

mode => '0555';
"${consul::bin_dir}/consul":
"${install_path}/consul-${consul::version}/${binary_name}":
owner => $consul::user,
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove this extra prepending space for style?

mode => '0555';
owner => $consul::user,
group => $consul::group,
mode => $binary_mode;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use a , instead of ;

"${install_path}/consul-${consul::version}/${binary_name}":
owner => $consul::user,
group => $consul::group,
mode => $binary_mode;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use a , instead of ;

ensure => link,
notify => $do_notify_service,
target => "${install_path}/consul-${consul::version}/consul";
target => "${install_path}/consul-${consul::version}/${binary_name}";
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use a , instead of ;

@robklg
Copy link

robklg commented Sep 11, 2017

@solarkennedy yeah I understand your reluctance. I do agree however that NSSM is the best option. But it would also be fine to me if the puppet-consul module would only manage the config and not the installation. Then we can do the NSSM part in our profile.

@solarkennedy
Copy link
Contributor

I agree that would be a good compromise. For the same reason this puppet module doesn't install curl or unzip (as much as other people want it to), I don't think it is sustainable. If every puppet module that need to use the unzip binary tried to manage that package there would be lots of conflicts.

If the consul module tries to install NSSM, it would conflict with any other puppet module that thinks it should install NSSM too. NSSM should "just" be its own puppet module, puppet-consul should "just" use that or assume it is available.

@iwagnerclgx
Copy link
Contributor

Any thoughts on proceeding? I don't mind taking a stab at rebasing @krjensen's PR into the latest master and cleaning up the concerns raised here.

@solarkennedy
Copy link
Contributor

Go for it

@solarkennedy
Copy link
Contributor

Closed by #403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants