Skip to content

zetavg/opsworks_cookbooks

Repository files navigation

Cookbooks Collection for OpsWorks

A collection of useful cookbooks for AWS OpsWorks.

AWS OpsWorks is an application management service based on Chef that makes it easy for DevOps users to model & manage the entire application. This Cookbook collection provides some Recipes to enhance it for Ruby/Rails/Node.js application deployment and provide several additional functionalities.

Supported OS platforms: Ubuntu 14.04 LTS.



Utilities

System utilities.

Locale

  • utilities::locale_gen_zhtw Setup - locale-gen zh_TW.UTF-8

Dotenv

  • dotenv::default Deploy - Generate an .env file for dotenv for each deploy.

Procfile

Reads the content of an application's Procfile and start each process with monit. Currently supports worker and clock.

Worker

This recipe writes an monit configuration to start workers using the command specified in the Procfile. It will be ignored if Procfile doesn't exists or the worker process type isn't specified. Include these recipes in the worker instances.

  • procfile::worker Deploy
  • procfile::worker-undeploy Undeploy

Note that the worker process count can be set through each application's workers environment variable (deploy[:environment_variables][:workers]). The default is 3.

Clock

This recipe writes an monit configuration to start a clock using the command specified in the Procfile. It will be ignored if Procfile doesn't exists or the clock process type isn't specified. Include these recipes in the clock instance.

  • procfile::clock Deploy
  • procfile::clock-undeploy Undeploy

Rails

Command Line Shorthands

  • rails::opsrp_setapp Setup (for Passenger/Rails) - bin/rake tasks and bin/rails console with ease by downloading this script and alias it as sa.

Webhooks

Send custom HTTP callbacks while specific events occurs.

  • webhooks::webhooks_setup Setup
  • webhooks::webhooks_configure Configure
  • webhooks::webhooks_deploy Deploy
  • webhooks::webhooks_undeploy Undeploy
  • webhooks::webhooks_shutdown Shutdown

Attributes

Key Type Description Default
['webhooks_setup_url'] Array of Strings list of URLs to POST to []
['webhooks_configure_url'] Array of Strings list of URLs to POST to []
['webhooks_deploy_url'] Array of Strings list of URLs to POST to []
['webhooks_undeploy_url'] Array of Strings list of URLs to POST to []
['webhooks_shutdown_url'] Array of Strings list of URLs to POST to []

rsyslog Watch Files

Watch and send custom log files with rsyslog. Requires rsyslog.

  • rsyslog_watch_files::default Setup - Setup watching custom files for rsyslog

Attribute

node['rsyslog']['watch_files']: A hash of files and associated tags that will be configured to be watched and included for rsyslog logging. Example:

{
  "/var/log/apache2/app-access.log":          "apache2-app-access",
  "/var/log/apache2/app-error.log":           "apache2-app-error",
  "/var/log/aws/opsworks/opsworks-agent.log": "opsworks-agent"
}

rsyslog Watch OpsWork Event

Report the OpsWork events log with rsyslog. Requires rsyslog and monit.

  • rsyslog_opswork_event::default Setup

swap

  • swap::1024 Setup - Setup swapfile to 1024MB
  • swap::2048 Setup - Setup swapfile to 2048MB
  • swap::4096 Setup - Setup swapfile to 4096MB
  • swap::remove - Remove swapfile

3rd Party Cookbooks

Here are some 3rd party Cookbooks (included in Berksfile) and their common usage listed below.

Mobile shell, replacement for SSH.

  • mosh::default Setup
  • zsh::default Setup
  • newrelic::default Setup - installs the New Relic agent that performs the server monitoring
Attributes
Key Type Description Default
['newrelic']['license'] String your newrelic license key undefined
  • papertrail-rsyslog::default Setup - Setup logging to Papertrail (the full cookbook name should be used for OpsWorks)
Attributes
['papertrail']['port'] = The Papertrail log destination port number (required)
['papertrail']['host'] = The Papertrail host address (defaults to logs)
['papertrail']['syslog_selector'] = The syslog tags and types to stream into Papertrail (defaults to "*.*")
['papertrail']['resume_retry_count'] = The number of times to retry the sending of failed messages (defaults to unlimited)
['papertrail']['queue_disk_space'] = The maximum disk space allowed for queues (default to 100M)
['papertrail']['enable_tls'] = Whether to encrypt all log traffic going into Papertrail (default to True)
['papertrail']['certificate_src'] = The URL of the certificate file on the Papertrail server
['papertrail']['certificate_checksum'] = The sha256 checksum for the Papertrail certificate file

OS Packages

Here are some recommended (or required) OS packages that can set to be installed.

  • nodejs - system Node.js
  • libpq-dev - header files for libpq5, required if using PostgreSQL
  • imagemagick - commonly used for apps to create, edit, compose, or convert bitmap images

Packaging

Run bin/package to package this cookbook collection with all the dependencies and push it to the packaged branch of git remote server. The archives can be used for faster installation (no need to download all dependencies while installing the cookbook), especially while each run on OpsWorks.

Stack Custom Cookbooks on OpsWorks

Notes

Recipe Description Syntax

The Recipe description used in this documentation follows this syntax as convention:

  • recipe::name OpsWorks lifecycle that recommend to set on - recipe description

Layer Custom Chef Recipes on OpsWorks

About

A collection of useful cookbooks for AWS OpsWorks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published