Skip to content

Commit

Permalink
Fix nginx template to set server_name
Browse files Browse the repository at this point in the history
Locks web_nginx to use php-fpm

Make user directory 755 because some apache setups require you to be
able to read every directory in the path

remove api_dependencies lwrp because it never worked
  • Loading branch information
andrewGarson committed May 18, 2013
1 parent f968fff commit 2faaffe
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 141 deletions.
18 changes: 9 additions & 9 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Vagrant.configure("2") do |config|
config.vm.box_url = "https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box"

config.vm.hostname = "zabbix-berkshelf"
config.vm.network :private_network, ip: "192.168.50.10"
server_ip = "192.168.50.10"
config.vm.network :private_network, ip: server_ip

config.ssh.max_tries = 40
config.ssh.timeout = 120
Expand All @@ -31,15 +32,16 @@ Vagrant.configure("2") do |config|
},
'zabbix' => {
'agent' => {
'servers' => ['127.0.0.1'],
'servers_active' => ['127.0.0.1']
'servers' => [server_ip],
'servers_active' => [server_ip]
},
'web' => {
'install_method' => 'apache',
'install_method' => 'nginx',
'fqdn' => server_ip
},
'server' => {
'install' => true,
'ipaddress' => '127.0.0.1',
'ipaddress' => server_ip
},
'database' => {
#'dbport' => '5432',
Expand All @@ -64,10 +66,8 @@ Vagrant.configure("2") do |config|
#"recipe[postgresql::client]",
"recipe[zabbix::server]",

#"recipe[php-fpm]",
#"recipe[nginx]",
"recipe[apache2]",
"recipe[apache2::mod_php5]",
#"recipe[apache2]",
#"recipe[apache2::mod_php5]",
"recipe[zabbix::web]",

"recipe[zabbix::agent_registration]"
Expand Down
111 changes: 0 additions & 111 deletions Vagrantfile.works

This file was deleted.

16 changes: 0 additions & 16 deletions providers/api_dependencies.rb

This file was deleted.

6 changes: 6 additions & 0 deletions recipes/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
end
end


directory node['zabbix']['install_dir'] do
mode "0755"
action :create
end

# Create zabbix User
user node['zabbix']['login'] do
comment "zabbix User"
Expand Down
2 changes: 2 additions & 0 deletions recipes/web.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node.default['zabbix']['web']['fqdn'] = node['fqdn'] if node['zabbix']['web']['fqdn'].nil?

include_recipe "zabbix::web_#{node['zabbix']['web']['install_method']}"
2 changes: 0 additions & 2 deletions recipes/web_apache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

include_recipe "zabbix::common"


node.set['zabbix']['web']['fqdn'] = node['fqdn'] if node['zabbix']['web']['fqdn'].nil?
node.set['zabbix']['web']['user'] = "apache"

user node['zabbix']['web']['user']
Expand Down
7 changes: 7 additions & 0 deletions recipes/web_nginx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Install nginx and disable default site
node.override['nginx']['default_site_enabled'] = false
node.override['php-fpm']['pool']['www']['listen'] = node['zabbix']['web']['php']['fastcgi_listen']
include_recipe "php-fpm"
include_recipe "nginx"

# Install php-fpm to execute PHP code from nginx
Expand Down Expand Up @@ -73,6 +75,7 @@
group "root"
mode "754"
variables ({
:server_name => node['zabbix']['web']['fqdn'],
:php_settings => node['zabbix']['web']['php']['settings'],
:web_port => node['zabbix']['web']['port'],
:web_dir => node['zabbix']['web_dir'],
Expand All @@ -81,4 +84,8 @@
notifies :reload, "service[nginx]"
end

nginx_site "000-default" do
enable false
end

nginx_site "zabbix"
2 changes: 0 additions & 2 deletions resources/api_dependencies.rb

This file was deleted.

2 changes: 1 addition & 1 deletion templates/default/zabbix_nginx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {
listen <%= @web_port %>;
index index.php;
root <%= @web_dir %>;
server_name "";
server_name "<%=@server_name%>";

access_log /var/log/nginx/zabbix.access.log;

Expand Down

0 comments on commit 2faaffe

Please sign in to comment.