Skip to content

Commit

Permalink
Add nginx config & certs creation for rb-aioutliers (#7)
Browse files Browse the repository at this point in the history
* Add rb-aioutliers to nginx

* rename aioutliers.erb to aioutliers.conf.erb

* Update changelog

* aioutliers over http

* Disable SSL
  • Loading branch information
malvads authored Feb 16, 2024
1 parent 3f80682 commit 909e531
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ cookbook-nginx CHANGELOG

This file is used to list changes made in each version of the nginx cookbook.

0.0.7
-----
- [malvarez]
- Configure rb-aioutliers service


0.0.1
-----
- [cjmateos]
Expand Down
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
license 'All rights reserved'
description 'Installs/Configures cookbook-nginx'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.0.6'
version '0.0.7'
26 changes: 26 additions & 0 deletions resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,32 @@
end
end

action :add_aioutliers do
begin
aioutliers_port = new_resource.aioutliers_port

template "/etc/nginx/conf.d/aioutliers.conf" do
source "aioutliers.conf.erb"
owner user
group user
mode 0644
cookbook "nginx"
variables(:aioutliers_port => aioutliers_port)
notifies :restart, "service[nginx]"
end

service "nginx" do
service_name "nginx"
ignore_failure true
supports :status => true, :reload => true, :restart => true, :enable => true
action [:nothing]
end

rescue => e
Chef::Log.error(e.message)
end
end

action :remove do
begin

Expand Down
3 changes: 2 additions & 1 deletion resources/resources/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# Resource:: config
#

actions :add, :add_s3, :add_erchef, :configure_certs, :remove, :register, :deregister
actions :add, :add_s3, :add_erchef, :add_aioutliers, :configure_certs, :remove, :register, :deregister
default_action :add

attribute :user, :kind_of => String, :default => "nginx"
attribute :s3_port, :kind_of => Integer, :default => 9000
attribute :erchef_port, :kind_of => Integer, :default => 4443
attribute :aioutliers_port, :kind_of => Integer, :default => 39091
attribute :cdomain, :kind_of => String, :default => "redborder.cluster"
attribute :service_name, :kind_of => String
26 changes: 26 additions & 0 deletions resources/templates/default/aioutliers.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#######################################################
## Generated by Chef
#######################################################

upstream rb-aioutliers {
server localhost:<%= @aioutliers_port %> max_fails=3 fail_timeout=5s;
}

server {
listen 80;
listen [::]:80;

server_name rb-aioutliers.service;

access_log /var/log/nginx/access-aioutliers.log main;

client_max_body_size 512m;

location /api/v1/outliers {
proxy_pass http://rb-aioutliers;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

0 comments on commit 909e531

Please sign in to comment.