Verified Commit ff0237a1 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

merge from 5.x

parents d7e5f5d4 b95e4ccb
......@@ -2,8 +2,13 @@ variables:
DOCKER_TLS_CERTDIR: ""
stages:
- test
- publish
include:
- project: 'memoriav/memobase-2020/utilities/ci-templates'
file: 'helm-chart/helm-chart.yml'
.build-image:
stage: publish
image:
......@@ -13,6 +18,10 @@ stages:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/$DOCKERFILE --destination $IMAGE_TAG --build-arg BUILD_WITH="$BUILD_WITH"
retry:
max: 2
when:
- script_failure
build-latest:
extends: .build-image
......
variables:
DOCKER_TLS_CERTDIR: ""
stages:
- test
- publish
include:
- project: 'memoriav/memobase-2020/utilities/ci-templates'
file: 'helm-chart/helm-chart.yml'
.build-image:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/$DOCKERFILE --destination $IMAGE_TAG --build-arg BUILD_WITH="$BUILD_WITH"
<<<<<<< HEAD
=======
retry:
max: 2
when:
- script_failure
>>>>>>> 5.x
build-latest:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu graphicsmagick ffmpeg"
only:
- master
build-latest-vanilla:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-vanilla"
DOCKERFILE: "Dockerfile"
BUILD_WITH: ""
only:
- master
build-latest-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-jp2"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu"
only:
- master
build-latest-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-jp2-free"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpeg"
only:
- master
build-latest-video:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-video"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "ffmpeg"
only:
- master
build-latest-images:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-images"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick"
only:
- master
build-latest-images-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-images-jp2"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick kakadu"
only:
- master
build-latest-images-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-images-jp2-free"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick openjpeg"
only:
- master
build-latest-all:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-all"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu graphicsmagick ffmpeg"
only:
- master
build-latest-all-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:latest-all-free"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpeg graphicsmagick ffmpeg"
only:
- master
build-version:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu graphicsmagick ffmpeg"
except:
- master
- tags
build-version-vanilla:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-vanilla"
DOCKERFILE: "Dockerfile"
BUILD_WITH: ""
except:
- master
- tags
build-version-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-jp2"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu"
except:
- master
- tags
build-version-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-jp2-free"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpeg"
except:
- master
- tags
build-version-video:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-video"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "ffmpeg"
except:
- master
- tags
build-version-images:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-images"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick"
except:
- master
- tags
build-version-images-jp2:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-images-jp2"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick kakadu"
except:
- master
- tags
build-version-images-jp2-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-images-jp2-free"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "graphicsmagick openjpeg"
except:
- master
- tags
build-version-all:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-all"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "kakadu graphicsmagick ffmpeg"
except:
- master
- tags
build-version-all-free:
extends: .build-image
variables:
IMAGE_TAG: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME-all-free"
DOCKERFILE: "Dockerfile"
BUILD_WITH: "openjpeg graphicsmagick ffmpeg"
except:
- master
- tags
FROM maven:3-openjdk-11-slim AS build
ARG VERSION=5.0-SNAPSHOT
FROM debian:buster-slim AS build
# Change the VERSION envvar according to the cantaloupe version. Don't forget to change the argument in the ENTRYPOINT command below as well
ARG VERSION=5.0.3
ARG BUILD_WITH=""
WORKDIR /build
WORKDIR /
RUN apt-get -qq update && \
apt-get -qq install git && \
apt-get -qq install wget unzip && \
apt-get clean
RUN git clone https://github.com/cantaloupe-project/cantaloupe.git && \
cd cantaloupe && \
sed -i -e 's/\(<repositories>\)/\1\n<repository><id>geomatys-nexus<\/id><url>https:\/\/nexus.geomatys.com\/repository\/geotoolkit<\/url><\/repository>/' pom.xml && \
RUN wget -q https://github.com/cantaloupe-project/cantaloupe/releases/download/v${VERSION}/cantaloupe-${VERSION}.zip -O temp.zip && \
unzip temp.zip && \
mv cantaloupe-${VERSION} cantaloupe && \
mkdir /kakadu && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"kakadu"*}" ]; then mv dist/deps/Linux-x86-64/lib/* /kakadu; fi && \
mvn clean package -DskipTests
WORKDIR /cantaloupe
ADD ./cantaloupe.properties cantaloupe.properties
RUN mv /build/cantaloupe/target/cantaloupe-$VERSION.war .
if [ "$BUILD_WITH" != "${BUILD_WITH%"kakadu"*}" ]; then mv cantaloupe/deps/Linux-x86-64/lib/* /kakadu; fi && \
rm -r cantaloupe/deps && \
rm cantaloupe/cantaloupe.properties.sample
ADD ./cantaloupe.properties /cantaloupe/cantaloupe.properties
FROM openjdk:11-jre-slim
ENTRYPOINT ["/home/cantaloupe/run.sh", "5.0-SNAPSHOT"]
CMD ["-Dcantaloupe.config=/home/cantaloupe/app/cantaloupe.properties", "-Xmx2g"]
FROM openjdk:16-slim-buster
# Change the version argument according to the cantaloupe version
ENTRYPOINT ["/home/cantaloupe/run.sh", "5.0.3"]
CMD ["-Dcantaloupe.config=/home/cantaloupe/app/cantaloupe.properties", "-Xmx4g", "-Xms800m"]
ARG HTTP_PORT=8182
ARG BUILD_WITH=""
HEALTHCHECK --start-period=30s CMD curl -sf 0.0.0.0:${HTTP_PORT} -o /dev/null || exit 1
RUN useradd cantaloupe && mkdir -p /home/cantaloupe/.cache/cantaloupe && chown -R cantaloupe: /home/cantaloupe/.cache
COPY --chown=cantaloupe --from=build /cantaloupe/ /home/cantaloupe/app/
COPY --from=build /kakadu /usr/lib/
ADD --chown=cantaloupe ./run.sh /home/cantaloupe/
ADD --chown=cantaloupe ./run.sh /home/cantaloupe/run.sh
ADD --chown=cantaloupe ./delegates.rb /home/cantaloupe/app/delegates.rb
RUN apt-get -qq update && \
apt-get -qq install curl fontconfig libfreetype6 && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"ffmpeg"*}" ]; then apt-get -qq install --no-install-recommends ffmpeg; fi && \
......
<<<<<<< HEAD
FROM maven:3-openjdk-11-slim AS build
ARG VERSION=5.0-SNAPSHOT
=======
FROM debian:buster-slim AS build
# Change the VERSION envvar according to the cantaloupe version. Don't forget to change the argument in the ENTRYPOINT command below as well
ARG VERSION=5.0.3
>>>>>>> 5.x
ARG BUILD_WITH=""
WORKDIR /build
RUN apt-get -qq update && \
apt-get -qq install git && \
apt-get clean
RUN git clone https://github.com/cantaloupe-project/cantaloupe.git && \
cd cantaloupe && \
sed -i -e 's/\(<repositories>\)/\1\n<repository><id>geomatys-nexus<\/id><url>https:\/\/nexus.geomatys.com\/repository\/geotoolkit<\/url><\/repository>/' pom.xml && \
mkdir /kakadu && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"kakadu"*}" ]; then mv dist/deps/Linux-x86-64/lib/* /kakadu; fi && \
mvn clean package -DskipTests
WORKDIR /cantaloupe
ADD ./cantaloupe.properties cantaloupe.properties
RUN mv /build/cantaloupe/target/cantaloupe-$VERSION.war .
<<<<<<< HEAD
FROM openjdk:11-jre-slim
ENTRYPOINT ["/home/cantaloupe/run.sh", "5.0-SNAPSHOT"]
CMD ["-Dcantaloupe.config=/home/cantaloupe/app/cantaloupe.properties", "-Xmx2g"]
=======
FROM openjdk:16-slim-buster
# Change the version argument according to the cantaloupe version
ENTRYPOINT ["/home/cantaloupe/run.sh", "5.0.3"]
CMD ["-Dcantaloupe.config=/home/cantaloupe/app/cantaloupe.properties", "-Xmx4g", "-Xms800m"]
>>>>>>> 5.x
ARG HTTP_PORT=8182
ARG BUILD_WITH=""
HEALTHCHECK --start-period=30s CMD curl -sf 0.0.0.0:${HTTP_PORT} -o /dev/null || exit 1
RUN useradd cantaloupe && mkdir -p /home/cantaloupe/.cache/cantaloupe && chown -R cantaloupe: /home/cantaloupe/.cache
COPY --chown=cantaloupe --from=build /cantaloupe/ /home/cantaloupe/app/
COPY --from=build /kakadu /usr/lib/
<<<<<<< HEAD
ADD --chown=cantaloupe ./run.sh /home/cantaloupe/
=======
ADD --chown=cantaloupe ./run.sh /home/cantaloupe/run.sh
ADD --chown=cantaloupe ./delegates.rb /home/cantaloupe/app/delegates.rb
>>>>>>> 5.x
RUN apt-get -qq update && \
apt-get -qq install curl fontconfig libfreetype6 && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"ffmpeg"*}" ]; then apt-get -qq install --no-install-recommends ffmpeg; fi && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"graphicsmagick"*}" ]; then apt-get -qq install --no-install-recommends graphicsmagick; fi && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"imagemagick"*}" ]; then apt-get -qq install --no-install-recommends imagemagick; fi && \
if [ "$BUILD_WITH" != "${BUILD_WITH%"openjpeg"*}" ]; then apt-get -qq install libopenjp2-tools; fi && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER cantaloupe
WORKDIR /home/cantaloupe
VOLUME ["/home/cantaloupe/images"]
......@@ -15,11 +15,12 @@ keep your media files.
## Version management
This repository will eventually comprise Dockerfiles for different releases of
This repository will eventually comprise Dockerfiles for different
master versions of
the application. In order to build an image out of a specific version, use the
respective branch (e.g. `4.1.5`). The Docker image tags correspond to the
branch names / version numbers, so in order to use the 4.1.5-version of the
application, pull the image with tag `4.1.5`. The `latest` tag is identical to
respective branch (e.g. `4.x`). The Docker image tags correspond to the
branch names / version numbers, so in order to use the 4.x-version of the
application, pull the image with tag `4.x`. The `latest` tag is identical to
the last development version, which means reflecting the `develop` branch of
the Cantaloupe [repository](https://github.com/cantaloupe-project/cantaloupe/)
as well as of this repository. This latest version in insofar special because
......@@ -60,7 +61,7 @@ Notice that some changes can affect the overall working of the container
providing the argument
`-v<path_to_your_config>:/home/cantaloupe/app/cantaloupe.properties`
3. Selectively override properties by setting appropriate environment
variables on container startup (`-e<key>:<value>). The key translate to
variables on container startup (`-e<key>:<value>). The key translates to
uppercase letters, `.` being replaced by `_` (e.g. `https.key_store_path` ->
`HTTPS_KEY_STORE_PATH`).
......@@ -101,5 +102,5 @@ docker run -d --name cantaloupe \
-eCACHE_SERVER_DERIVATIVE=RedisCache \
-eREDISCACHE_HOST=redis \
-v<path_to_host_image_folder>:/home/cantaloupe/images \
cantaloupe:4.1.5
cantaloupe:4.x
```
......@@ -46,7 +46,7 @@ base_uri =
# you can define an alternate character or character sequence to substitute
# for a slash. Supply the non-percent-encoded version here, and use the
# percent-encoded version in URLs.
slash_substitute =
# slash_substitute = $
# Maximum number of pixels to return in a response, to prevent overloading
# the server. Requests for more pixels than this will receive an error
......@@ -56,7 +56,7 @@ max_pixels = 100000000
# Maximum scale to allow (1.0 = full scale; 0 = no maximum).
max_scale = 1.0
print_stack_trace_on_error_pages = true
print_stack_trace_on_error_pages = false
###########################################################################
# DELEGATE SCRIPT
......@@ -64,7 +64,7 @@ print_stack_trace_on_error_pages = true
# Enables the delegate script: a Ruby script containing various delegate
# methods. (See the user manual.)
delegate_script.enabled = false
delegate_script.enabled = true
# !! This can be an absolute path, or a filename; if only a filename is
# specified, it will be searched for in the same folder as this file, and
......@@ -73,7 +73,7 @@ delegate_script.pathname = delegates.rb
# Enables the invocation cache, which caches method invocations and return
# values in memory. See the user manual for more information.
delegate_script.cache.enabled = false
delegate_script.cache.enabled = true
###########################################################################
# ENDPOINTS
......@@ -119,11 +119,11 @@ endpoint.api.secret =
# Uses one source for all requests. Available values are `FilesystemSource`,
# `HttpSource`, `JdbcSource`, `S3Source`, and `AzureStorageSource`.
source.static = FilesystemSource
# source.static = HttpSource
# If true, `source.static` will be overridden, and the `source()` delegate
# method will be used to select a source per-request.
source.delegate = false
source.delegate = true
#----------------------------------------
# FilesystemSource
......@@ -132,11 +132,11 @@ source.delegate = false
# How to look up files. Allowed values are `BasicLookupStrategy` and
# `ScriptLookupStrategy`. ScriptLookupStrategy uses the delegate script for
# dynamic lookups; see the user manual.
FilesystemSource.lookup_strategy = BasicLookupStrategy
FilesystemSource.lookup_strategy = ScriptLookupStrategy
# Server-side path that will be prefixed to the identifier in the URL.
# Trailing slash is important!
FilesystemSource.BasicLookupStrategy.path_prefix = /home/cantaloupe/images/
FilesystemSource.BasicLookupStrategy.path_prefix =
# Server-side path or extension that will be suffixed to the identifier in
# the URL.
......@@ -147,7 +147,7 @@ FilesystemSource.BasicLookupStrategy.path_suffix =
#----------------------------------------
# Trusts insecure certificates and cipher suites.
HttpSource.allow_insecure = false
HttpSource.allow_insecure = true
# Request timeout in seconds.
HttpSource.request_timeout =
......@@ -155,11 +155,11 @@ HttpSource.request_timeout =
# Tells HttpSource how to look up resources. Allowed values are
# `BasicLookupStrategy` and `ScriptLookupStrategy`. ScriptLookupStrategy
# uses a delegate method for dynamic lookups; see the user manual.
HttpSource.lookup_strategy = BasicLookupStrategy
HttpSource.lookup_strategy = ScriptLookupStrategy
# URL that will be prefixed to the identifier in the request URL.
# Trailing slash is important!
HttpSource.BasicLookupStrategy.url_prefix = http://localhost/images/
HttpSource.BasicLookupStrategy.url_prefix =
# Path, extension, query string, etc. that will be suffixed to the
# identifier in the request URL.
......@@ -466,11 +466,11 @@ cache.server.source = FilesystemCache
cache.server.source.ttl_seconds = 2592000
# Enables the derivative (processed image) cache.
cache.server.derivative.enabled = false
cache.server.derivative.enabled = true
# Available values are `FilesystemCache`, `JdbcCache`, `RedisCache`,
# `HeapCache`, `S3Cache`, and `AzureStorageCache`.
cache.server.derivative =
cache.server.derivative = HeapCache
# Amount of time derivative cache content remains valid. Set to blank or 0
# for forever.
......@@ -478,7 +478,7 @@ cache.server.derivative.ttl_seconds = 2592000
# Whether to use the Java heap as a "level 1" cache for image infos, either
# independently or in front of a "level 2" derivative cache (if enabled).
cache.server.info.enabled = true
cache.server.info.enabled = false
# If true, when a source reports that the requested source image has gone
# missing, all cached information relating to it (if any) will be deleted.
......@@ -523,7 +523,7 @@ FilesystemCache.dir.name_length = 2
# Target cache size, in bytes or a number ending in M, MB, G, GB, etc.
# This is not a hard limit, and may be transiently exceeded.
# Ensure your heap can accommodate this size.
HeapCache.target_size = 2G
HeapCache.target_size = 3G
# If true, the cache contents will be written to a file on exit and during
# cache worker shifts, and read back in at startup.
......@@ -597,8 +597,8 @@ AzureStorageCache.object_key_prefix =
#----------------------------------------
# !! Redis connection info.
RedisCache.host = localhost
RedisCache.port = 6379
RedisCache.host =
RedisCache.port =
RedisCache.ssl = false
RedisCache.password =
RedisCache.database = 0
......
class CustomDelegate
attr_accessor :context
def deserialize_meta_identifier(meta_identifier)
end
def pre_authorize(options = {})
true
end
def authorize(options = {})
true
end
def extra_iiif2_information_response_keys(options = {})
{}
end
def extra_iiif3_information_response_keys(options = {})
{}
end
def azurestoragesource_blob_key(options = {})
end
def httpsource_resource_info(option = {})
return context['identifier'].gsub('$','/').gsub('"', '%22')
end
def jdbcsource_database_identifier(options = {})
end
def jdbcsource_media_type(options = {})
end
def jdbcsource_lookup_sql(options = {})
end
def s3source_object_info(options = {})
end
def overlay(options = {})
end
def redactions(options = {})
[]
end
def metadata(options = {})
end
def source(options = {})
uri = context['identifier']
if uri.start_with?("http")
return 'HttpSource'
else
return 'FilesystemSource'
end
end
def filesystemsource_pathname(options = {})
filename = context['identifier']
if filename.start_with?("file:")
filename = filename.split("$").last
end
return "/home/cantaloupe/images/#{filename}"
end
end
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
\ No newline at end of file
apiVersion: v2
name: image-server
description: A helm chart for the Cantaloupe Image Server
type: application
version: 0.0.0
appVersion: 0.0.0
maintainers:
- name: Sebastian Schüpbach
email: sebastian.schuepbach@unibas.ch
tag: "5.x-images"
k8sEnvironment: prod
k8sReplicas: 2
k8sRequestsCpu: "0.5"
k8sRequestsMemory: "1Gi"
k8sLimitsCpu: "2"
k8sLimitsMemory: "4Gi"
k8sPort: 8182
mediaVolumeClaimName: "media-volume-claim"
mediaFolderRootPath: "/home/cantaloupe/images"
cacheServerDerivativeEnabled: "true"
cacheServerDerivative: FilesystemCache
cacheServerDerivativeTtlSeconds: "172800"
cacheServerInfoEnabled: "false"
cacheServerPurgeMissing: "false"
cacheServerResolveFirst: "false"
tag: "5.x-images"
k8sEnvironment: stage
k8sReplicas: 1
k8sRequestsCpu: "0.5"
k8sRequestsMemory: "1Gi"
k8sLimitsCpu: "1.5"