Skip to content

Commit

Permalink
upgrades loris to 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh-0 committed Mar 27, 2020
1 parent 89a0ed1 commit 984cb31
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
38 changes: 23 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@ ENV HOME /root
ENV DEBIAN_FRONTEND noninteractive

# Update packages and install tools
RUN apt-get update -y
RUN apt-get update -y --fix-missing
RUN apt-get install -y --no-install-recommends \
gcc \
python3-dev python3-setuptools python3-pip \
wget curl git unzip \
libjpeg8 \
libjpeg8-dev \
libjpeg-turbo8-dev \
libfreetype6 \
libfreetype6-dev \
zlib1g-dev \
liblcms2-2 \
liblcms2-dev \
liblcms2-utils \
libtiff5-dev \
libwebp-dev \
libxml2-dev \
libxslt1-dev
libxslt1-dev \
zlib1g-dev

RUN python3 -m pip install --upgrade pip

Expand All @@ -40,10 +42,10 @@ RUN python3 -m pip install newrelic==5.8.0.136
# Install loris
WORKDIR /opt

RUN wget --quiet https://github.com/loris-imageserver/loris/archive/v2.3.3.zip \
&& unzip v2.3.3.zip \
&& mv loris-2.3.3 loris \
&& rm v2.3.3.zip
RUN wget --quiet https://github.com/loris-imageserver/loris/archive/v3.0.0.zip \
&& unzip v3.0.0.zip \
&& mv loris-3.0.0 loris \
&& rm v3.0.0.zip

RUN mkdir /usr/local/share/images

Expand All @@ -53,21 +55,27 @@ WORKDIR /opt/loris

# Load example images
# TODO: keep this for smoke tests?
RUN cp -R tests/img/* /usr/local/share/images/
#RUN cp -R tests/img/* /usr/local/share/images/

# note: setup.py does lots of fiddling with the environment, creation of directories, permissions,
# copying and generating files. just let it do it's thing and we'll override anything afterwards.
RUN python3 setup.py install --loris-owner www-data --loris-group www-data
COPY loris2.conf etc/loris2.conf
# this is what uwsgi will use to init loris.
# overwrites the one generated during `setup.py`
COPY loris2.wsgi /var/www/loris2/loris2.wsgi


# Configure uwsgi+wsgi
# the .ini file configures uwsgi and tells it where to find the `.wsgi` file
COPY uwsgi.ini /etc/loris2/uwsgi.ini

# this is what uwsgi will use to init loris.
# overwrites the one generated during `setup.py`
COPY loris2.wsgi /var/www/loris2/loris2.wsgi
# referenced in loris2.wsgi
COPY loris2.conf etc/loris2.conf

# avoid setup.py in loris 3.0
RUN pip install -r requirements.txt

# new step for 3.0 that was previously part of setup.py
RUN PYTHONPATH=/opt/loris/ python3 ./bin/setup_directories.py

RUN chown www-data:www-data -R .

# heartbeat
COPY healthcheck.sh .
Expand Down
4 changes: 2 additions & 2 deletions loris2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
[loris.Loris]
tmp_dp = '/tmp/loris2/tmp' # r--
www_dp = '/var/www/loris2' # r-x
run_as_user = 'loris'
run_as_group = 'loris'
run_as_user = 'www-data'
run_as_group = 'www-data'
enable_caching = True
redirect_canonical_image_request = False
redirect_id_slash_to_info = True
Expand Down
2 changes: 1 addition & 1 deletion loris2.wsgi
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from loris.webapp import create_app

application = create_app(config_file_path='/etc/loris2/loris2.conf', debug=False)
application = create_app(config_file_path='/opt/loris/etc/loris2.conf', debug=False)
9 changes: 4 additions & 5 deletions uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ pythonpath=/opt/loris/
uid=www-data
gid=www-data

# 'cheap' mode won't spawn workers until first request
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html?highlight=cheap#uwsgi-options
#cheap=True

# "automatically rewrite SCRIPT_NAME and PATH_INFO"
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html?highlight=cheap#manage-script-name
manage-script-name=True
Expand All @@ -24,7 +20,10 @@ vacuum=True
max-requests=10000

wsgi-file=/var/www/loris2/loris2.wsgi
socket = :5004
# when using nginx as proxy with loris upstream
#socket=:5004
# when developing or testing or when performance/security isn't an issue
http-socket=:5004

# New Relic requirements
enable-threads=True
Expand Down

0 comments on commit 984cb31

Please sign in to comment.