Skip to content

Instantly share code, notes, and snippets.

@gesteves
Last active October 15, 2021 01:09
Show Gist options
  • Save gesteves/4da1c4a98b756d84ed29 to your computer and use it in GitHub Desktop.
Save gesteves/4da1c4a98b756d84ed29 to your computer and use it in GitHub Desktop.

Revisions

  1. gesteves revised this gist Aug 24, 2015. 1 changed file with 22 additions and 3 deletions.
    25 changes: 22 additions & 3 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,26 @@ pip install thumbor
    easy_install supervisor
    mkdir /home/logs

    # Install JPEG Archive

    sudo apt-get install build-essential autoconf pkg-config nasm libtool
    git clone https://github.com/mozilla/mozjpeg.git
    cd mozjpeg
    autoreconf -fiv
    ./configure --with-jpeg8
    make
    sudo make install

    cd ..
    git clone https://github.com/danielgtaylor/jpeg-archive.git
    cd jpeg-archive
    make
    sudo make install

    # Install thumbor-plugins

    pip install https://github.com/thumbor/thumbor-plugins/archive/master.zip

    # Then configure thumbor at /etc/thumbor.conf

    import os
    @@ -29,11 +49,10 @@ FILTERS = [
    ]

    OPTIMIZERS = [
    'thumbor.optimizers.jpegtran',
    'thumbor_plugins.optimizers.jpegrecompress',
    ]


    JPEGTRAN_PATH = '/usr/bin/jpegtran'
    JPEGRECOMPRESS_PATH = '/usr/local/bin/jpeg-recompress'
    ALLOW_UNSAFE_URL = False
    AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
  2. gesteves revised this gist Aug 22, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,8 @@ FILTERS = [
    'thumbor.filters.quality',
    'thumbor.filters.no_upscale',
    'thumbor.filters.blur',
    'thumbor.filters.strip_icc',
    'thumbor.filters.max_bytes',
    ]

    OPTIMIZERS = [
  3. gesteves revised this gist Aug 22, 2015. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ apt-get install nginx
    /etc/init.d/nginx start
    apt-get install python-dev
    apt-get install python-pip
    apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv
    apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv libjpeg-progs
    ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
    pip install pillow
    pip install thumbor
    @@ -26,6 +26,12 @@ FILTERS = [
    'thumbor.filters.blur',
    ]

    OPTIMIZERS = [
    'thumbor.optimizers.jpegtran',
    ]


    JPEGTRAN_PATH = '/usr/bin/jpegtran'
    ALLOW_UNSAFE_URL = False
    AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
  4. gesteves revised this gist Aug 9, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,7 @@ DETECTORS = [
    FILTERS = [
    'thumbor.filters.quality',
    'thumbor.filters.no_upscale',
    'thumbor.filters.blur',
    ]

    ALLOW_UNSAFE_URL = False
  5. gesteves revised this gist Jul 10, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ SECURITY_KEY = 'putsomethinghere'
    STORAGE = 'thumbor.storages.file_storage'
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365
    STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/storage'
    RESULT_STORAGE = 'thumbor.storages.file_storage'
    RESULT_STORAGE = 'thumbor.result_storages.file_storage'
    RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365
    RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/result_storage'

  6. gesteves revised this gist Jul 9, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -35,10 +35,11 @@ PRESERVE_EXIF_INFO = True
    SECURITY_KEY = 'putsomethinghere'

    STORAGE = 'thumbor.storages.file_storage'
    RESULT_STORAGE = 'thumbor.storages.file_storage'
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365
    STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/storage'
    RESULT_STORAGE = 'thumbor.storages.file_storage'
    RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365

    RESULT_STORAGE_FILE_STORAGE_ROOT_PATH = '/tmp/thumbor/result_storage'

    # Then configure supervisor at /etc/supervisord.conf

  7. gesteves revised this gist Jul 9, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,7 @@ SECURITY_KEY = 'putsomethinghere'
    STORAGE = 'thumbor.storages.file_storage'
    RESULT_STORAGE = 'thumbor.storages.file_storage'
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365
    RESULT_STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365


    # Then configure supervisor at /etc/supervisord.conf
  8. gesteves revised this gist Jul 9, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,7 @@ PRESERVE_EXIF_INFO = True
    SECURITY_KEY = 'putsomethinghere'

    STORAGE = 'thumbor.storages.file_storage'
    RESULT_STORAGE = 'thumbor.storages.file_storage'
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365


  9. gesteves revised this gist Jun 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100
    RESPECT_ORIENTATION = True
    PRESERVE_EXIF = True
    PRESERVE_EXIF_INFO = True

    SECURITY_KEY = 'putsomethinghere'

  10. gesteves revised this gist Jun 18, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,7 @@ AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100
    RESPECT_ORIENTATION = True
    PRESERVE_EXIF = True

    SECURITY_KEY = 'putsomethinghere'

  11. gesteves revised this gist Jun 9, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,7 @@ ALLOW_UNSAFE_URL = False
    AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100
    RESPECT_ORIENTATION = True

    SECURITY_KEY = 'putsomethinghere'

  12. gesteves revised this gist Jun 8, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,7 @@ upstream thumbor {
    }
    server {
    listen 80;
    server_name example.com;
    server_name localhost;
    location / {
    proxy_pass http://thumbor;
    }
  13. gesteves revised this gist Jun 8, 2015. 1 changed file with 17 additions and 11 deletions.
    28 changes: 17 additions & 11 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Install all of the things
    # First, install all of the things

    apt-get update
    apt-get install nginx
    @@ -8,11 +8,11 @@ apt-get install python-pip
    apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv
    ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
    pip install pillow
    pip install thumbor==4.12.2
    pip install thumbor
    easy_install supervisor
    mkdir logs
    mkdir /home/logs

    # /etc/thumbor.conf
    # Then configure thumbor at /etc/thumbor.conf

    import os

    @@ -30,13 +30,13 @@ AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100

    SECURITY_KEY = '7Pq0p3SrtiuQP6raNQkHlNogfP2j10112'
    SECURITY_KEY = 'putsomethinghere'

    STORAGE = 'thumbor.storages.file_storage'
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 30
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 365


    # /etc/supervisord.conf
    # Then configure supervisor at /etc/supervisord.conf

    [supervisord]
    [program:thumbor]
    @@ -47,16 +47,16 @@ autostart=true
    autorestart=true
    startretries=3
    stopsignal=TERM
    stdout_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stdout.log
    stdout_logfile=/home/logs/thumbor800%(process_num)s.stdout.log
    stdout_logfile_maxbytes=1MB
    stdout_logfile_backups=10
    stderr_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stderr.log
    stderr_logfile=/home/logs/thumbor800%(process_num)s.stderr.log
    stderr_logfile_maxbytes=1MB
    stderr_logfile_backups=10

    $ supervisord -c /etc/supervisord.conf

    # /etc/nginx/nginx.conf
    # Then configure nginx at /etc/nginx/sites-available/thumbor

    upstream thumbor {
    server 127.0.0.1:8000;
    @@ -66,10 +66,16 @@ upstream thumbor {
    }
    server {
    listen 80;
    server_name localhost;
    server_name example.com;
    location / {
    proxy_pass http://thumbor;
    }
    }

    # Then move the thumbor site to sites-enabled

    $ ln -s /etc/nginx/sites-available/thumbor /etc/nginx/sites-enabled/thumbor

    # Finally, start nginx

    $ service nginx start
  14. gesteves revised this gist Apr 21, 2015. 1 changed file with 1 addition and 17 deletions.
    18 changes: 1 addition & 17 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -22,23 +22,7 @@ DETECTORS = [

    FILTERS = [
    'thumbor.filters.quality',
    ]

    ALLOW_UNSAFE_URL = False
    AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100

    SECURITY_KEY = 'whatever'

    import os

    DETECTORS = [
    'thumbor.detectors.face_detector',
    ]

    FILTERS = [
    'thumbor.filters.quality',
    'thumbor.filters.no_upscale',
    ]

    ALLOW_UNSAFE_URL = False
  15. gesteves revised this gist Apr 21, 2015. 1 changed file with 20 additions and 1 deletion.
    21 changes: 20 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,26 @@ QUALITY = 100

    SECURITY_KEY = 'whatever'

    STORAGE = 'thumbor.storages.no_storage'
    import os

    DETECTORS = [
    'thumbor.detectors.face_detector',
    ]

    FILTERS = [
    'thumbor.filters.quality',
    ]

    ALLOW_UNSAFE_URL = False
    AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100

    SECURITY_KEY = '7Pq0p3SrtiuQP6raNQkHlNogfP2j10112'

    STORAGE = 'thumbor.storages.file_storage'
    STORAGE_EXPIRATION_SECONDS = 60 * 60 * 24 * 30


    # /etc/supervisord.conf

  16. gesteves revised this gist Apr 21, 2015. 1 changed file with 23 additions and 19 deletions.
    42 changes: 23 additions & 19 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -12,24 +12,6 @@ pip install thumbor==4.12.2
    easy_install supervisor
    mkdir logs

    # /etc/supervisord.conf

    [supervisord]
    [program:thumbor]
    command=thumbor --conf="/etc/thumbor.conf" --port=800%(process_num)s
    process_name=thumbor800%(process_num)s
    numprocs=4
    autostart=true
    autorestart=true
    startretries=3
    stopsignal=TERM
    stdout_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stdout.log
    stdout_logfile_maxbytes=1MB
    stdout_logfile_backups=10
    stderr_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stderr.log
    stderr_logfile_maxbytes=1MB
    stderr_logfile_backups=10

    # /etc/thumbor.conf

    import os
    @@ -51,6 +33,26 @@ SECURITY_KEY = 'whatever'

    STORAGE = 'thumbor.storages.no_storage'

    # /etc/supervisord.conf

    [supervisord]
    [program:thumbor]
    command=thumbor --conf="/etc/thumbor.conf" --port=800%(process_num)s
    process_name=thumbor800%(process_num)s
    numprocs=4
    autostart=true
    autorestart=true
    startretries=3
    stopsignal=TERM
    stdout_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stdout.log
    stdout_logfile_maxbytes=1MB
    stdout_logfile_backups=10
    stderr_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stderr.log
    stderr_logfile_maxbytes=1MB
    stderr_logfile_backups=10

    $ supervisord -c /etc/supervisord.conf

    # /etc/nginx/nginx.conf

    upstream thumbor {
    @@ -65,4 +67,6 @@ server {
    location / {
    proxy_pass http://thumbor;
    }
    }
    }

    $ service nginx start
  17. gesteves revised this gist Apr 20, 2015. 1 changed file with 17 additions and 1 deletion.
    18 changes: 17 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -49,4 +49,20 @@ QUALITY = 100

    SECURITY_KEY = 'whatever'

    STORAGE = 'thumbor.storages.no_storage'
    STORAGE = 'thumbor.storages.no_storage'

    # /etc/nginx/nginx.conf

    upstream thumbor {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
    server 127.0.0.1:8003;
    }
    server {
    listen 80;
    server_name localhost;
    location / {
    proxy_pass http://thumbor;
    }
    }
  18. gesteves revised this gist Apr 20, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,6 @@ import os

    DETECTORS = [
    'thumbor.detectors.face_detector',
    'thumbor.detectors.feature_detector',
    ]

    FILTERS = [
  19. gesteves created this gist Apr 20, 2015.
    53 changes: 53 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    # Install all of the things

    apt-get update
    apt-get install nginx
    /etc/init.d/nginx start
    apt-get install python-dev
    apt-get install python-pip
    apt-get install libjpeg-dev libpng-dev libtiff-dev libjasper-dev libgtk2.0-dev python-numpy python-pycurl libwebp-dev python-opencv
    ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
    pip install pillow
    pip install thumbor==4.12.2
    easy_install supervisor
    mkdir logs

    # /etc/supervisord.conf

    [supervisord]
    [program:thumbor]
    command=thumbor --conf="/etc/thumbor.conf" --port=800%(process_num)s
    process_name=thumbor800%(process_num)s
    numprocs=4
    autostart=true
    autorestart=true
    startretries=3
    stopsignal=TERM
    stdout_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stdout.log
    stdout_logfile_maxbytes=1MB
    stdout_logfile_backups=10
    stderr_logfile=/home/ubuntu/logs/thumbor800%(process_num)s.stderr.log
    stderr_logfile_maxbytes=1MB
    stderr_logfile_backups=10

    # /etc/thumbor.conf

    import os

    DETECTORS = [
    'thumbor.detectors.face_detector',
    'thumbor.detectors.feature_detector',
    ]

    FILTERS = [
    'thumbor.filters.quality',
    ]

    ALLOW_UNSAFE_URL = False
    AUTO_WEBP = True
    MAX_AGE = 60 * 60 * 24 * 365
    QUALITY = 100

    SECURITY_KEY = 'whatever'

    STORAGE = 'thumbor.storages.no_storage'