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 fastcgi index #1062

Merged
merged 1 commit into from
Apr 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
$string_mappings = {},
$nginx_locations = {},
$nginx_mailhosts = {},
$nginx_mailhosts_defaults = {},
$nginx_streamhosts = {},
$nginx_upstreams = {},
$nginx_servers = {},
Expand All @@ -181,7 +182,7 @@
create_resources('nginx::resource::upstream', $nginx_upstreams)
create_resources('nginx::resource::server', $nginx_servers, $nginx_servers_defaults)
create_resources('nginx::resource::location', $nginx_locations)
create_resources('nginx::resource::mailhost', $nginx_mailhosts)
create_resources('nginx::resource::mailhost', $nginx_mailhosts, $nginx_mailhosts_defaults)
create_resources('nginx::resource::streamhost', $nginx_streamhosts)
create_resources('nginx::resource::map', $string_mappings)
create_resources('nginx::resource::geo', $geo_mappings)
Expand Down
6 changes: 3 additions & 3 deletions manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@
apt::source { 'nginx':
location => "https://nginx.org/packages/${distro}",
repos => 'nginx',
key => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
key => {'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here too... @bastelfreak is this Ok, since this is one that was already merged, just kind of confusing commit message.... Or should I revert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Want a fresh PR? to fix them

Copy link
Collaborator

Choose a reason for hiding this comment

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

@elmobp yeah, let's just do that.

}
}
'nginx-mainline': {
apt::source { 'nginx':
location => "https://nginx.org/packages/mainline/${distro}",
repos => 'nginx',
key => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62',
key => {'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'},
}
}
'passenger': {
apt::source { 'nginx':
location => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
repos => 'main',
key => '16378A33A6EF16762922526E561F9B9CAC40B2F7',
key => {'id' => '16378A33A6EF16762922526E561F9B9CAC40B2F7'},
}

ensure_packages([ 'apt-transport-https', 'ca-certificates' ])
Expand Down
4 changes: 4 additions & 0 deletions manifests/resource/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# [*fastcgi*] - location of fastcgi (host:port)
# [*fastcgi_param*] - Set additional custom fastcgi_params
# [*fastcgi_params*] - optional alternative fastcgi_params file to use
# [*fastcgi_index*] - optional FastCGI index page
# [*fastcgi_script*] - optional SCRIPT_FILE parameter
# [*uwsgi_read_timeout*] - optional value for uwsgi_read_timeout
# [*ssl*] - Indicates whether to setup SSL bindings for this server.
Expand Down Expand Up @@ -120,6 +121,7 @@
# [*maintenance_value*] - Value to return when maintenance is on. Default to return 503
# [*error_pages*] - Hash: setup errors pages, hash key is the http code and hash value the page
# [*locations*] - Hash of servers resources used by this server

# Actions:
#
# Requires:
Expand Down Expand Up @@ -191,6 +193,7 @@
Optional[String] $proxy_buffering = undef,
Array $resolver = [],
Optional[String] $fastcgi = undef,
Optional[String] $fastcgi_index = undef,
$fastcgi_param = undef,
String $fastcgi_params = "${::nginx::conf_dir}/fastcgi_params",
Optional[String] $fastcgi_script = undef,
Expand Down Expand Up @@ -342,6 +345,7 @@
proxy_set_body => $proxy_set_body,
proxy_buffering => $proxy_buffering,
fastcgi => $fastcgi,
fastcgi_index => $fastcgi_index,
fastcgi_param => $fastcgi_param,
fastcgi_params => $fastcgi_params,
fastcgi_script => $fastcgi_script,
Expand Down
6 changes: 4 additions & 2 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
nginx_servers_defaults: { 'listen_options' => 'default_server' },
nginx_locations: { 'test2.local' => { 'server' => 'test2.local', 'www_root' => '/' } },
nginx_mailhosts: { 'smtp.test2.local' => { 'auth_http' => 'server2.example/cgi-bin/auth', 'protocol' => 'smtp', 'listen_port' => 587 } },
nginx_mailhosts_defaults: { 'listen_options' => 'default_server_smtp' },
nginx_streamhosts: { 'streamhost1' => { 'proxy' => 'streamproxy' } }
}
end
Expand All @@ -33,6 +34,7 @@
it { is_expected.to contain_nginx__resource__server('test2.local').with_listen_options('default_server') }
it { is_expected.to contain_nginx__resource__location('test2.local') }
it { is_expected.to contain_nginx__resource__mailhost('smtp.test2.local') }
it { is_expected.to contain_nginx__resource__mailhost('smtp.test2.local').with_listen_options('default_server_smtp') }
it { is_expected.to contain_nginx__resource__streamhost('streamhost1').with_proxy('streamproxy') }
end

Expand Down Expand Up @@ -159,7 +161,7 @@
is_expected.to contain_apt__source('nginx').with(
'location' => "https://nginx.org/packages/#{operatingsystem.downcase}",
'repos' => 'nginx',
'key' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62'
'key' => { 'id' => '573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62' }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this was from another commit? Next time, rebase rather than merge master.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops!

)
end
it { is_expected.to contain_anchor('nginx::package::begin').that_comes_before('Class[nginx::package::debian]') }
Expand All @@ -183,7 +185,7 @@
is_expected.to contain_apt__source('nginx').with(
'location' => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
'repos' => 'main',
'key' => '16378A33A6EF16762922526E561F9B9CAC40B2F7'
'key' => { 'id' => '16378A33A6EF16762922526E561F9B9CAC40B2F7' }
)
end
end
Expand Down
11 changes: 10 additions & 1 deletion spec/defines/resource_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
www_root: '/',
ipv6_enable: true,
listen_unix_socket_enable: true
listen_unix_socket_enable: true,
fastcgi_index: 'index.php'
}
end

Expand Down Expand Up @@ -986,6 +987,14 @@
it { is_expected.to contain_file('/etc/nginx/fastcgi_params').with_mode('0644') }
end

context 'when fastcgi_index => "index.php"' do
let :params do
default_params.merge(fastcgi_index: 'index.php')
end

it { is_expected.to contain_nginx__resource__location("#{title}-default").with_fastcgi_index('index.php') }
end

context 'when fastcgi_param => {key => value}' do
let :params do
default_params.merge(fastcgi_param: { 'key' => 'value' })
Expand Down