Skip to content

Commit

Permalink
Merge pull request #12 from redBorder/development
Browse files Browse the repository at this point in the history
release 1.0.0
  • Loading branch information
davidredborder authored Jun 13, 2024
2 parents b6ebc27 + af3b0f0 commit a15837a
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 20 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,63 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create tag based on metadata.rb
id: create_tag
run: |
TAG=$(grep -o 'version\s*["'\''][^"'\'']*' ./resources/metadata.rb | sed 's/version\s*["'\'']//;s/["'\'']//')
echo "TAG=$TAG" >> $GITHUB_ENV
shell: bash

- name: Check if Tag Exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ env.TAG }}" >/dev/null 2>&1; then
echo "Tag ${{ env.TAG }} already exists, exiting."
exit 1
fi
shell: bash

- name: Set Version
if: success()
run: echo "VERSION=${{ env.TAG }}" >> $GITHUB_ENV

- name: Run Docker Container
if: success()
run: docker run --privileged -d --name builder --network host rockylinux:9 /bin/sleep infinity

- name: Install build tools RPM
if: success()
run: |
docker cp ./ builder:/build
docker exec builder bash -c "yum install -y epel-release && yum install -y make git mock"
docker exec builder bash -c "rm -rf /etc/mock/default.cfg"
- name: Setup SDK
if: success()
run: |
docker exec builder bash -c "curl https://raw.githubusercontent.com/redBorder/repoinit/master/sdk9.cfg > /build/sdk9.cfg"
docker exec builder bash -c "echo \"config_opts['use_host_resolv'] = True\" >> /build/sdk9.cfg"
docker exec builder bash -c "ln -s /build/sdk9.cfg /etc/mock/default.cfg"
- name: Build RPM using mock
if: success()
run: |
docker exec builder bash -c "git config --global --add safe.directory /build"
docker exec builder bash -c "cd /build/ && VERSION=${{ env.TAG }} make rpm"
- name: Copy RPMS
if: success()
run: |
docker cp builder:/build/packaging/rpm/pkgs/. ./rpms
- name: Delete non-.rpm files
if: success()
run: |
find ./rpms -type f -not -name '*.rpm' -exec rm {} \;
- name: Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: ./rpms/*
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
cookbook-nginx CHANGELOG
===============

## 1.0.0

- malvads
- [e5b2a9b] Fix lint
- [dd1b692] Update config.rb
- [ded1a47] Update s3.conf.erb
- [08dbca5] Add back s3
- [6880cbd] Remove add s3 from configure solo
- [95d5155] Configure Minio Load Balancer
- [dd1b692] Update config.rb
- [ded1a47] Update s3.conf.erb

## 0.0.8
- Miguel Negron
- [717936a] lint avoid use constants for OpenSSL
Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# Nginx Cookbook
# cookbook-nginx
[![Build Status][build-shield]][build-url]
[![Linters][linters-shield]][linters-url]
[![License][license-shield]][license-url]

cookbook to install and configure redborder nginx cookbook
<!-- Badges -->
[build-shield]: https://github.com/redBorder/cookbook-nginx/actions/workflows/rpm.yml/badge.svg?branch=master
[build-url]: https://github.com/redBorder/cookbook-nginx/actions/workflows/rpm.yml?query=branch%3Amaster
[linters-shield]: https://github.com/redBorder/cookbook-nginx/actions/workflows/lint.yml/badge.svg?event=push
[linters-url]: https://github.com/redBorder/cookbook-nginx/actions/workflows/lint.yml
[license-shield]: https://img.shields.io/badge/license-AGPLv3-blue.svg
[license-url]: https://github.com/cookbook-nginx/blob/HEAD/LICENSE

Chef cookbook to install and configure redborder nginx

### Platforms

- Rocky Linux 9

### Chef

- Chef 12.0 or later
- Chef 15.7.0 or later

## Contributing

Expand All @@ -20,7 +31,5 @@ cookbook to install and configure redborder nginx cookbook
6. Submit a Pull Request using Github

## License
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007

## Authors
Authors: Juan J. Prieto <[email protected]>
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
maintainer_email '[email protected]'
license 'AGPL-3.0'
description 'Installs/Configures cookbook-nginx'
version '0.0.8'
version '1.0.0'
22 changes: 11 additions & 11 deletions resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@
end
end

action :add_erchef do
action :add_s3 do # Only for configure solo
begin
erchef_port = new_resource.erchef_port

template '/etc/nginx/conf.d/erchef.conf' do
source 'erchef.conf.erb'
s3_port = new_resource.s3_port
s3_hosts = new_resource.s3_hosts
template '/etc/nginx/conf.d/s3.conf' do
source 's3.conf.erb'
owner user
group user
mode '0644'
cookbook 'nginx'
variables(erchef_port: erchef_port)
variables(s3_hosts: s3_hosts, s3_port: s3_port)
notifies :restart, 'service[nginx]'
end

Expand All @@ -114,17 +114,17 @@
end
end

action :add_s3 do # TODO: Create this resource in minio cookbook
action :add_erchef do
begin
s3_port = new_resource.s3_port
erchef_port = new_resource.erchef_port

template '/etc/nginx/conf.d/s3.conf' do
source 's3.conf.erb'
template '/etc/nginx/conf.d/erchef.conf' do
source 'erchef.conf.erb'
owner user
group user
mode '0644'
cookbook 'nginx'
variables(s3_port: s3_port)
variables(erchef_port: erchef_port)
notifies :restart, 'service[nginx]'
end

Expand Down
1 change: 1 addition & 0 deletions resources/resources/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

attribute :user, kind_of: String, default: 'nginx'
attribute :s3_port, kind_of: Integer, default: 9000
attribute :s3_hosts, kind_of: Array, default: ['localhost: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'
Expand Down
5 changes: 4 additions & 1 deletion resources/templates/default/s3.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#######################################################

upstream s3 {
server localhost:<%= @s3_port %> weight=2 max_fails=3 fail_timeout=5s;
server <%= @s3_hosts.first %> max_fails=3 fail_timeout=5s;
<% @s3_hosts.drop(1).each do |server| %>
server <%= server %> backup max_fails=1 fail_timeout=10;
<% end %>
}

map $http_host $port_in_host {
Expand Down

0 comments on commit a15837a

Please sign in to comment.