Add jemalloc and yum cookbooks

This commit is contained in:
Greg Karékinian
2023-07-08 15:12:30 +02:00
parent 1bdcda0e97
commit b7c36d427e
24 changed files with 2110 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
---
driver:
name: docker
provisioner:
name: chef_solo
log_level: info
platforms:
- name: ubuntu-16.04-chef-12
provisioner:
product_name: chef
install_strategy: once
product_version: 12
hostname: chef-12-ubuntu.local
run_options:
e:
- LANGUAGE=en_US.UTF-8
- LC_ALL=en_US.UTF-8
- name: ubuntu-16.04-chef-latest
provisioner:
product_name: chef
install_strategy: once
product_version: latest
hostname: chef-latest-ubuntu.local
run_options:
e:
- LANGUAGE=en_US.UTF-8
- LC_ALL=en_US.UTF-8
- name: centos-7.5-chef-latest
driver_config:
image: centos/systemd
run_command: /usr/sbin/init
privileged: true
provision_command:
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
- systemctl enable sshd.service
provisioner:
product_name: chef
install_strategy: once
product_version: latest
hostname: chef-latest-centos.local
run_options:
e:
- LANGUAGE=en_US.UTF-8
- LC_ALL=en_US.UTF-8
suites:
- name: default
run_list:
- recipe[jemalloc::default]

View File

@@ -0,0 +1,5 @@
source 'https://rubygems.org'
gem 'berkshelf', '~> 6.3'
gem 'test-kitchen', '~> 1.23'
gem 'kitchen-docker', '~> 2.7'

View File

@@ -0,0 +1,13 @@
Copyright (C) 2013 Panagiotis Papadomitsos
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,77 @@
# jemalloc Chef Cookbook
![Tag Version](https://img.shields.io/github/tag/priestjim/chef-jemalloc.svg) [![Cookbook Version](https://img.shields.io/cookbook/v/jemalloc.svg)](https://supermarket.chef.io/cookbooks/jemalloc) [![Build Status](https://travis-ci.org/priestjim/chef-jemalloc.svg?branch=master)](https://travis-ci.org/priestjim/chef-jemalloc) [![GitHub issues](https://img.shields.io/github/issues/priestjim/chef-jemalloc.svg)](https://github.com/priestjim/chef-jemalloc/issues) [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/priestjim/chef-jemalloc/master/LICENSE)
This simple recipe configures, compiles and installs the memory allocation
library `jemalloc` via source. jemalloc shines on high-request manycore
threaded applications and is a cheap upgrade if your workloads happen to fall
into this category.
## Requirements
### Platform
The following platforms are supported and tested using kitchen:
* Ubuntu 12.04, 12.10
* CentOS 7
Other Debian and RHEL family distributions are assumed to work.
### Chef Server
The cookbook converges best on Chef installations >= 10.16.2
## Attributes
The following attributes are available on this cookbook:
* `node['jemalloc']['url']` and `node['jemalloc']['version']` - The version and URL that
the library will be downloaded from
* `node['jemalloc']['checksum']` - The SHA-256 checksum of the above file
In addition, the following configuration flags are available as switches
* `node['jemalloc']['configure']['lazy_lock']` - Enables lazy locking (locking on multi-threaded applications only)
* `node['jemalloc']['configure']['xmalloc']` - Enables the `xmalloc` feature of jemalloc
* `node['jemalloc']['configure']['dss']` - Enables `sbrk` along `mmap` for memory allocations
* `node['jemalloc']['configure']['mremap']` - Enables the `mremap` feature of jemalloc
* `node['jemalloc']['configure']['stats']` - Enables the statistics gathering features of jemalloc
* `node['jemalloc']['configure']['profiling']` - Enables the code profiling features of jemalloc
* `node['jemalloc']['configure']['valgrind']` - Enables valgrind support in jemalloc
Recipes
=======
## default.rb
The default recipe downloads, compiles and installs the selected version of
jemalloc.
Usage
=====
Include the recipe on your node or role. Modify the
attributes as required in your role to change how various
configuration is applied per the attributes section above. In general,
override attributes in the role should be used when changing
attributes.
License and Author
==================
- Author:: Panagiotis Papadomitsos (<pj@ezgr.net>)
Copyright 2013, Panagiotis Papadomitsos
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,5 @@
# encoding: utf-8
require 'bundler'
require 'bundler/setup'
require 'berkshelf/thor'

View File

@@ -0,0 +1 @@
0.1.7

View File

@@ -0,0 +1,33 @@
#
# Cookbook Name:: jemalloc
# Attribute:: default
#
# Copyright (C) 2013 Panagiotis Papadomitsos
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
default['jemalloc']['version'] = '5.1.0'
default['jemalloc']['url'] = "https://github.com/jemalloc/jemalloc/releases/download/#{node['jemalloc']['version']}/jemalloc-#{node['jemalloc']['version']}.tar.bz2"
default['jemalloc']['checksum'] = '5396e61cc6103ac393136c309fae09e44d74743c86f90e266948c50f3dbb7268'
# Configure options
default['jemalloc']['configure']['munmap'] = true
default['jemalloc']['configure']['lazy_lock'] = true
default['jemalloc']['configure']['xmalloc'] = false
default['jemalloc']['configure']['dss'] = false
default['jemalloc']['configure']['mremap'] = false
default['jemalloc']['configure']['stats'] = false
default['jemalloc']['configure']['profiling'] = false
default['jemalloc']['configure']['valgrind'] = false

View File

@@ -0,0 +1,96 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.
# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db
# SASS #
########
.sass-cache
# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log
## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/
# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile
# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*
# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp
# Cookbooks #
#############
CONTRIBUTING
CHANGELOG*
# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer
# Vagrant #
###########
.vagrant
Vagrantfile
# Travis #
##########
.travis.yml

View File

@@ -0,0 +1,55 @@
{
"name": "jemalloc",
"description": "Installs and configures the jemalloc library",
"long_description": "# jemalloc Chef Cookbook\n\n![Tag Version](https://img.shields.io/github/tag/priestjim/chef-jemalloc.svg) [![Cookbook Version](https://img.shields.io/cookbook/v/jemalloc.svg)](https://supermarket.chef.io/cookbooks/jemalloc) [![Build Status](https://travis-ci.org/priestjim/chef-jemalloc.svg?branch=master)](https://travis-ci.org/priestjim/chef-jemalloc) [![GitHub issues](https://img.shields.io/github/issues/priestjim/chef-jemalloc.svg)](https://github.com/priestjim/chef-jemalloc/issues) [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/priestjim/chef-jemalloc/master/LICENSE)\n\nThis simple recipe configures, compiles and installs the memory allocation\nlibrary `jemalloc` via source. jemalloc shines on high-request manycore\nthreaded applications and is a cheap upgrade if your workloads happen to fall\ninto this category.\n\n## Requirements\n\n### Platform\n\nThe following platforms are supported and tested using kitchen:\n\n* Ubuntu 12.04, 12.10\n* CentOS 7\n\nOther Debian and RHEL family distributions are assumed to work.\n\n### Chef Server\n\nThe cookbook converges best on Chef installations >= 10.16.2\n\n## Attributes\n\nThe following attributes are available on this cookbook:\n\n* `node['jemalloc']['url']` and `node['jemalloc']['version']` - The version and URL that\n the library will be downloaded from\n* `node['jemalloc']['checksum']` - The SHA-256 checksum of the above file\n\nIn addition, the following configuration flags are available as switches\n\n* `node['jemalloc']['configure']['lazy_lock']` - Enables lazy locking (locking on multi-threaded applications only)\n* `node['jemalloc']['configure']['xmalloc']` - Enables the `xmalloc` feature of jemalloc\n* `node['jemalloc']['configure']['dss']` - Enables `sbrk` along `mmap` for memory allocations\n* `node['jemalloc']['configure']['mremap']` - Enables the `mremap` feature of jemalloc\n* `node['jemalloc']['configure']['stats']` - Enables the statistics gathering features of jemalloc\n* `node['jemalloc']['configure']['profiling']` - Enables the code profiling features of jemalloc\n* `node['jemalloc']['configure']['valgrind']` - Enables valgrind support in jemalloc\n\nRecipes\n=======\n\n## default.rb\n\nThe default recipe downloads, compiles and installs the selected version of\njemalloc.\n\nUsage\n=====\n\nInclude the recipe on your node or role. Modify the\nattributes as required in your role to change how various\nconfiguration is applied per the attributes section above. In general,\noverride attributes in the role should be used when changing\nattributes.\n\nLicense and Author\n==================\n\n- Author:: Panagiotis Papadomitsos (<pj@ezgr.net>)\n\nCopyright 2013, Panagiotis Papadomitsos\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"maintainer": "Panagiotis Papadomitsos",
"maintainer_email": "pj@ezgr.net",
"license": "Apache 2.0",
"platforms": {
"ubuntu": ">= 12.04",
"debian": ">= 6.0",
"redhat": ">= 6.0",
"scientific": ">= 6.0",
"oracle": ">= 6.0"
},
"dependencies": {
"build-essential": ">= 0.0.0"
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
"jemalloc": "Installs and configures the jemalloc library"
},
"version": "0.1.7",
"source_url": "",
"issues_url": "",
"privacy": false,
"chef_versions": [
],
"ohai_versions": [
],
"gems": [
]
}

View File

@@ -0,0 +1,17 @@
name 'jemalloc'
maintainer 'Panagiotis Papadomitsos'
maintainer_email 'pj@ezgr.net'
license 'Apache 2.0'
description 'Installs and configures the jemalloc library'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version IO.read(File.join(File.dirname(__FILE__), 'VERSION')).chomp rescue '0.1.0'
recipe 'jemalloc', 'Installs and configures the jemalloc library'
supports 'ubuntu', '>= 12.04'
supports 'debian', '>= 6.0'
supports 'redhat', '>= 6.0'
supports 'scientific', '>= 6.0'
supports 'oracle', '>= 6.0'
depends 'build-essential'

View File

@@ -0,0 +1,73 @@
#
# Cookbook Name:: jemalloc
# Recipe:: default
#
# Copyright (C) 2013 Panagiotis Papadomitsos
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe 'build-essential'
package 'bzip2' # For archive extraction
tmp = Chef::Config['file_cache_path'] || '/tmp'
jem_filename = ::File.basename(node['jemalloc']['url'])
jem_path = "#{tmp}/jemalloc-#{node['jemalloc']['version']}"
jem_libdir = (platform_family?('rhel') && node['kernel']['machine'].eql?('x86_64')) ? '/usr/lib64' : '/usr/lib'
remote_file "#{tmp}/#{jem_filename}" do
owner 'root'
group 'root'
mode 00644
source node['jemalloc']['url']
checksum node['jemalloc']['checksum']
action :create
end
execute 'extract-jemalloc' do
user 'root'
cwd(tmp)
command "tar xjf #{tmp}/#{jem_filename}"
not_if { ::File.directory?(jem_path)}
end
bash 'compile-jemalloc' do
user 'root'
cwd jem_path
code <<-EOH
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-debug \\
#{'--enable-lazy-lock' if node['jemalloc']['configure']['lazy_lock']} \\
#{'--enable-xmalloc' if node['jemalloc']['configure']['xmalloc']} \\
#{'--enable-dss' if node['jemalloc']['configure']['dss']} \\
#{'--enable-mremap' if node['jemalloc']['configure']['mremap']} \\
#{'--disable-stats' unless node['jemalloc']['configure']['stats']} \\
#{'--enable-prof ' if node['jemalloc']['configure']['profiling']} \\
#{'--disable-valgrind' unless node['jemalloc']['configure']['valgrind']} &&
make
EOH
not_if { ::File.exists?("#{jem_path}/lib/libjemalloc.so.2")}
end
execute 'install-jemalloc' do
command 'make install'
cwd jem_path
not_if { ::FileUtils.cmp("#{jem_path}/lib/libjemalloc.so.2", "#{jem_libdir}/libjemalloc.so.2") rescue false }
action :run
notifies :run, 'execute[jemalloc-ldconfig]'
end
execute 'jemalloc-ldconfig' do
command 'ldconfig'
action :nothing
end