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

BREAKING: Ability to download from download.splunk.com #150

Merged
merged 5 commits into from
Oct 3, 2017
Merged

BREAKING: Ability to download from download.splunk.com #150

merged 5 commits into from
Oct 3, 2017

Conversation

TraGicCode
Copy link
Contributor

@TraGicCode TraGicCode commented Oct 1, 2017

This module used to be able to download splunk installer from splunk directly. Unfortunately, when splunk updates their http url paths this module didnt get updated as well. This updates the structure of where the installers should live along with hooking up docker containers for running in travis. Merging this would be considered a breaking change since the folder structure where people are placing the installers at on their local file system are changing to match how splunk NOW does it.

Summary

  • Updated expected folder structure for the splunk installers
  • Updated Documentation of folder structure
  • Updated default download location to be https://download.splunk.com in order to help people use this module easier instead of having to manually prestage the splunk installers.
  • Updated acceptance tests to pull from download.splunk.com
  • Updated .sync.yml to include the docker sets that should run under travis for beaker acceptance tests
  • Fixed a bug where the forwarder is not actually idempotent because of a file mode. 🐛
  • In order to get acceptance testing working in docker i had to actually get this module to work while inside a docker container for the splunk server using OPTIMISTIC_ABOUT_FILE_LOCKING ( reference: https://github.com/chef-cookbooks/chef-splunk/blob/611be81ac8e533af7a71f0b2836e8de3aa346373/.kitchen.dokken.yml#L114-L126 )

.sync.yml Outdated
@@ -1,6 +1,8 @@
---
.travis.yml:
secure: "RrAmWtM6eTjZZzD954AIgR179Pqp14lzHhd/C9cpKbTPynLncuim08CEvjmq+7pgAy9XDg1d02x3udfZt4btR1sBdyNRpNN3yUhWptmGU61HRJdiZq+nSLQkIYsqXanhk+O3NndFojO58WRD01dkWEc6HRHjlivuYNxDXmMkg9k="
docker_sets:
- set: docker/ubuntu-16.04
Copy link
Member

Choose a reason for hiding this comment

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

Did you test if our centos/ubuntu14.04/debian8/debian9 (voxpupuli/modulesync_config#388) work as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only enabled this one because of testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding more of the docker sets now since i solved the issue with splunkserver running inside a docker container.

pp = <<-EOS
class { '::splunk::forwarder': }
EOS
# describe 'splunk::forwarder class' do
Copy link
Member

Choose a reason for hiding this comment

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

isn't this spec file needed anymore, or did you disable it just for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disabled just for testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reenabled these since tests are now working inside a docker container.

@TraGicCode
Copy link
Contributor Author

TraGicCode commented Oct 1, 2017

Before this can be merged i need to figure out why splunk is blowing up on the splunk start command when inside a container. Below is the issue i'm having and the suggested solution. I'm not entirely convinced this is the real solution or even if this works. I will be looking at how others are currently doing their splunk server docker containers.

https://answers.splunk.com/answers/323671/splunk-light-running-on-docker-throwing-unusable-f.html

@TraGicCode TraGicCode closed this Oct 1, 2017
@TraGicCode TraGicCode reopened this Oct 1, 2017
class { '::splunk::params':
version => '7.0.0',
build => 'c8a78efdd40f',
src_root => 'https://download.splunk.com',
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be unnecessary, no? (since it's the same as params)?

More generally, I'm not sure about passing stuff into params directly, though I know the module did this before as well.

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 can remove this since i did change it to the defaults. Shall i remove this?

Also yes this module uses params in a non-standard way. Partly in fact because both the forwarder and the server try and reuse the params class.

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw that postgresql module uses postgresql::global or something along those lines to work around setting things that are common to multiple classes (and then pulls those in / out of params as necessary) - not sure if that's a more standard pattern though... most modules these days seem to be leaning towards having the main class be the interface to everything, and then having toggles there (enable_forwarder = true in class splunk). Probably not worth changing in this PR, but might be worth asking about, and possibly changing down the road.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep I agree there are a couple different approaches. That is a beast for another day!

version => '7.0.0',
build => 'c8a78efdd40f',
src_root => 'https://download.splunk.com',
splunkd_port => 8090,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto here, this should be mostly default (except port?)

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 had to do this because currently the acceptance test try to install both a splunk forwarder and a splunk enterprise instance on the same node. Each product has a management utility that listens on port 8089 by default. To get around this i just told the forwarder to be on the non-default port.

While this package does allow for uninstalling your splunk forwarder and splunk enterprise instance the uninstallation is technically not quite correct. In order to prevent adding more scope to this already existing bug i did what i did above.

Copy link
Contributor

Choose a reason for hiding this comment

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

But aren't version / build / src_root already set to those by default in params?
But if you're only setting the forwarder to a non-default port, can't splunkd_port be set in splunk::forwarder directly?

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 suppose. that is the problem this module makes it confusing with its use of params.pp

I will:
1.) remove the defaults from params.pp
2.) move the splunkd_port to the forwarder class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -103,6 +103,21 @@
tag => 'splunk_server',
}

if $facts['virtual'] == 'docker' {
ini_setting { 'OPTIMISTIC_ABOUT_FILE_LOCKING':
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if this is always needed in any Docker container? Or is it just required for the acceptance tests to work in Travis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both. I don't know the exact details but if you google splunk docker unusable filesystem This is pretty much the solution everyone provides. Even the chef-splunk repo did this but this was for their acceptance test. I Also could not find exact details on why/how this actually works. If you want to try this out locally under docker remove that line and watch it fail with the above error message.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I saw the comment before. Just wondering whether it's best to do this in the module or in the acceptance test; I think a case could possibly be made either way, but seems kind of magical, esp. since there's no parameter to control it.

It sounds like if you setup the volumes correctly, it may not be necessary to set this?
https://hub.docker.com/r/alexanderm/docker-splunk/

To work around the unusable filesystem issue you need to mount in a volume from the host for the /opt/splunk/var/lib
For example I started docker like this:
docker run -v /data/splunk-test:/opt/splunk/var/lib -p 8000:8000 -it alexanderm/docker-splunk bash

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wyardley I saw that but that isn't "Applicable" i believe in our case. When running docker acceptance tests we are not taking a folder on the host and mapping it to a folder in the docker container. Make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yeah, I thought this change was in the manifest itself, not in the test. I agree that this is a reasonable workaround in the acceptance test itself.

@@ -5,6 +5,8 @@
# Using puppet_apply as a helper
it 'works idempotently with no errors' do
pp = <<-EOS
class { '::splunk::params':
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to invoke splunk::params explicitly at all, do you?

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 agree :). Let me see if I can remove this without things going haywire

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@wyardley wyardley left a comment

Choose a reason for hiding this comment

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

This looks good to me. I think the splunk::params invocation is superfluous though?

@TraGicCode
Copy link
Contributor Author

i'm going to try and add a few other docker sets to this before this gets merged.

@TraGicCode
Copy link
Contributor Author

@wyardley I added more docker nodesets as noted below:

  • centos-6
  • centos-7
  • debian-7
  • debian-8

@TraGicCode
Copy link
Contributor Author

TraGicCode commented Oct 2, 2017

closes #149

@TraGicCode TraGicCode removed the request for review from alexjfisher October 3, 2017 21:17
- set: docker/debian-7
- set: docker/debian-8
- set: docker/ubuntu-14.04
- set: docker/ubuntu-16.04
Copy link
Member

Choose a reason for hiding this comment

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

can you split the new nodesets at least into an own commit? Or a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing!

…a docker container ( both for travis-ci and users who want to prebuild docker containers with splunk installed ).
… i need to force the forwarder to listen on a different port. This prevents splunk server and splunk forwarder ( which is being run on the same machine ) from fightining over ports.
…is also needed to get the idempotence checks to not fail on travis-ci.
@bastelfreak bastelfreak merged commit e3b2b4f into voxpupuli:master Oct 3, 2017
@TraGicCode TraGicCode removed the enhancement New feature or request label Oct 3, 2017
@TraGicCode TraGicCode changed the title [BREAKING CHANGE] Updated http download structure BREAKING: Updated http download structure Oct 3, 2017
@TraGicCode TraGicCode added the enhancement New feature or request label Oct 4, 2017
@TraGicCode TraGicCode changed the title BREAKING: Updated http download structure BREAKING: Ability to download from download.splunk.com Oct 4, 2017
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.

3 participants