Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

stash (53) Versions 3.12.0

Installs/Configures Atlassian Stash

Policyfile
Berkshelf
Knife
cookbook 'stash', '= 3.12.0', :supermarket
cookbook 'stash', '= 3.12.0'
knife supermarket install stash
knife supermarket download stash
README
Dependencies
Changelog
Quality 100%

chef-stash Build Status

Description

Installs/Configures Atlassian Stash server and Atlassian Stash Backup Client. Provides LWRPs for code deployment via Stash as well as for hook and repository management. Please see [COMPATIBILITY.md](COMPATIBILITY.md) for more information about Stash releases (versions and checksums) that are tested and supported by cookbook versions.

Requirements

Platforms

  • CentOS 6, 7
  • RHEL 6, 7
  • Ubuntu 12.04, 14.04

Chef

  • Version 3.X of cookbook requires Chef 11 due to ark usage

Databases

  • HSQLDB (not recommended for production usage)
  • Microsoft SQL Server
  • MySQL
  • Postgres

Cookbooks

Required Opscode Cookbooks

Third-Party Cookbooks

Attributes

These attributes are under the node['stash'] namespace.

Attribute Description Type Default
checksum SHA256 checksum for Stash install String auto-detected (see attributes/default.rb)
home_path home data directory for Stash user String /var/atlassian/application-data/stash
install_path location to install Stash String /opt/atlassian
install_type Stash install type - "standalone" only for now String standalone
url_base URL base for Stash install String http://www.atlassian.com/software/stash/downloads/binary/atlassian-stash
url URL for Stash install String auto-detected (see attributes/default.rb)
user user to run Stash String stash
version Stash version to install String 3.3.1

Stash Backup Client Attributes

These attributes are under the node['stash']['backup_client'] namespace. Some of these attributes are overridden by stash/stash encrypted data bag (Hosted Chef) or data bag (Chef Solo), if it exists.

Attribute Description Type Default
backup_path Path for backups String /tmp
baseurl Stash base URL String https://#{node['fqdn']}/
checksum SHA256 checksum for Stash Backup Client install String auto-detected (see attributes/default.rb)
install_path location to install Stash Backup Client String /opt/atlassian-stash-backup-client
password Stash administrative user password String changeit
url_base URL base for Stash Backup Client install String http://downloads.atlassian.com/software/stash/downloads/stash-backup-distribution
user Stash administrative user String admin
version Stash Backup Client version to install String 1.4.0

Stash Backup Client Cron Attributes

These attributes are under the node['stash']['backup_client']['cron'] namespace. All of these attributes are overridden by stash/stash encrypted data bag (Hosted Chef) or data bag (Chef Solo), if it exists.

Attribute Description Type Default
day Day of month String *
hour Hour of day String 0
minute Minute of hour String 0
month Month of year String *
weekday Day of week String *

Stash Database Attributes

All of these node['stash']['database'] attributes are overridden by stash/stash encrypted data bag (Hosted Chef) or data bag (Chef Solo), if it exists

Attribute Description Type Default
host FQDN or "localhost" (localhost automatically installs ['database']['type'] server) String localhost
name Stash database name String stash
password Stash database user password String changeit
port Stash database port Fixnum 3306
testInterval Stash database pool idle test interval in minutes Fixnum 2
type Stash database type - "hsqldb" (not recommended), "mysql", "postgresql", or "sqlserver" String mysql
user Stash database user String stash

Stash JVM Attributes

These attributes are under the node['stash']['jvm'] namespace.

Attribute Description Type Default
minimum_memory JVM minimum memory String 512m
maximum_memory JVM maximum memory String 768m
maximum_permgen JVM maximum PermGen memory String 256m
java_opts additional JAVA_OPTS to be passed to Stash JVM during startup String ""
support_args additional JAVA_OPTS recommended by Atlassian support for Stash JVM during startup String ""

Stash Plugin Attributes

All of these node['stash']['plugin'] attributes are overridden by stash/stash encrypted data bag (Hosted Chef) or data bag (Chef Solo), if it exists

Attribute Description Type Default
key A key/value pair to be inserted into stash-config.properties as plugin.key=value - -

Stash SSH Attributes

These attributes are under the node['stash']['ssh'] namespace.

Attribute Description Type Default
hostname Stash SSH hostname String node['fqdn']
port Stash SSH port Fixnum 7999
uri Stash SSH URI String ssh://git@#{node['stash']['ssh']['hostname']}:#{node['stash']['ssh']['port']}

Stash Tomcat Attributes

These attributes are under the node['stash']['tomcat'] namespace.

Any node['stash']['tomcat']['key*'] attributes are overridden by stash/stash encrypted data bag (Hosted Chef) or data bag (Chef Solo), if it exists

Attribute Description Type Default
keyAlias Tomcat SSL keystore alias String tomcat
keystoreFile Tomcat SSL keystore file - will automatically generate self-signed keystore file if left as default String #{node['stash']['home_path']}/.keystore
keystorePass Tomcat SSL keystore passphrase String changeit
port Tomcat HTTP port Fixnum 7990
ssl_port Tomcat HTTPS port Fixnum 8443

Recipes

  • recipe[stash] Installs Atlassian Stash with built-in Tomcat and Apache 2 proxy
  • recipe[stash::apache2] Installs/configures Apache 2 proxy for Stash (ports 80/443)
  • recipe[stash::backup_client] Installs/configures Atlassian Stash Backup Client
  • recipe[stash::backup_client_cron] Installs/configures Atlassian Stash Backup Client cron.d
  • recipe[stash::configuration] Configures Stash's settings
  • recipe[stash::database] Installs/configures MySQL/Postgres server, database, and user for Stash
  • recipe[stash::linux_standalone] Installs/configures Stash via Linux standalone archive
  • recipe[stash::service_init] Installs/configures Stash init service
  • recipe[stash::tomcat_configuration] Configures Stash's built-in Tomcat

LWRPs

  • stash_deploy - wrapper Git resource for using a stash_deploy_key, project, and repository for code deployment
  • stash_deploy_key - creates SSH private key file and SSH wrapper for code deployment
  • hook - Wrapper to enable/disable/configure a stash hook (requires the user account password to be in chef-vault)
  • repo - Wrapper to create/delete a stash repository (requires the user account password to be in chef-vault)

Usage

Stash Server Data Bag

For securely overriding attributes on Hosted Chef, create a stash/stash encrypted data bag with the model below. Chef Solo can override the same attributes with a stash/stash unencrypted data bag of the same information.

required:
* ['database']['type'] "hsqldb" (not recommended), "mysql", "postgresql", or "sqlserver"
* ['database']['host'] FQDN or "localhost" (localhost automatically
installs ['database']['type'] server)
* ['database']['name'] Name of Stash database
* ['database']['user'] Stash database username
* ['database']['password'] Stash database username password

optional:
* ['backup_client']['user'] Stash administrative username for backup client
* ['backup_client']['password'] Stash administrative password for backup client
* ['database']['port'] Database port, standard database port for
['database']['type']
* ['plugin']['KEY'] plugin.KEY=VALUE to be inserted in stash-config.properties
* ['tomcat']['keyAlias'] Tomcat HTTPS Java Keystore keyAlias, defaults to self-signed certifcate
* ['tomcat']['keystoreFile'] Tomcat HTTPS Java Keystore keystoreFile, self-signed certificate
* ['tomcat']['keystorePass'] Tomcat HTTPS Java Keystore keystorePass, self-signed certificate

Repeat for other Chef environments as necessary. Example:

{
  "id": "stash"
  "development": {
    "database": {
      "type": "postgresql",
      "host": "localhost",
      "name": "stash",
      "user": "stash",
      "password": "stash_db_password",
    },
    "tomcat": {
      "keyAlias": "not_tomcat",
      "keystoreFile": "/etc/pki/java/wildcard_cert.jks",
      "keystorePass": "not_changeit"
    }
  }
}

Stash Server Default Installation

  • Optionally use (un)encrypted data bag or set attributes
    • knife data bag create stash
    • knife data bag edit stash stash --secret-file=path/to/secret
  • Add recipe[stash] to your node's run list.

Stash Backup Client Installation

  • Optionally use (un)encrypted data bag or set attributes
    • knife data bag create stash
    • knife data bag edit stash stash --secret-file=path/to/secret
  • Add recipe[stash]['backup_client'] to your node's run list.

Stash Backup Client Cron Installation

  • Optionally use (un)encrypted data bag or set attributes
    • knife data bag create stash
    • knife data bag edit stash stash --secret-file=path/to/secret
  • Add recipe[stash]['backup_client_cron'] to your node's run list.

Code Deployment From Stash

  • Ensure your node has Git installed
  • Create a stash_deploy_key with the SSH private key contents (using \n for newlines) of a Stash user with permissions to your repository.

For example:

stash_deploy_key "deployment_user" do
  key "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIB..."
end
  • In this example, now you can either directly use the ssh_wrapper available at #{node['stash']['install_path']}/deployment_user_ssh_wrapper.sh or use the stash_deploy LWRP.

Such as:

stash_deploy "/opt/shibboleth-idp/conf" do
  deploy_key "deployment_user"
  project "SHIBIDP"
  repository "configuration"
end

Testing and Development

Here's how you can quickly get testing or developing against the cookbook thanks to Vagrant and Berkshelf.

vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-cachier
vagrant plugin install vagrant-omnibus
git clone git://github.com/bflad/chef-stash.git
cd chef-stash
vagrant up BOX # BOX being centos5, centos6, debian7, fedora18, fedora19, fedora20, freebsd9, ubuntu1204, ubuntu1210, ubuntu1304, or ubuntu1310

You need to add the following hosts entries:

  • 192.168.50.10 stash-centos-6
  • 192.168.50.10 stash-ubuntu-1204
  • (etc.)

The running Stash server is accessible from the host machine:

CentOS 6 Box:
* Web UI: https://stash-centos-6/
* Stash SSH: ssh://git@stash-centos-6:7999/

Ubuntu 12.04 Box:
* Web UI: https://stash-ubuntu-1204/
* Stash SSH: ssh://git@stash-ubuntu-1204:7999/

You can then SSH into the running VM using the vagrant ssh BOX command.

The VM can easily be stopped and deleted with the vagrant destroy command. Please see the official Vagrant documentation for a more in depth explanation of available commands.

Test Kitchen

Please see documentation in: [TESTING.md](TESTING.md)

Contributing

Please use standard Github issues/pull requests and if possible, in combination with testing on the Vagrant boxes.

License and Contributors

Please see license information in: [LICENSE](LICENSE)

Dependent cookbooks

apache2 >= 0.0.0
ark >= 0.0.0
cron >= 0.0.0
database >= 0.0.0
git >= 0.0.0
java >= 0.0.0
mysql >= 0.0.0
mysql_connector >= 0.0.0
perl >= 0.0.0
postgresql >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

3.12.0

  • Enhancement: Default to Stash 3.3.2
  • Enhancement: #39: git package for CentOS/RHEL 7

3.11.0

  • Enhancement: #32: Support apache 2.4 access control syntax
  • Enhancement: #36: Add unset of basic auth header in web app config
  • Enhancement: #37: Default to Stash 3.3.0 (Tomcat 8)

3.10.1

  • Enhancement: #33: Default to Stash 3.1.1

3.10.0

  • Enhancement: Default to Stash 3.1.0

3.9.1

  • Enhancement: Default to Stash 3.0.5

3.9.0

  • Enhancement: Default to Stash 3.0.1

3.8.3

  • Enhancement: #29: Default to Stash 2.12.3

3.8.2

  • Enhancement: #27: Default to Stash 2.12.2

3.8.1

  • Enhancement: #26: Default to Stash 2.12.1 and Stash Backup Client 1.2.1

3.8.0

  • Enhancement: Default to Stash 2.12.0
  • Enhancement: Default to Stash Backup Client 1.2.0
  • Enhancement: Skip backup client installation in default recipe by setting version to nil

3.7.0

  • Enhancement: #23 Default Stash to 2.11.2

3.6.0

  • Bugfix: #16 Remove start action from stash service (database locking issues on initial installation)
  • Enhancement: Default to Stash 2.10.1
  • Enhancement: Default to Stash Backup Client 1.1.0

3.5.0

  • Default to Stash Backup Client 1.0.3

3.4.0

  • Default to Stash 2.9.4

3.3.0

  • Default to Stash 2.9.2

3.2.0

  • Default to Stash 2.8.4

3.1.2

  • Bugfix: #19 Add node['database']['testInterval'] attribute (defaults to 2) to reduce remote idle connection disconnects

3.1.1

  • Stash database connection fix for localhost MySQL setup with bind_address set to 0.0.0.0

3.1.0

  • Default to Stash 2.8.2
  • Switch subscribes to string notation in service_init recipe

3.0.1

  • Syntax adjustment to Hash diff helper method to support Ruby 1.8

3.0.0

3.0.0 Major Changes

Additions

  • Cookbook dependency: ark (handling downloads and extracting)
  • Recipe: default (installs backup_client recipe -- use backup_client_cron if you'd like it automatically running via cron)
  • Attribute: node['stash']['install_type'] (possible future usage, defaults to standalone)
  • Attribute: node['stash']['service_type'] (possible future usage, defaults to init)

Removals

  • Recipe: upgrade (ark handles symlinks automatically and use Stash Backup Client for backups)
  • Attribute node['stash']['backup_home'] (use Stash Backup Client instead)
  • Attribute node['stash']['backup_install'] (use Stash Backup Client instead)
  • Attribute node['stash']['home_backup'] (use Stash Backup Client instead)
  • Attribute node['stash']['install_backup'] (use Stash Backup Client instead)

Modifications

  • apache2 recipe: no longer includes default recipe
  • Attribute renamed:
    • From: node['stash']['run_user']
    • To: node['stash']['user']
    • Reasoning: Consistency with other cookbooks
  • Attribute default: node['stash']['home_path']
    • From: /home/stash
    • To: /var/atlassian/application-data/stash
    • Reasoning: Match Atlassian recommendations
    • See Migrating home_path and install_path section for manual steps to perform cookbook upgrade
  • Attribute default: node['stash']['home_path']
    • From: /opt/atlassian-stash
    • To: /opt/atlassian (symlinks /opt/atlassian/stash-X.Y.Z to /opt/atlassian/stash)
    • Reasoning: Match Atlassian recommendations
    • See Migrating home_path and install_path section for manual steps to perform cookbook upgrade
  • Attributes moved:
    • From: apache2.rb
    • To: default.rb
  • default recipe: separate recipes
    • configuration
    • database
    • linux_standalone
    • service_init
    • tomcat_configuration

Migrating home_path and install_path

To switch to new defaults:
* Ensure Chef client won't run (service chef-client stop, etc.)
* service stash stop
* mkdir -p /var/atlassian/application-data
* usermod -d /var/atlassian/application-data/stash -m stash
* mkdir /opt/atlassian
* mv /opt/atlassian-stash /opt/atlassian/stash-X.Y.Z
* ln -s /opt/atlassian/stash-X.Y.Z /opt/atlassian/stash
* Start Chef client again (service chef-client start, etc.)

3.0.0 Minor Changes

  • Update COMPATIBILITY.md to easier to read format and migrate checksums to default attributes
  • Added vagrant-cachier to Vagrantfile
  • Added ubuntu1210 and ubuntu1304 to Test Kitchen and Vagrantfile
  • Added TESTING.md for documentation about Test Kitchen
  • Added Guardfile
  • Added .rubocop.yml
  • Bump Gemfile.ci to Chef 11.6.0
  • Move all licensing statements to LICENSE

2.21.0

  • Add plugin attributes/databag items for insertion into stash-config.properties

2.20.0

  • Default to Stash 2.8.1
  • Default to Stash Backup Client 1.0.0 (with new download URL)

2.19.0

2.18.0

  • Bump default Stash version to 2.7.0

2.17.0

  • Initial HSQLDB support (not recommended for production)
    • Only need to set "hsqldb" for node['stash']['database']['type'] and select internal database on setup

2.16.0

  • Bump default Stash version to 2.6.3

2.15.0

  • Bump default Stash version to 2.6.0

2.14.0

  • Bump default Stash version to 2.5.0

2.13.0

  • Bump default Stash version to 2.4.2

2.12.0

  • Bump default Stash version to 2.4.1

2.11.0

  • Add default sqlserver port to settings library
  • Tested support for Microsoft SQL Server

2.10.1

  • Add LWRP update notifications

2.10.0

  • Add hook LWRP for interfacing with Stash hooks
  • Add repo LWRP for interfacing with Stash repositories

2.9.0

  • Bump default Stash version to 2.4.0
  • Fix run_user attribute ordering

2.8.0

  • Checksum attribute auto-detection
  • Added url_base attribute

2.7.0

  • Untested support for Microsoft SQL server

2.6.1

  • Bump default Stash to 2.3.1

2.6.0

  • Default to installing Stash 2.3.0
  • Updated Vagrant box URLs to Chef 11.2.0 since tested and works

2.5.0

  • Default to installing Stash 2.2.0
  • Use new node['stash']['home_path']/lib directory support for persistent MySQL Connector/J library
  • Set node['build_essential']['compiletime'] = true to ensure build tools are ready
  • Oracle JDK 7 for Vagrant testing

2.4.0

  • Added Perl dependency (required for Stash 2.X)
  • Ubuntu 12.04 support
  • Better handling of apache2 listen_ports in apache2 recipe

2.3.1

  • Chef 11 fixes for apache2 recipe

2.3.0

  • Stash 2.x support
  • Bumped default Stash installation to 2.1.1

2.2.0

  • Added Chef Solo support by refactoring settings into library function
  • Refactored localhost database handling in default recipe
  • Additional node['stash']['database'] and node['stash']['tomcat'] attributes from settings refactoring

2.1.8

  • Use generic database_user with provider for last MySQL fix

2.1.7

  • On MySQL, drop anonymous localhost user due to MySQL issue

2.1.6

  • Made stash_deploy LWRP only updated if underlying Git resource was updated

2.1.5

  • Removed SSH URI default attribute to prevent caching issues with SSH hostname

2.1.4

  • Corrected ssh_wrapper.sh template

2.1.3

  • deploy LWRP s/owner/user/g for Git resource

2.1.2

  • deploy LWRP fixed action attribute to deploy_action so it can be passed through

2.1.1

  • Set deploy_key cookbook for ssh_wrapper.sh template to stash

2.1.0

  • Added stash_deploy and stash_deploy_key LWRPs
  • Added SSH attributes

2.0.2

  • Fixed location of stash-config.properties

2.0.1

  • Renamed service in upgrade recipe to prevent resource caching issues
  • Fixed service notifications in default recipe
  • Subscribed stash service to java_ark[jdk] updates

2.0.0

  • Uses mysql_connector cookbook for handling MySQL Connector/J installation
  • stash::upgrade recipe now just calls stash::default rather than duplicating code
  • Includes git::source recipe on "rhel" platform_family since Git package version is not new enough
  • Refactored to use apache2 cookbook web_app

1.0.3

  • Fixes broken apache VirtualHost minitest

1.0.2

  • Includes initial minitests

1.0.1

  • Fixes installation existance check from change in Stash 1.3

1.0.0

  • Ready for production, supports Stash 1.3
  • Fixed upgrade recipe template names
  • Documentation updated for actual functionality

0.2.16

  • Renamed upgrade template blocks to prevent caching issues

0.2.15

  • Fixed loading all encrypted databag objects for upgrade recipe

0.2.14

  • Added templates to upgrade recipe

0.2.13

  • Renamed upgrade recipe execute block description to prevent caching issue

0.2.12

  • FC001: Use strings in preference to symbols to access node attributes

0.2.11

  • Removing install directory before copying new Stash version directory

0.2.10

  • Fixed home directory backup
  • Forcing overwrite with mv -f for new Stash version directory

0.2.9

  • Added encrypted data bag retrieval for stash::upgrade

0.2.8

  • Bump default Stash version to 1.2.3

0.2.7

  • Fixing localhost MySQL host since mysql::server doesn't appear to work with localhost and MySQL Connector/J

0.2.6

  • Added host parameter for mysql database user grant to fix bind-address issue

0.2.5

  • Refactored and fixed database and database user provider handling

0.2.4

  • Misspelled MySQL collation for localhost database creation

0.2.3

  • Fix for Integer default port for database cookbook

0.2.2

  • Community cookbooks now including specific recipes for database resource usage

0.2.1

  • Fix for localhost database_connection merging

0.2.0

  • Initial upgrade recipe

0.1.0

  • Initial beta release with default and Apache recipes.

Foodcritic Metric
            

3.12.0 passed this metric