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

Apache2.4 support #552

Merged
merged 3 commits into from
Feb 6, 2014
Merged

Conversation

scottasmith
Copy link
Contributor

Add Apache 2.4 support by using override variable 'apache_version'.

This is in place of pull request #550

@igalic
Copy link
Contributor

igalic commented Jan 2, 2014

I think @hunner will need to take a look at the Travis issues.

apache::mod { 'authz_groupfile': }
apache::mod { 'authz_user': }
apache::mod { 'env': }
} elsif $mods {
apache::default_mods::load { $mods: }

if $::osfamily == 'debian' and $apache_version >= 2.4 {
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 see the necessity to check for $::osfamily here.

@igalic
Copy link
Contributor

igalic commented Jan 2, 2014

I think as a general comment I could say: Why are you using recreating the facility that we already provide through apache::mod in each mpm module?
There's too much duplicated code here, if it doesn't fit into mod, then we need to create a new defined type, apache::mpm

@scottasmith
Copy link
Contributor Author

@igalic I have updated the branch to include a apache::mpm defined type.

@maxenced
Copy link

maxenced commented Jan 8, 2014

It breaks apache module as httpd.conf.erb contains IncludeOptional out of any conditional bloc, which makes apache fail to start on any apache 2.2 setup

@scottasmith
Copy link
Contributor Author

@maxenced

I tested this on Ubuntu 13.04 with Apache 2.3 and without the apache_version param

class { 'apache': }

and Ubuntu 13.10 with Apache 2.4 and apache_version param

class { 'apache':
  apache_version => 2.4
}

Both started Apache fine.
Which OS have you tested this on?

Please make sure you are testing with the apache24_support branch checked out.
Master has a couple of old commits before i made a branch in my repo.

@maxenced
Copy link

maxenced commented Jan 8, 2014

The issue was on a debian which only has 2.2. But you're right, tested with master, and apache24_support branch seems to fix this issue.
Maxence

@igalic
Copy link
Contributor

igalic commented Jan 9, 2014

We need to make sure this still works with 2.2, and, with distros other than Debian/Ubuntu. Otherwise, the code now looks quite reasonable. I'll just need a greenlight from @apenney regarding tests. I've been out of the loop for quite some time and I'm not up-to-date on our new best-must-have-practice regarding acceptance tests.

@scottasmith
Copy link
Contributor Author

@ptomulik I can't seem to get a virtual machine working with FreeBSD. I don't have much experience with it (i have installed it once). Would you be so kind as to test my branch with changes to make sure it still works on the OS. You will need to use it with:

class { 'apache':
  apache_version => 2.4
}

@ptomulik
Copy link
Contributor

Puppetlabs doesn't seem to have freebsd prefabs yet, but as I know their'e working on it, and it should appear in not so distant future, there is also issue report opened for it.

I'll try some manual experiments on my FreeBSD system, if I'll find some spare time. In the meantime you may try this box: https://github.com/wunki/vagrant-freebsd. I found it to be quite easy - you install vagrant on your Linux, download Vagrantfile, start machine with vagrant up and connect to it with vagrant ssh.

@ptomulik
Copy link
Contributor

sorry, messed up with links, but now it's updated :)

@scottasmith
Copy link
Contributor Author

@ptomulik I tried that vagrant config file. It got to the stage where it mounts nfs shares and stops. I can ssh into the box when its up, but the mount (/vagrant) is not there. I have tried with virtualbox 4.2 and 4.3 on ubuntu.

@ptomulik
Copy link
Contributor

I'm lame, what is that /vagrant dir for?

@ptomulik
Copy link
Contributor

Ok, it's probably about synced folders, so if you don't have one, maybe just try to scp what you need from the host machine?

@scottasmith
Copy link
Contributor Author

Anything in the /vagrant folder on the vm is usually linked to the directory whee the vagrant config and puppet modules/manifests are on the host. Tried the scp too. The box didn't have puppet installed. I tried installing puppet and I got a weird error with pkg add tring to install depenency libraries. #Sigh. I will try again, maybe with a fresh install in vbox

@ptomulik
Copy link
Contributor

Ah, you need to configure pkg repo, perhaps. See hashicorp/vagrant-installers#32 (comment)

@ptomulik
Copy link
Contributor

And, this box uses pkgng, so if you meant pkg_add, it wouldn't work. If you configure repo as in the link above, use pkg install.

@scottasmith
Copy link
Contributor Author

Nice one cheers.
I decided to look into the mount problem and it was because i have the encryped home folder :$
Tried vagrant using /srv directory and it works treat.
I managed to install the puppet package with the instructions you gave me. The only problem is that puppet is usng pkg_add.
There are absolutely tonnes of the warnings on the first line below

/usr/local/lib/ruby/site_ruby/1.9/puppet/provider/package/freebsd.rb:93: warning: class variable access from toplevel
Error: Execution of '/usr/sbin/pkg_add -f ftp://ftp.freebsd.org/%2Fpub/FreeBSD/ports/amd64/packages-9-stable/All/mime-support-3.54.tbz' returned 1: pkg_add: unable to fetch 'ftp://ftp.freebsd.org/%2Fpub/FreeBSD/ports/amd64/packages-9-stable/All/mime-support-3.54.tbz' by URL
Error: Unable to get ftp://ftp.freebsd.org/%2Fpub/FreeBSD/ports/amd64/packages-9-stable/All/mime-support-3.54.tbz: File unavailable (e.g., file not found, no access)

@ptomulik
Copy link
Contributor

If you need to install packages from puppet, change the provider. There are at least two options, I think: install the zleslie-pkgng module to puppet, or try my ptomulik-packagex_portsx experimental module, which installs from ports (I think pkgng should be better for this purpose, so then Package { provider => pkgng }).

@scottasmith
Copy link
Contributor Author

Ok, after a few tweaks on the box (/etc/hosts, get puppet working) i successfully installed apache22 with puppet.

Now, apache24 is a different breed on FreeBSD. it looks like the mpm is compiled in to create the binary package apache24:

====> The default MPM module: you have to select exactly one of them
     MPM_PREFORK=on: non-threaded, pre-forking web server
     MPM_WORKER=off: hybrid multi-threaded multi-process web server
     MPM_EVENT=off: MPM worker variant with the goal of consuming threads only for connections with active processing
====> Build all MPMs as shared Module: you can only select none or one of them
     MPM_SHARED=off: all MPMs as loadable module
===> Use 'make config' to modify these settings
---End OPTIONS List---

This means that, for now, the apache24 mpm support can't be built into puppet for FreeBSD. Unless someone knows any different, it will simply have to bypass mpm installation if apache_version >= 2.4 and OS is freebsd

@scottasmith
Copy link
Contributor Author

@igalic What would you think about the following gist(https://gist.github.com/smitherz82/8419976).

This would try to guess the apache version based on OS but still be overridable as with the below partial:

class apache (
  $apache_version => $apache::version::apache_version
) {
}

@ptomulik
Copy link
Contributor

@smitherz82 On FreeBSD you must also choose a port/package based on apache version. 2.2 -> www/apache22, 2.4 -> www/apache24 and so on.

@scottasmith
Copy link
Contributor Author

@ptomulik Yeh, the problem i have faced is not www/apache22 or www/apache24.
I can get apache24 installed, its just that there is only prefork mpm compiled into the port.
It doesn't seem that the Apache 2.4 in FreeBSD is capable of using other mpms.

@ptomulik
Copy link
Contributor

@smitherz82 if you install freebsd packages from ports you may choose at compile time what MPM (or MPMs) you include. You may also enable shared MPMs and include all existing MPMs at compile time to decide at runtime what to use (this is how apache 2.4 is compiled for Debian for example). If from pkgng, you're condemned to use default settings (but I believe there is a way to use custom settings as well with some extra effort).

Unfortunately, it's not possible currently to define port options from puppet manifests. I've put recently few PRs to puppet core to fix this, see puppetlabs/puppet#2130. Unfortunately it seems like they're going to be rejected. PL team is planning to reorganize the puppet's code, see this thread, such that all the above stuff would be available as additional modules.

Another possibility is to use ptomulik-packagex_portsx module which is exactly same code and shall work with any recent puppet release. The module however uses it's own resource type called packagex instead of the standard package and would generate additional dependencies for puppetlabs-apache module.

Yet another possibility is to just set manually options (make config) to enable all MPMs and MPM_SHARED and create a package. You may then put in some place known to pkgng (I guess it's /var/cache/pkg/All/ or such), so it would use your package instead of the one from a source repository. This procedure could be documented for FreeBSD users or implemented as script or as a puppet manifest.

@ptomulik
Copy link
Contributor

@smitherz82 make package is the command you may be interested of, see http://www.freebsd.org/cgi/man.cgi?query=ports&sektion=7

@scottasmith
Copy link
Contributor Author

@ptomulik It seems that, for this PR, it may be best to hold FreeBSD back to Apache 2.2.
There are too many things out of the scope of these 'tweaks' involving package management and recompiling Apache with different configs.

@igalic
Copy link
Contributor

igalic commented Jan 17, 2014

okay,we'll concentrate on FreeBSD once puppet works there. (Although, tbh, I also consider it a bug of the 2.4 port, that prefork is the default rather than event)

@igalic
Copy link
Contributor

igalic commented Jan 25, 2014

@smitherz82 it appears your squashed commit has a different email than GitHub knows, you may want to fix that.
Also, from what I gather you still haven't merged @domcleal's commits.

@scottasmith
Copy link
Contributor Author

The commits are merged in from @domcleal and works on Ubuntu 13.10.
Travis hasn't picked up on the last push though :/

@blkperl
Copy link
Contributor

blkperl commented Jan 28, 2014

You still need to rebase against master.

git fetch --all ; git rebase upstream/master

@scottasmith
Copy link
Contributor Author

Branch all up to date with master and tests pass.

@blkperl
Copy link
Contributor

blkperl commented Feb 4, 2014

Travis had one failure and died on three of the tests.

@igalic
Copy link
Contributor

igalic commented Feb 5, 2014

joy. How do we make travis not give up us?

@scottasmith
Copy link
Contributor Author

Can haz better Travis box pleeease?

@igalic
Copy link
Contributor

igalic commented Feb 6, 2014

Well, @hunner & @apenney are planning to eventually migrate to Puppetlabs powered Jenkins. That might take a while, though.

@scottasmith
Copy link
Contributor Author

Acceptance tests work on the following nodes:

  • centos-64-x64
  • debian-70rc1-x64
  • ubuntu-server-12042-x64
  • ubuntu-server-1310-x64

@blkperl
Copy link
Contributor

blkperl commented Feb 6, 2014

I'm going to merge this unless anyone objects. I don't think we can convince Travis to stop dying for this particular PR.

@igalic
Copy link
Contributor

igalic commented Feb 6, 2014

+1

Scott Smith added 3 commits February 6, 2014 22:58
Changed the ssl module to use default for the new Mutex with Apache 2.4
on Ubuntu
@domcleal
Copy link
Contributor

domcleal commented Feb 7, 2014

Great, thanks @smitherz82!

traylenator pushed a commit to traylenator/puppetlabs-apache that referenced this pull request Jun 7, 2022
traylenator pushed a commit to traylenator/puppetlabs-apache that referenced this pull request Jun 7, 2022
Fix error does not show when image:tag does not exists (puppetlabs#552)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants