• Stars
    star
    98
  • Rank 345,882 (Top 7 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created over 12 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Development repository for the ark cookbook

ark cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Overview

This cookbook provides ark, a resource for managing software archives. It manages the fetch-unpack-configure-build-install process common to installing software from source, or from binary distributions that are not fully fledged OS packages.

This cookbook started its life as a modified version of Infochimp's install_from cookbook. It has since been heavily refactored and extended to meet different use cases.

Given a simple project archive available at a url:

ark 'pig' do
  url 'http://apache.org/pig/pig-0.8.0.tar.gz'
end

The ark resource will:

  • fetch it to to /var/cache/chef/
  • unpack it to the default path (/usr/local/pig-0.8.0)
  • create a symlink for :home_dir (/usr/local/pig) pointing to path
  • add specified binary commands to the environment PATH variable

By default, the ark will not run again if the :path is not empty. Ark provides many actions to accommodate different use cases, such as :dump, :cherry_pick, :put, and :install_with_make.

For remote files ark supports URLs using the remote_file resource. Local files are accessed with the file:// syntax.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Oracle
  • Fedora
  • FreeBSD
  • SmartOS
  • macOS
  • openSUSE / SUSE Linux Enterprises
  • Windows

Should work on common Unix/Linux systems with typical userland utilities like tar, gzip, etc. May require the installation of build tools for compiling from source, but that installation is outside the scope of this cookbook.

Chef

  • Chef 14+

Cookbooks

  • seven_zip

Attributes

Customize the attributes to suit site specific conventions and defaults.

  • node['ark']['apache_mirror'] - if the URL is an apache mirror, use the attribute as the default. default: http://apache.mirrors.tds.net
  • node['ark']['prefix_root'] - default base location if the prefix_root is not passed into the resource. default: /usr/local
  • node['ark']['prefix_bin'] - default binary location if the prefix_bin is not passed into the resource. default: /usr/local/bin
  • node['ark']['prefix_home'] - default home location if the prefix_home is not passed into the resource. default: /usr/local
  • node['ark']['package_dependencies'] - prerequisite system packages that need to be installed to support ark. default: varies based on platform
  • node['ark']['tar'] - allows overriding the default path to the tar binary, which varies based on platform
  • node['ark']['sevenzip_binary'] - allows overriding the default path to the 7zip binary, which is determined based on registry key value

Resources

  • ark - does the extract/build/configure

Actions

  • :install: extracts the file and creates a 'friendly' symbolic link to the extracted directory path
  • :configure: configure ahead of the install action
  • :install_with_make: extracts the archive to a path, runs configure, make, and make install.
  • :dump: strips all directories from the archive and dumps the contained files into a specified path
  • :cherry_pick: extract a specified file from an archive and places in specified path
  • :put: extract the archive to a specified path, does not create any symbolic links
  • :remove: removes the extracted directory and related symlink #TODO
  • :setup_py: runs the command "python setup.py" in the extracted directory
  • :setup_py_build: runs the command "python setup.py build" in the extracted directory
  • :setup_py_install: runs the command "python setup.py install" in the extracted directory

:cherry_pick

Extract a specified file from an archive and places in specified path.

Relevant Attribute Parameters for :cherry_pick

  • path: directory to place file in.
  • creates: specific file to cherry-pick.

:dump

Strips all directories from the archive and dumps the contained files into a specified path.

NOTE: This currently only works for zip archives

Attribute Parameters for :dump

  • path: path to dump files to.

  • mode: file mode for app_home, as an integer.

    • Example: 0775
  • creates: if you are appending files to a given directory, ark needs a condition to test whether the file has already been extracted. You can specify with creates, a file whose existence indicates the ark has previously been extracted and does not need to be extracted again.

:put

Extract the archive to a specified path, does not create any symbolic links.

Attribute Parameters for :put

  • path: path to extract to.

    • Default: /usr/local
  • append_env_path: boolean, if true, append the ./bin directory of the extracted directory to the global PATH variable for all users.

Attribute Parameters

  • name: name of the package, defaults to the resource name.

  • url: url for tarball, .tar.gz, .bin (oracle-specific), .war, and .zip currently supported. Also supports special syntax

  • :name:version:apache_mirror: that will auto-magically construct download url from the apache mirrors site.

  • version: software version, defaults to 1.

  • mode: file mode for app_home, is an integer.

  • prefix_root: default prefix_root, for use with :install* actions.

  • prefix_home: default directory prefix for a friendly symlink to the path.

    • Example: /usr/local/maven -> /usr/local/maven-2.2.1
  • prefix_bin: default directory to place a symlink to a binary command.

    • Example: /opt/bin/mvn -> /opt/maven-2.2.1/bin/mvn, where the prefix_bin is /opt/bin
  • path: path to extract the ark to. The :install* actions overwrite any user-provided values for :path.

    • Default: /usr/local/<name>-<version> for the :install, :install_with_make actions
  • home_dir: symbolic link to the path :prefix_root/:name-:version, does not apply to :dump, :put, or :cherry_pick actions.

    • Default: :prefix_root/:name
  • has_binaries: array of binary commands to symlink into /usr/local/bin/, you must specify the relative path.

    • Example: [ 'bin/java', 'bin/javaws' ]
  • append_env_path: boolean, similar to has_binaries but less granular. If true, append the ./bin directory of the extracted directory to. the PATH environment variable for all users, by placing a file in /etc/profile.d/. The commands are symbolically linked into /usr/bin/*. This option provides more granularity than the boolean option.

    • Example: mvn, java, javac, etc.
  • environment: hash of environment variables to pass to invoked shell commands like tar, unzip, configure, and make.

  • strip_components: number of components in path to strip when extracting archive. With default value of 1, ark strips the leading directory from an archive, which is the default for both unzip and tar commands.

  • autoconf_opts: an array of command line options for use with the GNU autoconf script.

    • Example: [ '--include=/opt/local/include', '--force' ]
  • make_opts: an array of command line options for use with make.

    • Example: [ '--warn-undefined-variables', '--load-average=2' ]
  • owner: owner of extracted directory.

    • Default: root
  • group: group of extracted directory.

    • Default: root
  • backup: The number of backups to be kept in /var/chef/backup (for UNIX- and Linux-based platforms) or C:/chef/backup (for the Microsoft Windows platform). Set to false to prevent backups from being kept.

    • Default: 5

Examples

This example copies ivy.tar.gz to /var/cache/chef/ivy-2.2.0.tar.gz, unpacks its contents to /usr/local/ivy-2.2.0/ -- stripping the leading directory, and symlinks /usr/local/ivy to /usr/local/ivy-2.2.0

 # install Apache Ivy dependency resolution tool
 ark "ivy" do
   url 'http://someurl.example.com/ivy.tar.gz'
   version '2.2.0'
   checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
   action :install
 end

This example copies jdk-7u2-linux-x64.tar.gz to /var/cache/chef/jdk-7.2.tar.gz, unpacks its contents to /usr/local/jvm/jdk-7.2/ -- stripping the leading directory, symlinks /usr/local/jvm/default to /usr/local/jvm/jdk-7.2, and adds /usr/local/jvm/jdk-7.2/bin/ to the global PATH for all users. The user 'foobar' is the owner of the /usr/local/jvm/jdk-7.2 directory:

 ark 'jdk' do
   url 'http://download.example.com/jdk-7u2-linux-x64.tar.gz'
   version '7.2'
   path "/usr/local/jvm/"
   home_dir "/usr/local/jvm/default"
   checksum  '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
   append_env_path true
   owner 'foobar'
 end

Install Apache Ivy dependency resolution tool in /resource_name in this case /usr/local/ivy, do not symlink, and strip any leading directory if one exists in the tarball:

 ark "ivy" do
    url 'http://someurl.example.com/ivy.tar.gz'
    checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
    action :put
 end

Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any leading directory if one exists, don't keep backup copies of ivy.tar.gz:

 ark "ivy" do
   path "/home/foobar"
   url 'http://someurl.example.com/ivy.tar.gz'
   checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
   action :put
   backup false
 end

Strip all directories and dump files into path specified by the path attribute. You must specify the creates attribute in order to keep the extraction from running every time. The directory path will be created if it doesn't already exist:

 ark "my_jars" do
   url  "http://example.com/bunch_of_jars.zip"
   path "/usr/local/tomcat/lib"
   creates "mysql.jar"
   owner "tomcat"
   action :dump
 end

Extract specific files from a tarball (currently only handles one named file):

 ark 'mysql-connector-java' do
   url 'http://oracle.com/mysql-connector.zip'
   creates 'mysql-connector-java-5.0.8-bin.jar'
   path '/usr/local/tomcat/lib'
   action :cherry_pick
 end

Build and install haproxy and use alternative values for prefix_root, prefix_home, and prefix_bin:

 ark "haproxy" do
   url  "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
   version "1.5"
   checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
   make_opts [ 'TARGET=linux26' ]
   prefix_root '/opt'
   prefix_home '/opt'
   prefix_bin  '/opt/bin'
   action :install_with_make
 end

You can also supply the file extension in case the file extension can not be determined by the URL:

 ark "test_autogen" do
   url 'https://github.com/zeromq/libzmq/tarball/master'
   extension "tar.gz"
   action :install_with_make
 end

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

More Repositories

1

docker

Development repository for the docker cookbook
Ruby
1,348
star
2

elasticsearch

Development repository for the elasticsearch cookbook
Ruby
882
star
3

aws

Development repository for the aws cookbook
Ruby
594
star
4

nginx

Development repository for the nginx cookbook
Ruby
551
star
5

rvm

Development repository for the rvm cookbook
Ruby
516
star
6

php

Development repository for the php cookbook
HTML
445
star
7

jenkins

Development repository for the jenkins cookbook
Ruby
424
star
8

java

Development repository for the java cookbook
Ruby
397
star
9

postgresql

Development repository for the postgresql cookbook
Ruby
357
star
10

mysql

Development repository for the mysql cookbook
Ruby
336
star
11

ruby_rbenv

Development repository for the ruby_rbenv cookbook
Ruby
332
star
12

redisio

Development repository for the redisio cookbook
HTML
297
star
13

apache2

Development repository for the apache2 cookbook
Ruby
282
star
14

nodejs

Development repository for the nodejs cookbook
Ruby
228
star
15

apt

Development repository for the apt cookbook
Ruby
203
star
16

consul

Development repository for the consul cookbook
Ruby
191
star
17

haproxy

Development repository for the haproxy cookbook
Ruby
156
star
18

graphite

Development repository for the graphite cookbook
Ruby
154
star
19

homebrew

Development repository for the homebrew cookbook
Ruby
151
star
20

users

Development repository for the users cookbook
Ruby
138
star
21

nagios

Development repository for the nagios cookbook
Ruby
125
star
22

ruby_build

Development repository for the ruby_build cookbook
Ruby
123
star
23

git

Development repository for the git cookbook
Ruby
123
star
24

logrotate

Development repository for the logrotate cookbook
Ruby
122
star
25

percona

Development repository for the percona cookbook
Ruby
117
star
26

openssh

Development repository for the openssh cookbook
Ruby
114
star
27

powershell

Development repository for the powershell cookbook
Ruby
110
star
28

postfix

Development repository for the postfix cookbook
Ruby
103
star
29

tomcat

Development repository for the tomcat cookbook
Ruby
99
star
30

openvpn

Development repository for the openvpn cookbook
Ruby
98
star
31

line

Development repository for the line cookbook
Ruby
97
star
32

firewall

Development repository for the firewall cookbook
Ruby
95
star
33

yum

Development repository for the yum cookbook
Ruby
95
star
34

kafka

Development repository for the kafka cookbook
Ruby
91
star
35

erlang

Development repository for the erlang cookbook
Ruby
87
star
36

sublimechef

A Sublime Text 2 Package for authoring Chef related files
84
star
37

iis

Development repository for the iis cookbook
Ruby
82
star
38

etcd

Development repository for the etcd cookbook
Ruby
79
star
39

cron

Development repository for the cron cookbook
Ruby
77
star
40

grafana

Development repository for the grafana cookbook
Ruby
76
star
41

chef-splunk

Development repository for the chef-splunk cookbook
Ruby
76
star
42

sc-mongodb

Development repository for the sc-mongodb cookbook
Ruby
75
star
43

certificate

Development repository for the certificate cookbook
Ruby
73
star
44

ntp

Development repository for the ntp cookbook
Ruby
68
star
45

rsyslog

Development repository for the rsyslog cookbook
Ruby
65
star
46

sql_server

Development repository for the sql_server cookbook
Ruby
63
star
47

fail2ban

Development repository for the fail2ban cookbook
Ruby
58
star
48

selinux

Development repository for the selinux cookbook
Ruby
58
star
49

windows_ad

Development repository for the windows_ad cookbook
Ruby
58
star
50

vagrant

Development repository for the vagrant cookbook
Ruby
57
star
51

varnish

Development repository for the varnish cookbook
Ruby
56
star
52

lvm

Development repository for the lvm cookbook
Ruby
56
star
53

perl

Development repository for the perl cookbook
Ruby
52
star
54

golang

Development repository for the golang cookbook
Ruby
50
star
55

memcached

Development repository for the memcached cookbook
Ruby
49
star
56

mariadb

Development repository for the mariadb cookbook
Ruby
48
star
57

hashicorp-vault

Development repository for the hashicorp-vault cookbook
Ruby
46
star
58

rundeck

Development repository for the rundeck cookbook
Ruby
46
star
59

ossec

Development repository for the ossec cookbook
Ruby
44
star
60

ufw

Development repository for the ufw cookbook
Ruby
44
star
61

confluence

Development repository for the confluence cookbook
Ruby
43
star
62

openldap

Development repository for the openldap cookbook
Ruby
42
star
63

nfs

Development repository for the nfs cookbook
Ruby
40
star
64

kubernetes

Development repository for the kubernetes cookbook
Ruby
39
star
65

vim

Development repository for the vim cookbook
Ruby
38
star
66

maven

Development repository for the maven cookbook
Ruby
36
star
67

bind

Development repository for the bind cookbook
Ruby
36
star
68

passenger_apache2

Development repository for the passenger_apache2 cookbook
Ruby
36
star
69

keepalived

Development repository for the keepalived cookbook
Ruby
33
star
70

aptly

Development repository for the aptly cookbook
Ruby
31
star
71

samba

Development repository for the samba cookbook
Ruby
30
star
72

resolver

Development repository for the resolver cookbook
Ruby
28
star
73

squid

Development repository for the squid cookbook
Ruby
28
star
74

snort

Development repository for the snort cookbook
Ruby
27
star
75

pyenv

Development repository for the pyenv cookbook
Ruby
27
star
76

freebsd

Development repository for the freebsd cookbook
Ruby
27
star
77

dhcp

Development repository for the dhcp cookbook
Ruby
27
star
78

nrpe

Development repository for the nrpe cookbook
Ruby
25
star
79

rsync

Development repository for the rsync cookbook
Ruby
24
star
80

github

Development repository for the github cookbook
Ruby
24
star
81

filesystem

Development repository for the filesystem cookbook
Ruby
24
star
82

yum-epel

Development repository for the yum-epel cookbook
Ruby
23
star
83

network_interfaces

Development repository for the network_interfaces cookbook
Ruby
23
star
84

drbd

Development repository for the drbd cookbook
Ruby
19
star
85

djbdns

Development repository for the djbdns cookbook
Ruby
19
star
86

sssd_ldap

Development repository for the sssd_ldap cookbook
Ruby
18
star
87

dpkg_autostart

Development repository for the dpkg_autostart cookbook
Ruby
18
star
88

packagecloud

Development repository for the packagecloud cookbook
Ruby
17
star
89

webpi

Development repository for the webpi cookbook
Ruby
17
star
90

gems

Development repository for the gems cookbook
Ruby
17
star
91

language-chef

Development repository for the language-chef plugin for the Atom text editor
JavaScript
17
star
92

elixir

Development repository for the elixir cookbook
Ruby
17
star
93

htpasswd

Development repository for the htpasswd cookbook
Ruby
15
star
94

stunnel

Development repository for the stunnel cookbook
Ruby
14
star
95

apparmor

Development repository for the apparmor cookbook
Ruby
14
star
96

smartmontools

Development repository for the smartmontools cookbook
HTML
13
star
97

transmission

Development repository for the transmission cookbook
Ruby
13
star
98

gpg

Development repository for the gpg cookbook
Ruby
12
star
99

wix

Development repository for the wix cookbook
Ruby
12
star
100

tftp

Development repository for the tftp cookbook
Ruby
11
star