Permalink
Browse files

Setup thumbor as upstart-run daemon.

  • Loading branch information...
1 parent aae7c68 commit c21839c03c361d7f12e81307f5ccfcc8a99a7701 @wichert wichert committed Sep 25, 2012
Showing with 215 additions and 3 deletions.
  1. +2 −1 .gitignore
  2. +4 −1 debian/rules
  3. +145 −0 debian/thumbor.conf
  4. +13 −0 debian/thumbor.default
  5. +1 −1 debian/thumbor.lintian-overrides
  6. +14 −0 debian/thumbor.postinst
  7. +11 −0 debian/thumbor.postrm
  8. +25 −0 debian/thumbor.upstart
View
@@ -20,9 +20,10 @@ opencv
# Debian packaging
/debian/files
+/debian/thumbor/
/debian/thumbor.debhelper.log
/debian/thumbor.postinst.debhelper
+/debian/thumbor.preinst.debhelper
/debian/thumbor.prerm.debhelper
/debian/thumbor.substvars
-/debian/thumbor/
/debian/tmp/
View
@@ -17,14 +17,17 @@ binary-arch: build-arch
dh_testroot
dh_prep
python$(PYTHON2) setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
+ install -d -o root -g root -m 755 debian/thumbor/etc
+ install -p -o root -g root -m 644 debian/thumbor.conf debian/thumbor/etc
dh_install --exclude=.c
+ dh_python2
dh_strip
dh_shlibdeps
dh_installdirs
dh_installdocs README.mkd
+ dh_installinit --restart-after-upgrade
dh_installchangelogs
dh_lintian
- dh_python2
dh_compress
dh_fixperms
dh_installdeb
View
@@ -0,0 +1,145 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# thumbor imaging service
+# https://github.com/globocom/thumbor/wiki
+
+# Licensed under the MIT license:
+# http://www.opensource.org/licenses/mit-license
+# Copyright (c) 2011 globo.com timehome@corp.globo.com
+
+# the domains that can have their images resized
+# use an empty list for allow all sources
+#ALLOWED_SOURCES = ['mydomain.com']
+
+# the max width of the resized image
+# use 0 for no max width
+# if the original image is larger than MAX_WIDTH x MAX_HEIGHT,
+# it is proportionally resized to MAX_WIDTH x MAX_HEIGHT
+# MAX_WIDTH = 800
+
+# the max height of the resized image
+# use 0 for no max height
+# if the original image is larger than MAX_WIDTH x MAX_HEIGHT,
+# it is proportionally resized to MAX_WIDTH x MAX_HEIGHT
+# MAX_HEIGHT = 600
+
+# the quality of the generated image
+# this option can vary widely between
+# imaging engines and works only on jpeg images
+QUALITY = 85
+
+# enable this options to specify client-side cache in seconds
+MAX_AGE = 24 * 60 * 60
+
+# client-side caching time for temporary images (using queued detectors or after detection errors)
+MAX_AGE_TEMP_IMAGE = 0
+
+# the way images are to be loaded
+LOADER = 'thumbor.loaders.http_loader'
+
+# maximum size of the source image in Kbytes.
+# use 0 for no limit.
+# this is a very important measure to disencourage very
+# large source images.
+# THIS ONLY WORKS WITH http_loader.
+MAX_SOURCE_SIZE = 0
+
+# if you set UPLOAD_ENABLED to True,
+# a route /upload will be enabled for your thumbor process
+# You can then do a put to this URL to store the photo
+# using the specified Storage
+UPLOAD_ENABLED = False
+UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
+UPLOAD_PUT_ALLOWED = False
+UPLOAD_DELETE_ALLOWED = False
+
+# how to store the loaded images so we don't have to load
+# them again with the loader
+#STORAGE = 'thumbor.storages.redis_storage'
+#STORAGE = 'thumbor.storages.no_storage'
+STORAGE = 'thumbor.storages.file_storage'
+#STORAGE = 'thumbor.storages.mixed_storage'
+
+# root path of the file storage
+FILE_STORAGE_ROOT_PATH = '/var/lib/thumbor/storage'
+
+# If you want to cache results, use this options to specify how to cache it
+# Set Expiration seconds to ZERO if you want them not to expire.
+#RESULT_STORAGE = 'thumbor.result_storages.file_storage'
+#RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 # one day
+#RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/result_storage'
+
+RESULT_STORAGE_STORES_UNSAFE=False
+
+# stores the crypto key in each image in the storage
+# this is VERY useful to allow changing the security key
+STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True
+
+#REDIS_STORAGE_SERVER_HOST = 'localhost'
+#REDIS_STORAGE_SERVER_PORT = 6379
+#REDIS_STORAGE_SERVER_DB = 0
+#REDIS_STORAGE_SERVER_PASSWORD = None
+
+# imaging engine to use to process images
+#ENGINE = 'thumbor.engines.graphicsmagick'
+#ENGINE = 'thumbor.engines.pil'
+ENGINE = 'thumbor.engines.opencv'
+
+# detectors to use to find Focal Points in the image
+# more about detectors can be found in thumbor's docs
+# at https://github.com/globocom/thumbor/wiki
+DETECTORS = [
+ 'thumbor.detectors.face_detector',
+ 'thumbor.detectors.feature_detector',
+]
+
+# Redis parameters for queued detectors
+# REDIS_QUEUE_SERVER_HOST = 'localhost'
+# REDIS_QUEUE_SERVER_PORT = 6379
+# REDIS_QUEUE_SERVER_DB = 0
+# REDIS_QUEUE_SERVER_PASSWORD = None
+
+# if you use face detection this is the file that
+# OpenCV will use to find faces. The default should be
+# fine, so change this at your own peril.
+# if you set a relative path it will be relative to
+# the thumbor/detectors/face_detector folder
+#FACE_DETECTOR_CASCADE_FILE = 'haarcascade_frontalface_alt.xml'
+
+# this is the security key used to encrypt/decrypt urls.
+# make sure this is unique and not well-known
+# This can be any string of up to 16 characters
+SECURITY_KEY = "MY_SECURE_KEY"
+
+# if you enable this, the unencryted URL will be available
+# to users.
+# IT IS VERY ADVISED TO SET THIS TO False TO STOP OVERLOADING
+# OF THE SERVER FROM MALICIOUS USERS
+ALLOW_UNSAFE_URL = False
+
+# Mixed storage classes. Change them to the fullname of the
+# storage you desire for each operation.
+#MIXED_STORAGE_FILE_STORAGE = 'thumbor.storages.file_storage'
+#MIXED_STORAGE_CRYPTO_STORAGE = 'thumbor.storages.no_storage'
+#MIXED_STORAGE_DETECTOR_STORAGE = 'thumbor.storages.no_storage'
+
+FILTERS = [
+ 'thumbor.filters.brightness',
+ 'thumbor.filters.contrast',
+ 'thumbor.filters.rgb',
+ 'thumbor.filters.round_corner',
+ 'thumbor.filters.quality',
+ 'thumbor.filters.noise',
+ 'thumbor.filters.watermark',
+ 'thumbor.filters.equalize',
+ 'thumbor.filters.fill',
+ 'thumbor.filters.sharpen',
+ 'thumbor.filters.strip_icc',
+ 'thumbor.filters.frame',
+
+ # can only be applied if there are already points for the image being served
+ # this means that either you are using the local face detector or the image
+ # has already went through remote detection
+ # 'thumbor.filters.redeye',
+]
View
@@ -0,0 +1,13 @@
+# set this to 0 to disable thumboer, or to 1 to enable it
+# you can temporarily override this with
+# sudo service thumbor start force_start=1
+enabled=0
+
+# Location of the configuration file
+conffile=/etc/thumbor.conf
+
+# IP address to bind to. Defaults to all IP addresses
+# ip=127.0.0.1
+
+# TCP port to bind to. Defaults to port 8888
+# port=8888
@@ -1,2 +1,2 @@
thumbor: new-package-should-close-itp-bug
-thumbor: script-not-executable usr/share/pyshared/thumbor/thumbor.conf
+thumbor: script-not-executable etc/thumbor.conf
View
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+ if ! getent passwd thumbor | grep -q thumbor; then
+ useradd --system --user-group --home /var/lib/thumbor thumbor
+ mkdir -p /var/lib/thumbor/storage
+ chmod -R 755 /var/lib/thumbor/storage
+ chown -R thumbor:thumbor /var/lib/thumbor
+ fi
+fi
+
+#DEBHELPER#
View
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "purge" ] ; then
+ if ! getent passwd thumbor | grep -q thumbor; then
+ userdel -r thumbor
+ fi
+fi
+
+#DEBHELPER#
View
@@ -0,0 +1,25 @@
+description "Thumbor image manipulation service"
+author "Wichert Akkerman <wichert@wiggy.net>"
+
+start on filesystem and runlevel [2345]
+stop on runlevel [!2345]
+
+respawn
+respawn limit 5 10
+umask 022
+
+setuid thumbor
+setgid thumbor
+
+env conffile=/etc/thumbor.conf
+env ip=0.0.0.0
+env port=8888
+
+chdir /var/lib/thumbor
+
+pre-start script
+ [ -r /etc/default/thumbor ] && . /etc/default/thumbor
+ [ "$enabled" = "1" ] || [ "$force_start" = "1" ] || exit 0
+end script
+
+exec /usr/bin/thumbor -c "${conffile}" -i "${ip}" -p "${port}"

0 comments on commit c21839c

Please sign in to comment.