Skip to content

Commit 8a12c93

Browse files
committed
Merge branch 'release/4.0.0' into main
2 parents d083b98 + 0f3ff72 commit 8a12c93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2229
-1370
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ src/version/build.go:
2121
go generate rais/src/version
2222

2323
# Binary building rules
24-
binaries: src/transform/rotation.go src/version/build.go plugins
24+
binaries: src/transform/rotation.go src/version/build.go plugins rais-server jp2info
25+
26+
rais-server:
2527
go build -ldflags="-s -w" -o ./bin/rais-server rais/src/cmd/rais-server
28+
29+
jp2info:
2630
go build -ldflags="-s -w" -o ./bin/jp2info rais/src/cmd/jp2info
2731

2832
# Testing
@@ -49,6 +53,11 @@ clean:
4953
docker: | force-getbuild generate
5054
docker build --rm --target build -f $(MakefileDir)/docker/Dockerfile -t uolibraries/rais:build $(MakefileDir)
5155
docker build --rm -f $(MakefileDir)/docker/Dockerfile -t uolibraries/rais:latest-indev $(MakefileDir)
56+
make docker-alpine
57+
58+
# Build just the alpine image for cases where we want to get this updated / cranked out fast
59+
docker-alpine: | force-getbuild generate
60+
docker build --rm --target build -f $(MakefileDir)/docker/Dockerfile-alpine -t uolibraries/rais:build-alpine $(MakefileDir)
5261
docker build --rm -f $(MakefileDir)/docker/Dockerfile-alpine -t uolibraries/rais:latest-alpine $(MakefileDir)
5362

5463
# Build plugins on any change to their directory or their go files

README.md

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
Rodent-Assimilated Image Server
44
=======
55

6-
![Gocutus](gocutus.png?raw=true "Gocutus")
6+
![Gocutus, the RAIS mascot](gocutus.png?raw=true "Gocutus, the RAIS mascot")
77

88
RAIS was originally built by [eikeon](https://github.com/eikeon) as a 100% open
99
source, no-commercial-products-required, proof-of-concept tile server for JP2
1010
images within [chronam](https://github.com/LibraryOfCongress/chronam).
1111

1212
It has been updated to allow more command-line options, more source file
13-
formats, more features, conformance to the [IIIF](http://iiif.io/) spec, and
14-
experimental DeepZoom support.
13+
formats, more features, and conformance to the [IIIF](http://iiif.io/) spec.
1514

1615
RAIS is very efficient, completely free, and easy to set up and run. See our
1716
[wiki](https://github.com/uoregon-libraries/rais-image-server/wiki) pages for
@@ -20,16 +19,49 @@ more details and documentation.
2019
Configuration
2120
-----
2221

22+
### Main Configuration Settings
23+
2324
RAIS uses a configuration system that allows environment variables, a config
2425
file, and/or command-line flags. See [rais-example.toml](rais-example.toml)
2526
for an example of a configuration file. RAIS will use a configuration
2627
file if one exists at `/etc/rais.toml`.
2728

2829
The configuration file's values can be overridden by environment variables,
2930
while command-line flags will override both configuration files and
30-
environtmental variables. Configuration is best explained and understood by
31+
environmental variables. Configuration is best explained and understood by
3132
reading the example file above, which describes all the values in detail.
3233

34+
### Cloud Settings
35+
36+
Because connecting to a cloud provider is optional, often means using a
37+
container-based setup, and differs from one provider to the next, all RAIS
38+
cloud configuration is environment-only. This means it can't be specified on
39+
the command line or in `rais.toml`.
40+
41+
Currently RAIS can theoretically support S3, Azure, and Google Cloud backends,
42+
but only S3 has had much testing. To set up RAIS for S3, you would have to
43+
export the following environment variables (in addition to having an
44+
S3-compatible object store running):
45+
46+
- `AWS_ACCESS_KEY_ID`: Required
47+
- `AWS_SECRET_ACCESS_KEY`: Required
48+
- `AWS_REGION`: Required
49+
- `RAIS_S3_ENDPOINT`: optionally set for custom S3 backends; e.g., "minio:9000"
50+
- `RAIS_S3_DISABLESSL`: optionally set this to "true" for custom S3 backends
51+
which don't need SSL (for instance if they're running on the same server as
52+
RAIS)
53+
- `RAIS_S3_FORCEPATHSTYLE`: optionally set this to "true" to force path-style
54+
S3 calls. This is typically necessary for custom S3 backends like minio, but
55+
not for AWS.
56+
57+
Other backends have their own environment variables which have to be set in
58+
order to have RAIS connect to them.
59+
60+
For a full demo of a working custom S3 backend powered by minio, see `docker/s3demo`.
61+
62+
**Note** that external storage is going to be slower than serving images from
63+
local filesystems! Make sure you test carefully!
64+
3365
IIIF Features
3466
-----
3567

@@ -41,9 +73,8 @@ for an in-depth look at feature support.
4173
Caching
4274
-----
4375

44-
RAIS can internally cache the IIIF `info.json` requests, individual tile
45-
requests, and, if it's in use, S3 images to a locally configured location. See
46-
the [RAIS Caching](https://github.com/uoregon-libraries/rais-image-server/wiki/Caching)
76+
RAIS can internally cache the IIIF `info.json` requests and individual tile
77+
requests. See the [RAIS Caching](https://github.com/uoregon-libraries/rais-image-server/wiki/Caching)
4778
wiki page for details.
4879

4980
Generating tiled, multi-resolution JP2s
@@ -65,3 +96,10 @@ License
6596

6697
RAIS Image Server is in the public domain under a
6798
[CC0](http://creativecommons.org/publicdomain/zero/1.0/) license.
99+
100+
Contributors
101+
-----
102+
103+
Special thanks to Jessica Dussault (@jduss4) for providing the hand-drawn
104+
"Gocutus" logo, and Greg Tunink (@techgique) for various digital refinements to
105+
said logo.

docker-compose.override-example.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
# options through from the host's environment (or the local .env file)
2626
- RAIS_S3CACHE
2727
- RAIS_S3ZONE
28-
- RAIS_S3BUCKET
28+
- RAIS_S3ENDPOINT
2929
- AWS_ACCESS_KEY_ID
3030
- AWS_SECRET_ACCESS_KEY
3131
- AWS_SESSION_TOKEN

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ services:
1616
- RAIS_ADDRESS
1717
- RAIS_LOGLEVEL
1818
- RAIS_TILEPATH
19-
- RAIS_IIIFURL
19+
- RAIS_IIIFWEBPATH
20+
- RAIS_IIIFBASEURL
2021
- RAIS_INFOCACHELEN
2122
- RAIS_TILECACHELEN
2223
- RAIS_IMAGEMAXAREA
2324
- RAIS_IMAGEMAXWIDTH
2425
- RAIS_IMAGEMAXHEIGHT
25-
- RAIS_PLUGINS
26+
- RAIS_PLUGINS=*
27+
- RAIS_JPGQUALITY
2628
- RAIS_ALLOW_INSECURE_PLUGINS=0
2729
volumes:
2830
- ./docker/images:/var/local/images:ro

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# # Generate the build image to simplify local development
99
# docker build --rm -t uolibraries/rais:build --target build -f ./docker/Dockerfile .
10-
FROM fedora:30 AS build
10+
FROM fedora:32 AS build
1111
LABEL maintainer="Jeremy Echols <jechols@uoregon.edu>"
1212

1313
# Install all the build dependencies
@@ -30,7 +30,7 @@ RUN dnf install -y GraphicsMagick
3030

3131
# Go comes after other installs to avoid re-pulling the more expensive
3232
# dependencies when changing Go versions
33-
RUN curl -L https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz > /tmp/go.tgz
33+
RUN curl -L https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz > /tmp/go.tgz
3434
RUN cd /opt && tar -xzf /tmp/go.tgz
3535

3636
# "Install" Go

docker/Dockerfile-alpine

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,13 @@ FROM golang:1-alpine AS build
77
LABEL maintainer="Jeremy Echols <jechols@uoregon.edu>"
88

99
# Install all the build dependencies
10-
RUN apk add --no-cache openjpeg-dev
11-
RUN apk add --no-cache git
12-
RUN apk add --no-cache gcc
13-
RUN apk add --no-cache make
14-
RUN apk add --no-cache tar
15-
RUN apk add --no-cache curl
16-
17-
# Installing GraphicsMagick is wholly unnecessary, but helps when using the
18-
# build box for things like converting images. Since opj2_encode doesn't
19-
# support all formats, and ImageMagick has been iffy with some conversions for
20-
# us, "gm convert" is a handy fallback. As this is a multi-stage dockerfile,
21-
# this installation doesn't hurt the final production docker image.
22-
RUN apk add --no-cache graphicsmagick
10+
RUN apk add --no-cache openjpeg-dev git gcc make
2311

2412
# This is necessary for our openjp2 C bindings
2513
RUN apk add --no-cache musl-dev
2614

27-
# Make sure the build box can lint code
28-
RUN go get -u golang.org/x/lint/golint
15+
# This is just getting absurd, but results in a dramatically smaller rais-server
16+
RUN apk add --no-cache upx
2917

3018
# Add the go mod stuff first so we aren't re-downloading dependencies except
3119
# when they actually change
@@ -39,7 +27,9 @@ RUN go mod download
3927
ADD ./Makefile /opt/rais-src/Makefile
4028
ADD ./src /opt/rais-src/src
4129
ADD ./scripts /opt/rais-src/scripts
42-
RUN make
30+
RUN make rais-server
31+
32+
RUN upx ./bin/rais-server
4333

4434
# Production image just installs runtime deps and copies in the binaries
4535
FROM alpine:3.10 AS production

docker/demo-rais-entry.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
# demo-rais-entry.sh is the RAIS entrypoint script, which sets up the
44
# configuration and runs the rais server
55

66
# Copy the config and edit it in-place; this allows customizing most pieces of
77
# configuration for demoing
88
url=${URL:-}
9-
if [[ $url == "" ]]; then
9+
if test "$url" == ""; then
1010
echo "No URL provided; defaulting to 'http://localhost'"
1111
echo "If you can't see images, try an explicitly-set URL, e.g.:"
1212
echo
1313
echo " URL="http://192.168.0.5" docker-compose up"
1414
url="http://localhost"
1515
fi
1616

17-
cp /etc/rais-template.toml /tmp/rais.toml
18-
sed 's|^\s*IIIFURL.*$|IIIFURL = "'$url'/images/iiif"|' /tmp/rais.toml > /etc/rais.toml
1917
exec /opt/rais/rais-server

docker/demo-web-entry.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,8 @@ for file in $(find /var/local/images -name "*.jp2" -o -name "*.tiff" -o -name "*
1616
sources="$sources,"
1717
fi
1818

19-
sources="$sources\"/images/iiif/$relpath/info.json\""
19+
sources="$sources\"/iiif/$relpath/info.json\""
2020
done
2121
sed "s|%SRCS%|$sources|g" /usr/share/nginx/html/template.html > /usr/share/nginx/html/iiif.html
2222

23-
sources=""
24-
for file in $(find /var/local/images -name "*.jp2" -o -name "*.tiff" -o -name "*.jpg"); do
25-
relpath=${file##/var/local/images/}
26-
relpath=${relpath//\//%2F}
27-
if [[ $sources != "" ]]; then
28-
sources="$sources,"
29-
fi
30-
31-
sources="$sources\"/images/dzi/${relpath}.dzi\""
32-
done
33-
sed "s|%SRCS%|$sources|g" /usr/share/nginx/html/template.html > /usr/share/nginx/html/dzi.html
34-
3523
exec nginx -g "daemon off;"

docker/nginx.conf

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,21 @@ server {
22
listen 80;
33
server_name localhost;
44

5-
location /images/dzi {
5+
location /iiif/ {
66
proxy_set_header Host $host;
77
proxy_set_header X-Real-IP $remote_addr;
88
proxy_set_header X-Forwarded-For $remote_addr;
9-
proxy_set_header X-Forwarded-Host $remote_addr;
10-
proxy_pass http://rais:12415;
11-
}
12-
13-
location /images/iiif {
14-
proxy_set_header Host $host;
15-
proxy_set_header X-Real-IP $remote_addr;
16-
proxy_set_header X-Forwarded-For $remote_addr;
17-
proxy_set_header X-Forwarded-Host $remote_addr;
9+
proxy_set_header X-Forwarded-Host $host;
10+
proxy_set_header X-Forwarded-Proto $scheme;
1811
proxy_pass http://rais:12415;
1912
}
2013

2114
location /admin {
2215
proxy_set_header Host $host;
2316
proxy_set_header X-Real-IP $remote_addr;
2417
proxy_set_header X-Forwarded-For $remote_addr;
25-
proxy_set_header X-Forwarded-Host $remote_addr;
18+
proxy_set_header X-Forwarded-Host $host;
19+
proxy_set_header X-Forwarded-Proto $scheme;
2620
proxy_pass http://rais:12416;
2721
}
2822

docker/s3demo/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM golang:1.11 as build-env
1+
FROM golang:1 as build-env
22
RUN apt-get update
3+
RUN apt-get install -y upx-ucl
34
WORKDIR /s3demo
45
ADD s3demo/go.mod /s3demo/go.mod
56
ADD s3demo/go.sum /s3demo/go.sum
67
RUN go mod download
78
ADD ./s3demo/*.go /s3demo/
89
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o server
9-
RUN apt-get install -y upx-ucl
1010
RUN upx ./server
1111

1212
FROM alpine

0 commit comments

Comments
 (0)