johnbellone / libartifact-cookbook

Library cookbook which provides a resource for managing release artifacts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libartifact-cookbook

Library cookbook which provides a resource for managing release artifacts.

This cookbook takes an opinionated approach to managing release artifacts on the system. It utilizes the libarchive cookbook to extract remote files to a release directory. After this is done it creates (or updates) a current symlink so that scripts can always reference the most recent version of the packaged software.

An example of the layout on the file system would go as follows:

/srv/twbs % ll
total 12K
4.0K drwxr-xr-x. 2 jbellone jbellone 4.0K May 20 14:38 3.3.1/
4.0K drwxr-xr-x. 2 root     root     4.0K May 20 14:38 3.3.2/
4.0K drwxr-xr-x. 2 jbellone jbellone 4.0K May 20 14:38 3.3.4/
   0 lrwxrwxrwx. 1 root     root       15 May 20 14:38 current -> /srv/twbs/3.3.4/

Requirements

Usage

Here is a simple recipe for installing the Redis database. This will extract the files from the remote location to /srv/redis/3.0.1 and create a symbolic link from /srv/redis/current to /srv/redis/3.0.1.

include_recipe 'build-essential::default'

source_version = '3.0.1'
download_url = "http://download.redis.io/releases/%{name}-%{version}.tar.gz"

group 'redis' do
  system true
end

user 'redis' do
  system true
  gid 'redis'
end

libartifact_file 'redis-3.0.1' do
  artifact_name 'redis'
  artifact_version '3.0.1'
  owner 'redis'
  group 'redis'
  remote_url download_url
  notifies :restart, 'service[redis-server]', :delayed
end

service 'redis-server' do
  supports :restart, :reload
  action [:create, :start]
end

It is important to note that the both the user and group must exist. The resource does not make an attempt to create these. If you want to restart a service you can do so using Chef notifications.

libartifact_file Resource/Provider

Actions

Name Description
create Downloads and extracts a released artifact.
delete Deletes a release artifact and unlinks the current symlink.

Parameters

Key Type Description
artifact_name String Name of the release artifact.
artifact_version String Version of the release artifact.
install_path String Absolute path to the base location for extracting release artifact.
binary_url String, Array Location(s) to download the release artifact.
binary_checksum String SHA256 checksum of the release artifact.
owner String Owner of the release artifact.
group String Group of the release artifact.
extract_options Hash Extraction options to pass into the libarchive cookbook.

About

Library cookbook which provides a resource for managing release artifacts.


Languages

Language:Ruby 100.0%