Skip to content
Snippets Groups Projects
Commit 62b6b855 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Use loris server instead of iipsrv

parent 918a19fd
No related branches found
No related tags found
No related merge requests found
......@@ -3,20 +3,31 @@ version: "3.2"
services:
# Our own build of IIPsrv
iipsrv:
build: iipsrv
#iipsrv:
# build: iipsrv
depends_on:
- memcached
# depends_on:
# - memcached
# volumes:
# - type: volume
# source: ./logs
# target: /var/log
# - type: bind
# source: ./images
# target: /images
# iipsrv cache
#memcached:
# image: memcached:alpine
loris:
build: loris
volumes:
- type: volume
source: ./logs
target: /var/log
- type: bind
source: ./images
target: /images
target: /loris/images
# Nginx server as a gateway to iipsrv FCGI
nginx:
......@@ -27,8 +38,4 @@ services:
- "9000:80"
depends_on:
- iipsrv
# iipsrv cache
memcached:
image: memcached:alpine
- loris
FROM debian
MAINTAINER Bastien Abadie, NextCairn <bastien@nextcairn.com>
# Install dependencies
RUN apt-get update -y
RUN apt-get install -y wget tar python python-pip python-setuptools libjpeg62-turbo-dev libfreetype6-dev zlib1g-dev liblcms2-dev liblcms2-utils libtiff5-dev python-dev libwebp-dev
RUN pip install Pillow gunicorn
# Add loris user and conf
RUN addgroup loris
RUN adduser --home=/loris --ingroup=loris --disabled-password loris
RUN mkdir -p /loris/cache /loris/tmp /loris/www /loris/logs
VOLUME "/loris/images"
COPY loris2.conf /etc/loris2.conf
# Download loris source code
WORKDIR /tmp/loris
RUN wget https://github.com/loris-imageserver/loris/archive/v2.2.0.tar.gz -O loris.tar.gz
RUN tar xzf loris.tar.gz --strip-components 1
# Build loris
RUN pip install -r requirements.txt
RUN python setup.py install \
--image-cache=/loris/cache \
--info-cache=/loris/cache \
--tmp-dir=/loris/tmp \
--www-dir=/loris/www \
--log-dir=/loris/logs \
--source-images=/loris/images
RUN ln -s /loris/www/loris2.wsgi /loris/www/loris2.py
# bind test server to 0.0.0.0
#RUN sed -i -- 's/localhost/0.0.0.0/g' webapp.py
#RUN sed -i 's/app = create_app(debug=True)/app = create_app(debug=False, config_file_path=conf_fp)/g' webapp.py
# Cleanup
WORKDIR /loris
RUN rm -rf /tmp/loris
# Run loris on port 9000
EXPOSE 9000
CMD ["gunicorn", "--bind=0.0.0.0:9000", "--chdir=/loris/www", "loris2"]
[loris.Loris]
tmp_dp = '/tmp/loris2/tmp' # r--
www_dp = '/var/www/loris2' # r-x
run_as_user = 'loris'
run_as_group = 'loris'
enable_caching = True
redirect_canonical_image_request = False
redirect_id_slash_to_info = True
# max_size_above_full restricts interpolation of images on the server.
# Default value 200 means that a user cannot request image sizes greater than
# 200% of original image size (width or height).
# Set this value to 100 to disallow interpolation. Set to 0 to remove
# size restriction.
max_size_above_full = 200
[logging]
log_to = 'console' # 'console'|'file'
log_level = 'INFO' # 'DEBUG'|'INFO'|'WARNING'|'ERROR'|'CRITICAL'
#log_dir = '/var/log/loris2' # rw-
#max_size = 5242880 # 5 MB
#max_backups = 5
format = '%(asctime)s (%(name)s) [%(levelname)s]: %(message)s'
[resolver]
impl = 'loris.resolver.SimpleFSResolver'
src_img_root = '/usr/local/share/images' # r--
#Example of one version of SimpleHTTResolver config
#[resolver]
#impl = 'loris.resolver.SimpleHTTPResolver'
#source_prefix='https://<server>/fedora/objects/'
#source_suffix='/datastreams/accessMaster/content'
#cache_root='/usr/local/share/images/loris'
#user='<if needed else remove this line>'
#pw='<if needed else remove this line>'
#cert='<SSL client cert for authentication>'
#key='<SSL client key for authentication>'
#ssl_check='<Check for SSL errors. Defaults to True. Set to False to ignore issues with self signed certificates>'
# Sample config for TemplateHTTResolver config
# [resolver]
# impl = 'loris.resolver.TemplateHTTPResolver'
# cache_root='/usr/local/share/images/loris'
## optional settings
# delimiter = "|" # optional delimiter for splitting identifier, allowing for n-values to be inserted into the template
# default_format
# head_resolvable = False
# templates = 'a, b, fedora, devfedora, fedora_obj_ds'
# [[a]]
# url='http://example.edu/images/%s'
# [[b]]
# url='http://example.edu/images-elsewhere/%s'
## optional overrides for requests using this template
# user='otheruser'
# pw='secret'
# [[fedora]]
# url='http://<server>/fedora/objects/%s/datastreams/accessMaster/content'
## optional overrides for requests using this template
# cert='/path/to/client.pem'
# key='/path/to/client.key'
# [[fedora_obj_ds]]
# url = 'http://<server>/fedora/objects/%s/datastreams/%s/content' # as used with delimiter option below
[img.ImageCache]
# must be on the same volume as tmp_dp, for atomic move operations
# will crash if on another volume
cache_dp = '/var/cache/loris' # rwx
[img_info.InfoCache]
# must be on the same volume as tmp_dp, for atomic move operations
# will crash if on another volume
cache_dp = '/var/cache/loris' # rwx
[transforms]
dither_bitonal_images = False
target_formats = ['jpg','png','gif','webp']
[[jpg]]
impl = 'JPG_Transformer'
[[tif]]
impl = 'TIF_Transformer'
[[png]]
impl = 'PNG_Transformer'
# [[jp2]]
# impl = 'KakaduJP2Transformer'
# tmp_dp = '/tmp/loris/tmp/jp2' # rwx
# kdu_expand = '/usr/local/bin/kdu_expand' # r-x
# kdu_libs = '/usr/local/lib' # r--
# num_threads = '4' # string!
# mkfifo = '/usr/bin/mkfifo' # r-x
# map_profile_to_srgb = False
# srgb_profile_fp = '/usr/share/color/icc/colord/sRGB.icc' # r--
[[jp2]]
src_format = 'jp2'
impl = 'OPJ_JP2Transformer'
tmp_dp = '/tmp/loris/tmp/jp2' # rwx
opj_decompress = '/usr/local/bin/opj_decompress' # r-x
opj_libs = '/usr/local/lib' # r--
mkfifo = '/usr/bin/mkfifo' # r-x
map_profile_to_srgb = True
srgb_profile_fp = '/usr/share/color/icc/colord/sRGB.icc' # r--
upstream iip {
server iipsrv:9000;
upstream loris {
server loris:9000;
}
server {
listen 80;
location / {
add_header "Content-Type" "text/plain";
return 200 "Horae";
}
location /images {
fastcgi_param PATH_INFO /iipsrv.fcgi; #$fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param HTTPS $https if_not_empty;
# Forward to iipsrv instance
fastcgi_pass iip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://loris;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment