-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from redBorder/development
Release 0.0.1
- Loading branch information
Showing
15 changed files
with
901 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# RPM | ||
pkgs | ||
SOURCES | ||
|
||
# DS_Store | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# .rubocop.yml | ||
|
||
# Deshabilita la regla Chef/Deprecations/ResourceWithoutUnifiedTrue | ||
Chef/Deprecations/ResourceWithoutUnifiedTrue: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cookbook-rb-common CHANGELOG | ||
=============== | ||
|
||
## 0.0.1 | ||
|
||
- Miguel Negrón | ||
- [dc1026b] Feature/add nofile configuration (#1) | ||
- Initial version | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'cookstyle', '= 7.32.1' | ||
gem 'rspec', '= 3.11' | ||
gem 'rubocop', '= 1.25.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
all: rpm | ||
|
||
rpm: | ||
$(MAKE) -C packaging/rpm | ||
|
||
rpmtest: | ||
$(MAKE) LATEST=`git stash create` -C packaging/rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
PACKAGE_NAME?= cookbook-rb-common | ||
|
||
VERSION?= $(shell git describe --abbrev=6 --tags HEAD --always | sed 's/-/_/g') | ||
|
||
BUILD_NUMBER?= 1 | ||
|
||
MOCK_CONFIG?=default | ||
|
||
RESULT_DIR?=pkgs | ||
|
||
LATEST?=HEAD | ||
|
||
all: rpm | ||
|
||
|
||
SOURCES: | ||
mkdir -p SOURCES | ||
|
||
archive: SOURCES | ||
cd ../../ && \ | ||
git archive --prefix=$(PACKAGE_NAME)-$(VERSION)/ \ | ||
-o packaging/rpm/SOURCES/$(PACKAGE_NAME)-$(VERSION).tar.gz $(LATEST) | ||
|
||
|
||
build_prepare: archive | ||
mkdir -p $(RESULT_DIR) | ||
rm -f $(RESULT_DIR)/$(PACKAGE_NAME)*.rpm | ||
|
||
|
||
srpm: build_prepare | ||
/usr/bin/mock \ | ||
-r $(MOCK_CONFIG) \ | ||
--define "__version $(VERSION)" \ | ||
--define "__release $(BUILD_NUMBER)" \ | ||
--resultdir=$(RESULT_DIR) \ | ||
--buildsrpm \ | ||
--spec=${PACKAGE_NAME}.spec \ | ||
--sources=SOURCES | ||
@echo "======= Source RPM now available in $(RESULT_DIR) =======" | ||
|
||
rpm: srpm | ||
/usr/bin/mock \ | ||
-r $(MOCK_CONFIG) \ | ||
--define "__version $(VERSION)"\ | ||
--define "__release $(BUILD_NUMBER)"\ | ||
--resultdir=$(RESULT_DIR) \ | ||
--rebuild $(RESULT_DIR)/$(PACKAGE_NAME)*.src.rpm | ||
@echo "======= Binary RPMs now available in $(RESULT_DIR) =======" | ||
|
||
clean: | ||
rm -rf SOURCES pkgs | ||
|
||
distclean: clean | ||
rm -f build.log root.log state.log available_pkgs installed_pkgs \ | ||
*.rpm *.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Name: cookbook-rb-common | ||
Version: %{__version} | ||
Release: %{__release}%{?dist} | ||
BuildArch: noarch | ||
Summary: redborder common cookbook to configure redborder system settings | ||
|
||
License: AGPL 3.0 | ||
URL: https://github.com/redBorder/cookbook-rb-common | ||
Source0: %{name}-%{version}.tar.gz | ||
|
||
%description | ||
%{summary} | ||
|
||
%prep | ||
%setup -qn %{name}-%{version} | ||
|
||
%build | ||
|
||
%install | ||
mkdir -p %{buildroot}/var/chef/cookbooks/rb-common | ||
cp -f -r resources/* %{buildroot}/var/chef/cookbooks/rb-common/ | ||
chmod -R 0755 %{buildroot}/var/chef/cookbooks/rb-common | ||
install -D -m 0644 README.md %{buildroot}/var/chef/cookbooks/rb-common/README.md | ||
|
||
%pre | ||
|
||
%post | ||
case "$1" in | ||
1) | ||
# This is an initial install. | ||
: | ||
;; | ||
2) | ||
# This is an upgrade. | ||
su - -s /bin/bash -c 'source /etc/profile && rvm gemset use default && env knife cookbook upload rb-common' | ||
;; | ||
esac | ||
|
||
%files | ||
%defattr(0755,root,root) | ||
/var/chef/cookbooks/rb-common | ||
%defattr(0644,root,root) | ||
/var/chef/cookbooks/rb-common/README.md | ||
|
||
%doc | ||
|
||
%changelog | ||
* Thu May 21 2024 Miguel Negrón <[email protected]> | ||
- Inital version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# common Cookbook | ||
|
||
Cookbook to configure common system redborder settings | ||
|
||
### Platforms | ||
|
||
- Rocky Linux 9 | ||
|
||
### Chef | ||
|
||
- Chef 12.0 or later | ||
|
||
# BUILDING | ||
|
||
- Build rpm package for redborder platform: | ||
* git clone https://github.com/redborder/cookbook-rb-common.git | ||
* cd cookbook-rb-common | ||
* make | ||
* RPM packages is under packaging/rpm/pkgs/ | ||
|
||
## Contributing | ||
|
||
1. Fork the repository on Github | ||
2. Create a named feature branch (like `add_component_x`) | ||
3. Write your change | ||
4. Write tests for your change (if applicable) | ||
5. Run the tests, ensuring they all pass | ||
6. Submit a Pull Request using Github | ||
|
||
## License | ||
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 | ||
|
||
## Authors | ||
Miguel Negrón <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# require 'set' TODO: refactor to this | ||
# nofile settings (ulimits) | ||
default[:redborder][:nofile] = {} | ||
default[:redborder][:nofile][:soft] = 8192 | ||
default[:redborder][:nofile][:hard] = 8192 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name 'rb-common' | ||
maintainer 'Miguel Negron' | ||
maintainer_email '[email protected]' | ||
license 'All rights reserved' | ||
description 'Redborder common system settings' | ||
version '0.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Cookbook:: rb-common | ||
# Provider:: config | ||
|
||
action :configure do | ||
# nofile settings | ||
# soft | ||
execute "ulimit -Sn #{node['redborder']['nofile']['soft']}" do | ||
not_if "ulimit -Sn | grep #{node['redborder']['nofile']['soft']}" | ||
end | ||
|
||
# hard | ||
execute "ulimit -Hn #{node['redborder']['nofile']['hard']}" do | ||
not_if "ulimit -Hn | grep #{node['redborder']['nofile']['hard']}" | ||
end | ||
|
||
template '/etc/security/limits.d/10-nofile.conf' do | ||
source '10-nofile.conf.erb' | ||
cookbook 'rb-common' | ||
owner 'root' | ||
owner 'root' | ||
mode '644' | ||
retries 2 | ||
variables(soft: node['redborder']['nofile']['soft'], | ||
hard: node['redborder']['nofile']['hard']) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Cookbook:: rb-common | ||
# Recipe:: default | ||
# Copyright:: 2024, redborder | ||
# License:: Affero General Public License, Version 3 | ||
|
||
rb_common_config 'config' do | ||
action :configure | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Cookbook:: rb-common | ||
# Resource:: config | ||
|
||
actions :configure | ||
default_action :configure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<%####################################################################### %> | ||
<%# Copyright (c) 2024 ENEO Tecnología S.L. %> | ||
<%# This file is part of redBorder. %> | ||
<%# redBorder is free software: you can redistribute it and/or modify %> | ||
<%# it under the terms of the GNU Affero General Public License License as published by %> | ||
<%# the Free Software Foundation, either version 3 of the License, or %> | ||
<%# (at your option) any later version. %> | ||
<%# redBorder is distributed in the hope that it will be useful, %> | ||
<%# but WITHOUT ANY WARRANTY; without even the implied warranty of %> | ||
<%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %> | ||
<%# GNU Affero General Public License License for more details. %> | ||
<%# You should have received a copy of the GNU Affero General Public License License %> | ||
<%# along with redBorder. If not, see <http://www.gnu.org/licenses/>. %> | ||
<%####################################################################### %> | ||
# Generated by CHEF | ||
* soft nofile <%=@soft%> | ||
* hard nofile <%=@hard%> |