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

Add puppetserver configs #343

Merged
merged 1 commit into from
Feb 25, 2016
Merged

Add puppetserver configs #343

merged 1 commit into from
Feb 25, 2016

Conversation

jyaworski
Copy link
Contributor

No description provided.

@ekohl
Copy link
Member

ekohl commented Feb 3, 2016

@jyaworski Need any help finishing this?

notify => Class['puppet::server::service'],
}

$puppetserver_config_dir = versioncmp($::puppetversion, '4.0.0') >= 0 ? {
Copy link
Member

Choose a reason for hiding this comment

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

This line is causing the tests to fail, possibly because the fact is not defined in our tests and is causing the tests to fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any ideas for a solution?

Copy link
Member

Choose a reason for hiding this comment

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

$puppetserver_config_dir = num2bool(versioncmp($::puppetversion, '4.0.0') >= 0) ? {

That fixed the test for me.

Copy link
Member

Choose a reason for hiding this comment

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

@brandonweeks that reads like it shouldn't work. I think it's not needed in params.pp because there it's an if statement and not a selector. In any case, I think we should move this to params.pp and possibly reuse $aio_package.

@jyaworski
Copy link
Contributor Author

@ekohl reviews would be good. I'm still progressing on this but it has been on the backburner to some other PRs I'm working on. I still very much need to do this, though.

@brandonweeks
Copy link
Member

@jyaworski this was on my todo list as well, so I'm very ready to test it. :)

@ekohl
Copy link
Member

ekohl commented Feb 3, 2016

I was poked by @zipkid at a meeting between puppet users, puppetlabs and foreman devs about puppet 4 that this is on his wishlist as well, so this is in demand.

@jyaworski
Copy link
Contributor Author

I'll see if I can work on this by the end of this week. I'll ping when it's comment-ready again.

@ekohl
Copy link
Member

ekohl commented Feb 3, 2016

@jyaworski awesome!

@zipkid
Copy link
Contributor

zipkid commented Feb 4, 2016

Hi @ekohl, @jyaworski,

Thanks for poking me on this.
As mentioned yesterday i also had to add management of conf.d/webserver.conf to set

  • ssl-cert
  • ssl-key
  • ssl-ca-cert
    which i don't find in the PR.

Also, in bootstrap.cfg, when '::puppet::server_ca' evaluates to false the following line should be added.
'puppetlabs.services.ca.certificate-authority-disabled-service/certificate-authority-disabled-service'

Regards,

Stefan.

@jyaworski
Copy link
Contributor Author

@zipkid thanks for the feedback. I'll make those changes. @ekohl and @brandonweeks I've already addressed some of your comments.

@jyaworski
Copy link
Contributor Author

@zipkid made a few changes. How's it look?

@zipkid
Copy link
Contributor

zipkid commented Feb 5, 2016

That is indeed what i meant.
Thank you.

@jyaworski
Copy link
Contributor Author

Great. I believe this PR is mostly done, except that I have to make the gem-home configurable:

https://github.com/theforeman/puppet-puppet/pull/343/files#diff-133e2a0f1f52427763456aee8fba2a7aR5

I'm unaware of a way to get the puppetserver gem home without shelling out (is it worth a puppetserver_gem_home fact? I seriously hope not). If anyone has any ideas while I'm thinking on it, that would be great.

# configuration section. This is necessary to
# disable in case CA is delegated to a separate instance
# type:boolean
# $server_ca_authorization_required:: Should the puppetserver ruby profiler be enabled?
Copy link
Member

Choose a reason for hiding this comment

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

This is missing from puppet::params and the description is wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good find. I did way too much copy-pasting during that part.

@mmoll
Copy link
Contributor

mmoll commented Feb 5, 2016

@jyaworski thanks for working on this, that's awesome 🌟
tests are failing at the moment...

@@ -0,0 +1,15 @@
webserver: {
access-log-config = /etc/puppetlabs/puppetserver/request-logging.xml
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be hardcoded.

Copy link
Member

Choose a reason for hiding this comment

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

access-log-config = <%= scope.lookupvar('puppet::server_puppetserver_dir') %>/request-logging.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted.

@brandonweeks
Copy link
Member

On Ubuntu 14.04 I'm getting /usr/local/lib/site_ruby/1.9.1 for $::rubysitedir, which isn't a working entry for ruby-load-path.

@jyaworski
Copy link
Contributor Author

Do you have an idea? I don't have the facility to test Ubuntu at the moment?

puppet-admin: {
client-whitelist: [
<%- scope.lookupvar('::puppet::server_admin_api_whitelist').each do |certname| -%>
<%= certname %>,
Copy link
Member

Choose a reason for hiding this comment

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

Exception in thread "main" com.typesafe.config.ConfigException$Parse: /etc/puppetserver/conf.d/puppetserver.conf: 58: in value for key 'client-whitelist': List should have had new element after a comma, instead had token: ':' (if you want the comma or ':' to be part of a string value, then double-quote it)

I get this error when ::1 is in the list with puppetserver 1.1.3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weird. Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

9af8dae fixed it for me, puppetserver 1.x expects quotes in the conf file itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Committed.

@brandonweeks
Copy link
Member

@jyaworski I confirmed it with a clean install of Ubuntu, I don't think you'll be able to rely on $::rubysitedir for Ubuntu. 😢 @mmoll do you have any insight into why this fact points to an empty directory on Ubuntu?

@@ -0,0 +1,10 @@
web-router-service: {
Copy link
Member

Choose a reason for hiding this comment

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

https://gist.github.com/brandonweeks/bc72082ab65c17b11396

Replacement template with puppetserver 1.x and 2.x support :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dzięki!

@mmoll
Copy link
Contributor

mmoll commented Feb 6, 2016

@brandonweeks no idea, but since facter 2.x is probably unmaintained now, this won't get resolved.

@jyaworski
Copy link
Contributor Author

@mmoll facter 2.4.x is in maintenance mode, just like 3.8.x is for puppet. If there's no fact we can rely on, that's unfortunate. If we add a dependency on puppetlabs-ruby, we can get access to the $::gemhome fact, which appears to be equivalent enough at least on a RHEL6 system:

[root@dagon ~]# facter -p gemhome rubysitedir
gemhome => /usr/lib/ruby/gems/1.8
rubysitedir => /usr/lib/ruby/site_ruby/1.8

We could always do directory magic or gsub...

@jyaworski
Copy link
Contributor Author

Actually, looking into it, os-settings should essentially never be changed. I'm suggesting we just let whatever the packager puts in there exist, and we don't manage the file. I've removed that part of the code. I can't find references to it in the docs for newer versions.

https://docs.puppetlabs.com/puppetserver/2.2/configuration.html
http://docs.puppetlabs.com/puppetserver/2.1/configuration.html
http://docs.puppetlabs.com/puppetserver/1.1/configuration.html

@jyaworski
Copy link
Contributor Author

Oh, sorry for the spam.... but it looks like I spoke too soon:

jruby-puppet: {
    # Where the puppet-agent dependency places puppet, facter, etc...
    # Puppet server expects to load Puppet from this location
    ruby-load-path: [/opt/puppetlabs/puppet/lib/ruby/vendor_ruby]

    # This setting determines where JRuby will look for gems.  It is also
    # used by the `puppetserver gem` command line tool.
    gem-home: /opt/puppetlabs/server/data/puppetserver/jruby-gems

In 2.x they moved it into puppetserver.conf. I think we can let that value stand (if we can get a puppetserver_version working), and leave os-settings.conf alone. I'm also willing to set gem-home on the same principle.

@jyaworski
Copy link
Contributor Author

OK, I think I have a working solution now (without rspec tests). I'll add the tests once I get confirmation this works on a wide variety of setups.

As an aside, I saw puppetlabs-hocon if we ever decide to move away from templates for this kind of thing.

$server_connect_timeout_milliseconds = 120000
$server_enable_ruby_profiler = false
$server_ca_authorization_required = true
$server_admin_api_whitelist = [ "127.0.0.1", "::1", $::ipaddress ] # lint:ignore:double_quoted_strings
Copy link

Choose a reason for hiding this comment

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

Why not simply switch to single quotes and remove the lint exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@mmoll
Copy link
Contributor

mmoll commented Feb 19, 2016

in the spec tests, it's still 4G ;)

@mmoll
Copy link
Contributor

mmoll commented Feb 19, 2016

BTW, also puppetserver 1.1.3 has -XX:MaxPermSize=256m in JAVA_ARGS per default, so that should IMHO get added here, too.

@brandonweeks
Copy link
Member

I ran into the two things you already found, looks good otherwise so far.

#
# $manage_packages:: Should this module install packages or not.
# Can also install only server packages with value
# of 'server' or only agent packages with 'agent'.
# Defaults to true
# type:boolean
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 "stroolean", so it has to be string

@jyaworski
Copy link
Contributor Author

Implemented all recommendations.

@mmoll
Copy link
Contributor

mmoll commented Feb 20, 2016

@jyaworski thanks, please feel free to squash in mmoll/puppet-puppet@d6c921f to get the tests green by setting the JAVA options back to 2G also in the tests.

Furthermore I couldn't get this to work on a fresh system with puppet apply. Further investigation and a look onto cryptocamp-puppetserver shows that the augeas lens has to be deployed before using it, I have a POC there: mmoll/puppet-puppet@a6f9044

However, I think now that it's probably better to have the addition of the trapperkeeper lens in a seperate PR, because this is getting a bit too big here. 💣

So the way to go would be:

  1. get Allow simple entries as standalones voxpupuli/puppet-puppetserver#25 merged
  2. open a PR to add the trapperkeeper lens into theforeman/puppet-puppet - ideally @raphink and @domcleal could do this as augeas experts, otherwise (depending on how much is to do regarding testing in addition to just copying it in) I can draft the change and give colab permissions to my puppet-puppet fork to whoever wants to work on this as I'm a bit short on time)
  3. rebase this PR onto theforeman/puppet-puppet master after the trapperkeeper lens went in
  4. get this PR merged 😃

Opinions on this?

@jyaworski
Copy link
Contributor Author

@mmoll the augeas lens should work if pluginsync is enabled.

http://docs.puppetlabs.com/guides/plugins_in_modules.html#module-structure

Are you seeing something else?

@mmoll
Copy link
Contributor

mmoll commented Feb 20, 2016

@jyaworski did you test this with puppet apply on a fresh box also?

@jyaworski
Copy link
Contributor Author

My mistake; you're talking about running locally with an apply, and I was testing in a client/server setup so pluginsync was working for me.

If that's the case, we'll have to ship this the way that @raphink originally did it (and yell at Puppetlabs to do this better)?

@mmoll
Copy link
Contributor

mmoll commented Feb 20, 2016

Yes, the thing is for foreman-installer this needs to work locally.

Even if PL would change the behaviour, we would need to wait for a new Puppet version and depend on specific versions, that wouldn't end well. :)

For my POC I took the original cryptocamp code and transformed it back to a way that IMHO works without requiring cryptocamp-augeas.

@jyaworski
Copy link
Contributor Author

Proposed solution: since we're just managing one file with augeas and not the entirety of trapperkeeper, we can bypass voxpupuli/puppet-puppetserver#25 until we figure out a way to somehow get them to talk. For now, we only care about its behavior with bootstrap.cfg. I've incorporated your changes.

@mmoll
Copy link
Contributor

mmoll commented Feb 20, 2016

My changes were unpolished, at least mmoll/puppet-puppet@645c8e5 is needed, also the added lines in manifests/params.pp should be better aligned.

The lens test is not needed for now, as we don't test anything, which is not desirable, that's what I meant with "depending on how much is to do regarding testing in addition to just copying it in".

I think this PR is fine for now and we need to wait for other people to have a look onto the lens topic. 🔍.

@jyaworski
Copy link
Contributor Author

Sure. This is good to merge minus looking at the lens later.

@brandonweeks
Copy link
Member

@jyaworski
Copy link
Contributor Author

@brandonweeks what's your environment? I'm not running into that.

@brandonweeks
Copy link
Member

Oh, I'm an idiot. 😅 This is working perfectly for me with puppetserver 1.x. 👍

@domcleal
Copy link
Contributor

The lens test is not needed for now, as we don't test anything, which is not desirable, that's what I meant with "depending on how much is to do regarding testing in addition to just copying it in".

I'd prefer to keep the lens test in the tree because it's customised from the camptocamp version. It's very important with Augeas lenses to typecheck them to prevent bizarre runtime behaviour, and this lets us do it (manually with augparse, if nothing else). Perhaps just remove/comment the broken test for now so the file passes.

@jyaworski
Copy link
Contributor Author

@domcleal the failing test is the one that says that '/' can be a part of keys. I commented that out; the last few lines in the test.

@mmoll
Copy link
Contributor

mmoll commented Feb 25, 2016

Regarding the lens see voxpupuli/puppet-puppetserver#25 (comment), we'll just pull that in as-is now.

@mmoll mmoll merged commit df7fcb2 into theforeman:master Feb 25, 2016
@mmoll
Copy link
Contributor

mmoll commented Feb 25, 2016

Merged, dziękujemy bardzo @jyaworski!

@jyaworski jyaworski deleted the puppetserver_config branch February 25, 2016 13:56
@jyaworski
Copy link
Contributor Author

@mmoll proszę bardzo!

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.

9 participants