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
- Dotenv
- Procfile
- Rails
- Webhooks
- rsyslog Watch Files
- rsyslog Watch OpsWork Event
- swap
- 3rd Party Cookbooks
- OS Packages
- Packaging
- Notes
System utilities.
utilities::locale_gen_zhtw
Setup - locale-gen zh_TW.UTF-8
dotenv::default
Deploy - Generate an .env file for dotenv for each deploy.
Reads the content of an application's Procfile
and start each process with monit. Currently supports
worker
and clock
.
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
Deployprocfile::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.
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
Deployprocfile::clock-undeploy
Undeploy
rails::opsrp_setapp
Setup (for Passenger/Rails) -bin/rake
tasks andbin/rails console
with ease by downloading this script and alias it assa
.
Send custom HTTP callbacks while specific events occurs.
webhooks::webhooks_setup
Setupwebhooks::webhooks_configure
Configurewebhooks::webhooks_deploy
Deploywebhooks::webhooks_undeploy
Undeploywebhooks::webhooks_shutdown
Shutdown
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 | [] |
Watch and send custom log files with rsyslog. Requires rsyslog.
rsyslog_watch_files::default
Setup - Setup watching custom files for rsyslog
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"
}
Report the OpsWork events log with rsyslog. Requires rsyslog and monit.
rsyslog_opswork_event::default
Setup
swap::1024
Setup - Setup swapfile to 1024MBswap::2048
Setup - Setup swapfile to 2048MBswap::4096
Setup - Setup swapfile to 4096MBswap::remove
- Remove swapfile
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
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)
['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
Here are some recommended (or required) OS packages that can set to be installed.
nodejs
- system Node.jslibpq-dev
- header files for libpq5, required if using PostgreSQLimagemagick
- commonly used for apps to create, edit, compose, or convert bitmap images
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.
The Recipe description used in this documentation follows this syntax as convention:
recipe::name
OpsWorks lifecycle that recommend to set on - recipe description