Skip to content

zanui/chef-thumbor

Repository files navigation

thumbor Cookbook

Cookbook Coverage Status Build Status

Installs/configures thumbor - an open-source photo thumbnail service by globo.com

NOTE: This cookbook has been heavily refactored. Please read the CHANGELOG.

Features

  • Install packages for engines pil, opencv, graphicsmagick, gifsicle
  • Install methods package, source, pip
  • Support image format WEBP
  • Support Storage AWS S3
  • ServerSpec/Infrataster Tests
  • thumbor Stack on AWS OpsWorks in 10 minutes

Requirements

Platform:

  • Ubuntu (>= 12.04)

Cookbooks:

  • apt - Configures apt and apt services and LWRPs for managing apt repositories and preferences
  • python - Installs Python, pip and virtualenv.
  • nginx - Installs and configures nginx
  • monit-ng - Installs and configures monit
  • redisio - Installs/Configures redis

Attributes

The list of attributes found in the documentation is just an overview of important attributes. Please look through the attributes directory in order to find attributes that may not be listed here.

thumbor::default

Key Type Description Default
node['thumbor']['version'] String 4.11.1
node['thumbor']['workers'] Integer node['cpu']['total']

thumbor::config

Key Type Description Default
node['thumbor']['conf_file'] String /etc/thumbor.conf
node['thumbor']['key_file'] String /etc/thumbor.key
node['thumbor']['options'] Boolean Defaults to `"{ ... }"`.
node['thumbor']['options']['QUALITY'] Boolean Defaults to `"85"`.
node['thumbor']['options']['MAX_AGE'] Boolean Defaults to `"24 * 60 * 60"`.
node['thumbor']['options']['MAX_AGE_TEMP_IMAGE'] Boolean Defaults to `"0"`.
node['thumbor']['options']['ALLOW_UNSAFE_URL'] Boolean Defaults to `"true"`.
node['thumbor']['options']['LOADER'] Boolean Defaults to `"thumbor.loaders.http_loader"`.
node['thumbor']['options']['UPLOAD_ENABLED'] Boolean Defaults to `"false"`.
node['thumbor']['options']['UPLOAD_PHOTO_STORAGE'] Boolean Defaults to `"false"`.
node['thumbor']['options']['STORAGE'] Boolean Defaults to `"thumbor.storages.no_storage"`.
node['thumbor']['options']['FILE_STORAGE_ROOT_PATH'] Boolean Defaults to `"/var/lib/thumbor/storage"`.
node['thumbor']['options']['RESULT_STORAGE_FILE_STORAGE_ROOT_PATH'] Boolean Defaults to `"/var/lib/thumbor/result-storage"`.
node['thumbor']['options']['RESULT_STORAGE_STORES_UNSAFE'] Boolean Defaults to `"false"`.
node['thumbor']['options']['STORES_CRYPTO_KEY_FOR_EACH_IMAGE'] Boolean Defaults to `"true"`.
node['thumbor']['options']['ENGINE'] Boolean Defaults to `"thumbor.engines.pil"`.
node['thumbor']['options']['DETECTORS'] Boolean Defaults to `"[ ... ]"`.
node['thumbor']['options']['REDIS_QUEUE_SERVER_HOST'] Boolean Defaults to `"127.0.0.1"`.
node['thumbor']['options']['REDIS_QUEUE_SERVER_PORT'] Boolean Defaults to `"6379"`.
node['thumbor']['options']['REDIS_QUEUE_SERVER_DB'] Boolean Defaults to `"0"`.
node['thumbor']['options']['REDIS_QUEUE_SERVER_PASSWORD'] Boolean Defaults to `"None"`.
node['thumbor']['options']['AUTO_WEBP'] Boolean Defaults to `"true"`.
node['thumbor']['options']['FILTERS'] Boolean Defaults to `"[ ... ]"`.

thumbor::initstyle

Key Type Description Default
node['thumbor']['version'] Boolean Defaults to `"4.11.1"`.
node['thumbor']['package_name'] Boolean Defaults to `"thumbor"`.
node['thumbor']['workers'] Boolean Defaults to `"node['cpu']['total']"`.
node['thumbor']['base_port'] Boolean Defaults to `"9000"`.
node['thumbor']['key'] Boolean Defaults to `"secretkey"`.
node['thumbor']['result_storage'] Boolean Defaults to `"file"`.
node['thumbor']['install_method'] Boolean Defaults to `"pip"`.
node['thumbor']['source'] Boolean Defaults to `"git+git://github.com/globocom/thumbor.git@\#{node['thumbor']['version']}"`.
node['thumbor']['init_style'] Boolean Defaults to `"upstart"`.
node['thumbor']['listen_address'] Boolean Defaults to `"127.0.0.1"`.
node['thumbor']['proxy']['type'] Boolean Defaults to `"nginx"`.
node['thumbor']['monit']['enable'] Boolean Defaults to `"true"`.
node['thumbor']['queue']['type'] Boolean Defaults to `"none"`.
node['thumbor']['pip_dependencies'] Boolean Defaults to `"[ ... ]"`.
node['thumbor']['package_dependencies'] Boolean Defaults to `"%w(cmake git)"`.
node['thumbor']['package_dependencies'] + Boolean Defaults to `"%w(python-pgmagick python-pycurl)"`.
node['thumbor']['service_config_file'] Boolean Defaults to `"case node['platform_family']"`.
node['thumbor']['work_dir'] Boolean Defaults to `"/var/lib/thumbor"`.
node['thumbor']['binary'] Boolean Defaults to `"case node['thumbor']['install_method']"`.
node['thumbor']['limits']['memlock'] Boolean Defaults to `"unlimited"`.
node['thumbor']['limits']['nofile'] Boolean Defaults to `"48_000"`.
node['thumbor']['limits']['nproc'] Boolean Defaults to `"unlimited"`.
node['thumbor']['log_level'] Boolean Defaults to `"warning"`.
node['thumbor']['log_dir'] Boolean Defaults to `"/var/log/thumbor"`.
node['thumbor']['logrotate']['rotate'] Boolean Defaults to `"7"`.
node['thumbor']['nginx']['port'] Boolean Defaults to `"81"`.
node['thumbor']['nginx']['server_name'] Boolean Defaults to `"_"`.
node['thumbor']['nginx']['client_max_body_size'] Boolean Defaults to `"10M"`.
node['thumbor']['nginx']['proxy_read_timeout'] Boolean Defaults to `"300"`.
node['thumbor']['nginx']['proxy_cache']['enabled'] Boolean Defaults to `"false"`.
node['thumbor']['nginx']['proxy_cache']['path'] Boolean Defaults to `"/var/www/thumbor_cache"`.
node['thumbor']['nginx']['proxy_cache']['key_zone'] Boolean Defaults to `"thumbor_cache"`.
node['thumbor']['nginx']['proxy_cache']['valid'] Boolean Defaults to `"900s"`.
node['thumbor']['nginx']['vhost']['cookbook'] Boolean Defaults to `"thumbor"`.
node['thumbor']['nginx']['vhost']['template'] Boolean Defaults to `"nginx.vhost.erb"`.
node['thumbor']['nginx']['vhost']['variables'] Boolean Defaults to `"{ ... }"`.
node['thumbor']['apt']['thumbor']['uri'] Boolean Defaults to `"http://ppa.launchpad.net/thumbor/ppa/ubuntu"`.
node['thumbor']['apt']['thumbor']['keyserver'] Boolean Defaults to `"keyserver.ubuntu.com"`.
node['thumbor']['apt']['thumbor']['components'] Boolean Defaults to `"%w(main)"`.
node['thumbor']['apt']['thumbor']['key'] Boolean Defaults to `"68DFB11CCBEC8F27"`.
node['thumbor']['apt']['thumbor']['deb_src'] Boolean Defaults to `"false"`.
node['thumbor']['apt']['thumbor']['action'] Boolean Defaults to `"add"`.
node['thumbor']['apt']['multiverse']['uri'] Boolean Defaults to `"http://archive.ubuntu.com/ubuntu"`.
node['thumbor']['apt']['multiverse']['distribution'] Boolean Defaults to `"node['lsb']['codename']"`.
node['thumbor']['apt']['multiverse']['keyserver'] Boolean Defaults to `"keyserver.ubuntu.com"`.
node['thumbor']['apt']['multiverse']['components'] Boolean Defaults to `"%w(main multiverse restricted universe)"`.
node['thumbor']['apt']['multiverse']['key'] Boolean Defaults to `"40976EAF437D05B5"`.
node['thumbor']['apt']['multiverse']['deb_src'] Boolean Defaults to `"false"`.
node['thumbor']['apt']['multiverse']['action'] Boolean Defaults to `"add"`.
node['thumbor']['apt']['thumbor']['distribution'] Boolean Defaults to `"node['lsb']['codename']"`.
node['thumbor']['user'] Boolean Defaults to `"thumbor"`.
node['thumbor']['group'] Boolean Defaults to `"thumbor"`.

Usage

thumbor::default

Simple:

{
  "name":"my_node",
  "run_list": [
    "recipe[thumbor]"
  ]
}

Generate a secret and disable unsafe-mode:

{
  "name":"my_node",
  "run_list": [
    "recipe[thumbor]"
  ],
  "default_attributes": {
    "thumbor": {
      "key": "This-Is-A-Secret-Key",
      "options": {
        "ALLOW_UNSAFE_URL": false
      }
    }
  }
}

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

Prerequisites

  • ChefDK

  • Recent RuboCop

    chef gem install rubocop
    

Testing

Test changes using

chef exec rake
chef exec kitchen verify

License and Authors

Author:: Enrico Stahn ([email protected])

Copyright 2015, Zanui

See LICENSE for license details