├── setup ├── ci │ ├── .dockerignore │ ├── canvasindexer │ │ └── index.db │ ├── gunicorn_config.py │ ├── config.ini │ └── Dockerfile ├── cp │ └── .dockerignore ├── jk │ ├── .dockerignore │ ├── jsonkeeper │ │ └── keep.db │ ├── gunicorn_config.py │ ├── config.ini │ └── Dockerfile ├── ce │ └── .dockerignore ├── cf │ └── .dockerignore ├── cm │ └── .dockerignore ├── cv │ └── .dockerignore └── loris │ ├── images │ └── test.jpg │ └── test_data │ └── test_manifest.json ├── start.sh ├── stop.sh ├── reset.sh ├── view_logs.sh ├── .gitignore ├── Frontend └── Dockerfile ├── docker-compose.yml.dist ├── setup.sh └── README.md /setup/ci/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | config.ini 4 | -------------------------------------------------------------------------------- /setup/cp/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | index.js 4 | index.html 5 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker-compose --project-name `cat ./proj_name` start 4 | -------------------------------------------------------------------------------- /stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker-compose --project-name `cat ./proj_name` stop 4 | -------------------------------------------------------------------------------- /reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker container prune -f --filter=label=`cat ./proj_name` 4 | -------------------------------------------------------------------------------- /setup/jk/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | config.ini 4 | firebase-adminsdk.json 5 | -------------------------------------------------------------------------------- /setup/ce/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | authFirebase.js 4 | index.js 5 | index.html 6 | -------------------------------------------------------------------------------- /setup/cf/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | authFirebase.js 4 | index.js 5 | index.html 6 | -------------------------------------------------------------------------------- /setup/cm/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | authFirebase.js 4 | index.js 5 | index.html 6 | -------------------------------------------------------------------------------- /setup/cv/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | authFirebase.js 4 | index.js 5 | index.html 6 | -------------------------------------------------------------------------------- /view_logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker-compose --project-name `cat ./proj_name` logs -f -t 4 | -------------------------------------------------------------------------------- /setup/jk/jsonkeeper/keep.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IllDepence/iiif-curation-platform-docker/HEAD/setup/jk/jsonkeeper/keep.db -------------------------------------------------------------------------------- /setup/loris/images/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IllDepence/iiif-curation-platform-docker/HEAD/setup/loris/images/test.jpg -------------------------------------------------------------------------------- /setup/ci/canvasindexer/index.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IllDepence/iiif-curation-platform-docker/HEAD/setup/ci/canvasindexer/index.db -------------------------------------------------------------------------------- /setup/jk/gunicorn_config.py: -------------------------------------------------------------------------------- 1 | bind = "0.0.0.0:8000" 2 | 3 | pidfile = "/tmp/gunicorn.pid" 4 | 5 | accesslog = "-" 6 | errorlog = "-" 7 | 8 | timeout = 60 9 | -------------------------------------------------------------------------------- /setup/ci/gunicorn_config.py: -------------------------------------------------------------------------------- 1 | bind = "0.0.0.0:8000" 2 | 3 | pidfile = "/tmp/gunicorn.pid" 4 | 5 | accesslog = "-" 6 | errorlog = "-" 7 | 8 | timeout = 180 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | Canvas-Indexer 3 | JSONkeeper 4 | Frontend/IIIFCurationViewer 5 | Frontend/IIIFCurationFinder 6 | Frontend/IIIFCurationManager 7 | Frontend/IIIFCurationEditor 8 | Frontend/IIIFCurationPlayer 9 | setup/jk/firebase-adminsdk.json 10 | setup/cv/authFirebase.js 11 | setup/cf/authFirebase.js 12 | setup/cm/authFirebase.js 13 | setup/ce/authFirebase.js 14 | docker-compose.yml 15 | proj_name 16 | -------------------------------------------------------------------------------- /setup/ci/config.ini: -------------------------------------------------------------------------------- 1 | [shared] 2 | db_uri = sqlite:////tmp/index.db 3 | [crawler] 4 | as_sources = http://127.0.0.1:8001/as/collection.json 5 | interval = -1 6 | log_file = /dev/stdout 7 | allow_orphan_canvases = false 8 | [api] 9 | facet_label_sort_top = テーマ,性別,向き,制作年,所蔵,原典,原典ID 10 | facet_label_sort_bottom = tag 11 | facet_value_sort_frequency = テーマ,性別,身分,向き,所蔵,原典 12 | facet_value_sort_alphanum = 制作年,原典ID 13 | [facet_value_sort_custom_1] 14 | label = チョコレート 15 | sort_top = たけのこ,他 16 | sort_bottom = きのこ 17 | [facet_value_sort_custom_ほげ] 18 | label = foo 19 | sort_top = bar 20 | sort_bottom = baz,bam 21 | -------------------------------------------------------------------------------- /Frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.11-alpine 2 | MAINTAINER Tarek Saier 3 | 4 | RUN rm -rf /usr/share/nginx/html/* 5 | RUN mkdir /usr/share/nginx/html/finder 6 | RUN mkdir /usr/share/nginx/html/viewer 7 | RUN mkdir /usr/share/nginx/html/manager 8 | RUN mkdir /usr/share/nginx/html/editor 9 | RUN mkdir /usr/share/nginx/html/player 10 | COPY ./IIIFCurationFinder/ /usr/share/nginx/html/finder/ 11 | COPY ./IIIFCurationViewer/ /usr/share/nginx/html/viewer/ 12 | COPY ./IIIFCurationManager/ /usr/share/nginx/html/manager/ 13 | COPY ./IIIFCurationEditor/ /usr/share/nginx/html/editor/ 14 | COPY ./IIIFCurationPlayer/ /usr/share/nginx/html/player/ 15 | -------------------------------------------------------------------------------- /setup/jk/config.ini: -------------------------------------------------------------------------------- 1 | [environment] 2 | db_uri = sqlite:///keep.db 3 | server_url = http://127.0.0.1:8001 4 | log_file = /dev/stdout 5 | 6 | # OPTIONAL API modifications 7 | [api] 8 | # api_path = myapipath 9 | userdocs_added_properties = label 10 | garbage_collection_interval = 3600 11 | garbage_collection_age = 604800 12 | 13 | # OPTIONAL Firebase configuration: 14 | # [firebase] 15 | # service_account_key_file = firebase-adminsdk.json 16 | 17 | # OPTIONAL JSON-LD configuration: 18 | [json-ld] 19 | rewrite_types = http://codh.rois.ac.jp/iiif/curation/1#Curation, 20 | http://iiif.io/api/presentation/2#Range 21 | 22 | # OPTIONAL Activity Stream configuration 23 | [activity_stream] 24 | collection_endpoint = as/collection.json 25 | activity_generating_types = http://codh.rois.ac.jp/iiif/curation/1#Curation, 26 | http://iiif.io/api/presentation/2#Range 27 | -------------------------------------------------------------------------------- /setup/jk/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | MAINTAINER Tarek Saier 3 | 4 | ENV INSTALL_PATH /jsonkeeper 5 | RUN mkdir -p $INSTALL_PATH 6 | WORKDIR $INSTALL_PATH 7 | 8 | RUN apk add --no-cache gcc && \ 9 | apk add --no-cache build-base && \ 10 | apk add --no-cache python3 && \ 11 | apk add --no-cache python3-dev && \ 12 | apk add --no-cache py3-psycopg2 && \ 13 | python3 -m ensurepip && \ 14 | rm -r /usr/lib/python*/ensurepip && \ 15 | pip3 install --upgrade pip setuptools && \ 16 | if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ 17 | if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ 18 | rm -r /root/.cache 19 | 20 | COPY requirements.txt requirements.txt 21 | RUN pip install -r requirements.txt 22 | RUN pip install gunicorn 23 | 24 | COPY . . 25 | 26 | CMD gunicorn -c gunicorn_config.py 'jsonkeeper:create_app()' 27 | -------------------------------------------------------------------------------- /setup/ci/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | MAINTAINER Tarek Saier 3 | 4 | ENV INSTALL_PATH /canvasindexer 5 | RUN mkdir -p $INSTALL_PATH 6 | WORKDIR $INSTALL_PATH 7 | 8 | RUN apk add --no-cache gcc && \ 9 | apk add --no-cache build-base && \ 10 | apk add --no-cache python3 && \ 11 | apk add --no-cache python3-dev && \ 12 | apk add --no-cache py3-psycopg2 && \ 13 | python3 -m ensurepip && \ 14 | rm -r /usr/lib/python*/ensurepip && \ 15 | pip3 install --upgrade pip setuptools && \ 16 | if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \ 17 | if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ 18 | rm -r /root/.cache 19 | 20 | COPY requirements.txt requirements.txt 21 | RUN pip install -r requirements.txt 22 | RUN pip install gunicorn 23 | 24 | COPY . . 25 | 26 | CMD gunicorn -c gunicorn_config.py 'canvasindexer:create_app()' 27 | -------------------------------------------------------------------------------- /setup/loris/test_data/test_manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "@type" : "sc:Manifest", 3 | "@context" : "http://iiif.io/api/presentation/2/context.json", 4 | "@id" : "JSONkeeper's gonna change this", 5 | "label" : "outside NII", 6 | "description" : "picture taken outside NII", 7 | "attribution" : "Tarek Saier", 8 | "sequences" : [ { 9 | "@id" : "fd930f65-64da-422b-9133-08b080186449", 10 | "@type" : "sc:Sequence", 11 | "label" : "default sequence", 12 | "viewingHint" : "individuals", 13 | "canvases" : [ { 14 | "images" : [ { 15 | "resource" : { 16 | "@type" : "dctypes:Image", 17 | "service" : { 18 | "profile" : "http://iiif.io/api/image/2/level2.json", 19 | "@id" : "http://136.187.82.133/cp/image/test.jpg", 20 | "@context" : "http://iiif.io/api/image/2/context.json" 21 | }, 22 | "format" : "image/jpeg", 23 | "width" : 1000, 24 | "@id" : "http://136.187.82.133/cp/image/test.jpg/full/full/0/default.jpg", 25 | "label" : "outside NII", 26 | "height" : 563 27 | }, 28 | "@type" : "oa:Annotation", 29 | "motivation" : "sc:painting", 30 | "@id" : "http://136.187.82.133/cp/image/test.jpg", 31 | "on" : "f95f9279-d5c1-40c9-a53b-9ea72ae3aa88" 32 | } ], 33 | "@type" : "sc:Canvas", 34 | "width" : 1000, 35 | "@id" : "f95f9279-d5c1-40c9-a53b-9ea72ae3aa88", 36 | "label" : "outside NII", 37 | "height" : 563 38 | }] 39 | } ] 40 | } 41 | -------------------------------------------------------------------------------- /docker-compose.yml.dist: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | jsonkeeper: 5 | build: ./JSONkeeper 6 | labels: 7 | - 'curation_platform_strtport' 8 | ports: 9 | - 'jkport:8000' 10 | volumes: 11 | - ./JSONkeeper/jsonkeeper/keep.db:/jsonkeeper/jsonkeeper/keep.db 12 | - ./JSONkeeper/config.ini:/jsonkeeper/config.ini 13 | - ./JSONkeeper/gunicorn_config.py:/jsonkeeper/gunicorn_config.py 14 | - ./JSONkeeper/firebase-adminsdk.json:/jsonkeeper/firebase-adminsdk.json 15 | 16 | canvasindexer: 17 | build: ./Canvas-Indexer 18 | labels: 19 | - 'curation_platform_strtport' 20 | ports: 21 | - 'ciport:8000' 22 | volumes: 23 | - ./Canvas-Indexer/canvasindexer/index.db:/tmp/index.db 24 | - ./Canvas-Indexer/gunicorn_config.py:/canvasindexer/gunicorn_config.py 25 | - ./Canvas-Indexer/config.ini:/canvasindexer/config.ini 26 | 27 | frontend: 28 | build: ./Frontend 29 | labels: 30 | - 'curation_platform_strtport' 31 | ports: 32 | - 'feport:80' 33 | volumes: 34 | - ./Frontend/IIIFCurationFinder/authFirebase.js:/usr/share/nginx/html/finder/authFirebase.js 35 | - ./Frontend/IIIFCurationFinder/index.js:/usr/share/nginx/html/finder/index.js 36 | - ./Frontend/IIIFCurationFinder/index.html:/usr/share/nginx/html/finder/index.html 37 | - ./Frontend/IIIFCurationViewer/authFirebase.js:/usr/share/nginx/html/viewer/authFirebase.js 38 | - ./Frontend/IIIFCurationViewer/index.js:/usr/share/nginx/html/viewer/index.js 39 | - ./Frontend/IIIFCurationViewer/index.html:/usr/share/nginx/html/viewer/index.html 40 | - ./Frontend/IIIFCurationManager/authFirebase.js:/usr/share/nginx/html/manager/authFirebase.js 41 | - ./Frontend/IIIFCurationManager/index.js:/usr/share/nginx/html/manager/index.js 42 | - ./Frontend/IIIFCurationManager/index.html:/usr/share/nginx/html/manager/index.html 43 | - ./Frontend/IIIFCurationEditor/authFirebase.js:/usr/share/nginx/html/editor/authFirebase.js 44 | - ./Frontend/IIIFCurationEditor/index.js:/usr/share/nginx/html/editor/index.js 45 | - ./Frontend/IIIFCurationEditor/index.html:/usr/share/nginx/html/editor/index.html 46 | - ./Frontend/IIIFCurationPlayer/index.js:/usr/share/nginx/html/player/index.js 47 | - ./Frontend/IIIFCurationPlayer/index.html:/usr/share/nginx/html/player/index.html 48 | 49 | # # uncomment below block to include a loris image server into the docker-compose 50 | # # setup 51 | # loris: 52 | # image: 'lorisimageserver/loris' 53 | # labels: 54 | # - 'curation_platform_strtport' 55 | # ports: 56 | # - 'lport:5004' 57 | # volumes: 58 | # - ./setup/loris/images:/opt/loris/tests/img 59 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Configurate the external URL (without trailing slash) and start port number here 4 | externalurl=http://192.168.0.158/cp 5 | 6 | start_port=9001 7 | 8 | jk_git_url="https://github.com/IllDepence/JSONkeeper.git" 9 | ci_git_url="https://github.com/IllDepence/Canvas-Indexer.git" 10 | cv_zip_url="http://codh.rois.ac.jp/software/download/IIIFCurationViewer_latest.zip" 11 | cf_zip_url="http://codh.rois.ac.jp/software/download/IIIFCurationFinder_latest.zip" 12 | cm_zip_url="http://codh.rois.ac.jp/software/download/IIIFCurationManager_latest.zip" 13 | ce_zip_url="http://codh.rois.ac.jp/software/download/IIIFCurationEditor_latest.zip" 14 | cp_zip_url="http://codh.rois.ac.jp/software/download/IIIFCurationPlayer_latest.zip" 15 | 16 | # NOTE: services are expected to be accessible at 17 | # - JSONkeeper: /curation/ 18 | # - Canvas Indexer: /index/ 19 | # - Curation Viewer: /viewer/ 20 | # - Curation Finder: /finder/ 21 | # - Curation Manager: /manager/ 22 | # - Curation Editor: /editor/ 23 | # - Curation Player: /player/ 24 | # - Loris: /image/ 25 | # from outside (web/intranet/...) 26 | # and will be exposed by docker at 27 | # - JSONkeeper: http://127.0.0.1: 28 | # - Canvas Indexer: http://127.0.0.1: 29 | # - Curation Viewer: http://127.0.0.1:/viewer 30 | # - Curation Finder: http://127.0.0.1:/finder 31 | # - Curation Manager: http://127.0.0.1:/manager 32 | # - Curation Editor: http://127.0.0.1:/editor 33 | # - Curation Player: http://127.0.0.1:/player 34 | # - Loris: http://127.0.0.1: 35 | # see README.md for a proxy configuration examples 36 | 37 | exturlesc="${externalurl//\//\\/}" 38 | 39 | # - - - - - Jk and CI - - - - - 40 | rm -rf JSONkeeper 41 | rm -rf Canvas-Indexer 42 | git clone $jk_git_url 43 | git clone $ci_git_url 44 | cp -rv setup/jk/.dockerignore setup/jk/* JSONkeeper 45 | cp -rv setup/ci/.dockerignore setup/ci/* Canvas-Indexer 46 | sed -i -E "s/server_url =.+/server_url = $exturlesc\/curation/" JSONkeeper/config.ini 47 | sed -i -E "s/as_sources =.+/as_sources = $exturlesc\/curation\/as\/collection.json/" Canvas-Indexer/config.ini 48 | 49 | # check if a custom api path for JSONkeeper was defined 50 | sharp='#' 51 | api_line=`cat setup/jk/config.ini | grep api_path | head -n 1` 52 | if [ -z "${api_line##*$sharp*}" ]; then 53 | # default path 54 | jk_api_path='api' 55 | else 56 | # clean and save custom path 57 | tmp_line=`echo $api_line | sed 's/.*api_path\s*=\s*//g'` 58 | jk_api_path=`echo $tmp_line | sed 's/\s*$//g'` 59 | fi 60 | 61 | # - - - - - CV and CF - - - - - 62 | rm -rf Frontend/IIIFCurationViewer 63 | rm -rf Frontend/IIIFCurationFinder 64 | 65 | curl $cv_zip_url -o cv_tmp.zip 66 | mkdir cv_tmp_folder 67 | unzip -q -d cv_tmp_folder cv_tmp.zip 68 | rm cv_tmp.zip 69 | cvunzipped=`ls cv_tmp_folder` 70 | mv -v "cv_tmp_folder/${cvunzipped}" IIIFCurationViewer 71 | rmdir cv_tmp_folder 72 | 73 | curl $cf_zip_url -o cf_tmp.zip 74 | mkdir cf_tmp_folder 75 | unzip -q -d cf_tmp_folder cf_tmp.zip 76 | rm cf_tmp.zip 77 | cfunzipped=`ls cf_tmp_folder` 78 | mv -v "cf_tmp_folder/${cfunzipped}" IIIFCurationFinder 79 | rmdir cf_tmp_folder 80 | 81 | cp -v setup/cv/.dockerignore setup/cv/* IIIFCurationViewer 82 | cp -v setup/cf/.dockerignore setup/cf/* IIIFCurationFinder 83 | 84 | sed -i -E "s/curationJsonExportUrl: '.+'/curationJsonExportUrl: '$exturlesc\/curation\/$jk_api_path'/" IIIFCurationViewer/index.js 85 | sed -i -E "s/curationJsonExportUrl: '.+'/curationJsonExportUrl: '$exturlesc\/curation\/$jk_api_path'/" IIIFCurationFinder/index.js 86 | sed -i -E "s/curationViewerUrl: '.+'/curationViewerUrl: '$exturlesc\/viewer\/'/" IIIFCurationFinder/index.js 87 | sed -i -E "s/searchEndpointUrl: '.+'/searchEndpointUrl: '$exturlesc\/index\/api'/" IIIFCurationFinder/index.js 88 | sed -i -E "s/facetsEndpointUrl: '.+'/facetsEndpointUrl: '$exturlesc\/index\/facets'/" IIIFCurationFinder/index.js 89 | sed -i -E "s/redirectUrl: '.+'/redirectUrl: '$exturlesc\/viewer\/'/" IIIFCurationFinder/exportJsonKeeper.js 90 | 91 | mv IIIFCurationViewer Frontend/ 92 | mv IIIFCurationFinder Frontend/ 93 | 94 | # - - - - - CM and CE - - - - - 95 | rm -rf Frontend/IIIFCurationManager 96 | rm -rf Frontend/IIIFCurationEditor 97 | 98 | curl $cm_zip_url -o cm_tmp.zip 99 | mkdir cm_tmp_folder 100 | unzip -q -d cm_tmp_folder cm_tmp.zip 101 | rm cm_tmp.zip 102 | cmunzipped=`ls cm_tmp_folder` 103 | mv -v "cm_tmp_folder/${cmunzipped}" IIIFCurationManager 104 | rmdir cm_tmp_folder 105 | 106 | curl $ce_zip_url -o ce_tmp.zip 107 | mkdir ce_tmp_folder 108 | unzip -q -d ce_tmp_folder ce_tmp.zip 109 | rm ce_tmp.zip 110 | ceunzipped=`ls ce_tmp_folder` 111 | mv -v "ce_tmp_folder/${ceunzipped}" IIIFCurationEditor 112 | rmdir ce_tmp_folder 113 | 114 | cp -v setup/cm/.dockerignore setup/cm/* IIIFCurationManager 115 | cp -v setup/ce/.dockerignore setup/ce/* IIIFCurationEditor 116 | 117 | sed -i -E "s/curationJsonExportUrl: '.+'/curationJsonExportUrl: '$exturlesc\/curation\/$jk_api_path'/" IIIFCurationEditor/index.js 118 | sed -i -E "s/curationJsonExportUrl: '.+'/curationJsonExportUrl: '$exturlesc\/curation\/$jk_api_path'/" IIIFCurationManager/index.js 119 | sed -i -E "s/curationViewerUrl: '.+'/curationViewerUrl: '$exturlesc\/viewer\/'/" IIIFCurationManager/index.js 120 | sed -i -E "s/jsonKeeperEditorUrl: '.+'/jsonKeeperEditorUrl: '$exturlesc\/editor\/'/" IIIFCurationManager/index.js 121 | 122 | mv IIIFCurationManager Frontend/ 123 | mv IIIFCurationEditor Frontend/ 124 | 125 | # - - - - - CP - - - - - 126 | rm -rf Frontend/IIIFCurationPlayer 127 | 128 | curl $cp_zip_url -o cp_tmp.zip 129 | mkdir cp_tmp_folder 130 | unzip -q -d cp_tmp_folder cp_tmp.zip 131 | rm cp_tmp.zip 132 | cpunzipped=`ls cp_tmp_folder` 133 | mv -v "cp_tmp_folder/${cpunzipped}" IIIFCurationPlayer 134 | rmdir cp_tmp_folder 135 | 136 | cp -v setup/cp/.dockerignore IIIFCurationPlayer 137 | 138 | sed -i -E "s/curationJsonExportUrl: '.+'/curationJsonExportUrl: '$exturlesc\/curation\/$jk_api_path'/" IIIFCurationPlayer/index.js 139 | 140 | mv IIIFCurationPlayer Frontend/ 141 | 142 | # - - - - - Docker Compose - - - - - 143 | cp docker-compose.yml.dist docker-compose.yml 144 | sed -i -E "s/strtport/$start_port/" docker-compose.yml 145 | sed -i -E "s/jkport/$((start_port + 0))/" docker-compose.yml 146 | sed -i -E "s/ciport/$((start_port + 1))/" docker-compose.yml 147 | sed -i -E "s/feport/$((start_port + 2))/" docker-compose.yml 148 | sed -i -E "s/lport/$((start_port + 3))/" docker-compose.yml 149 | 150 | echo -n "curation_platform_$start_port" > proj_name 151 | 152 | ./reset.sh 153 | 154 | docker-compose --project-name `cat ./proj_name` up --build --no-start 155 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Docker setup for running all components of the [IIIF Curation Platform](http://codh.rois.ac.jp/iiif-curation-platform/) (ICP). 2 | 3 | # Overview 4 | 5 | This repository contains scripts and configuration files for setting up an ICP instance with Docker containers. 6 | To use the platform *within a local network*, it is sufficient to set the value of `externalurl` in the file `setup.sh` to your IP within the network and then execute `./setup.sh` followed by `./start.sh`. In order to host a remotely accessible instance you need to know how to configure proxy settings of a web server (see details below). 7 | Note that IIIF Curation Viewer, IIIF Curation Editor, IIIF Curation Player and JSONkeeper are usable out of the box. In order to make use of IIIF Curation Finder, IIIF Curation Manager and Canvas Indexer you have to configure Firebase authentication (see section *First use* below). 8 | 9 | ### Functionality 10 | 11 | The setup script `setup.sh` retrieves all of the ICP components and configures them so that they work together nicely and can be started with Docker. To do so it copies over files from the `setup` folder and then edits them in their respective destinations (folders `Frontent/IIIFCurationViewer`, `JSONkeeper`, etc.). This means that you can either make configuration changes in files in the `setup` folder and then run `setup.sh`, or you first run the script and then edit configuration files in `Frontend/IIIFCurationViewer`, `JSONkeeper`, ... (the latter is preferred). 12 | 13 | # Use 14 | 15 | ### First use 16 | 17 | * in setup.sh, set the value of `externalurl` and `start_port` 18 | * *if* [Firebase](https://firebase.google.com/) is to be used 19 | * place a [Firebase service account key file](https://firebase.google.com/docs/admin/setup#add_firebase_to_your_app) named `firebase-adminsdk.json` in `setup/jk/` 20 | * uncomment the `[firebase]` config section in `setup/jk/config.ini` 21 | * place a modified `authFirebase.js` in `setup/cv/`, `setup/cf/`, `setup/cm/` and `setup/ce/` 22 | **note**: each of abovementioned services needs a distinct `authFirebase.js` file (you can run `$ ./setup.sh` once, obtain them from the respective `Frontend/IIIFCuration*/` folder, edit the contents and then place each in it's respective `setup/c*/` folder) 23 | * add the host part of `externalurl` to the authorized domains in your Firebase console 24 | * `$ ./setup.sh` 25 | * `$ ./start.sh` 26 | 27 | ### General use 28 | 29 | * `$ ./start.sh`: start the ICP 30 | * `$ ./stop.sh`: stop the ICP 31 | * `$ ./view_logs.sh`: output ICP logs to the terminal 32 | * `$ ./setup.sh`: reset everything (application code, configuration, containers) 33 | * `$ ./reset.sh`: reset containers (i.e application storage, but not configuration) (does not work with older Docker versions; verified with version 17.12.1) 34 | * `$ docker restart `: make configuration changes take effect 35 | 36 | ### Proxy config examples 37 | 38 | Let's assume you want to serve the bundle on `/cp/...`, have therefore set `externalurl` in setup.sh to `/cp` (no trailing slash) and set the `start_port` to 8001. Proxy configurations then may look as follows: 39 | 40 | #### Apache 41 | 42 | # JSONkeeper 43 | ProxyPassMatch "^/cp/curation/(.*)" "http://127.0.0.1:8001/$1" 44 | ProxyPassReverse "^/cp/curation/(.*)" "http://127.0.0.1:8001/$1" 45 | # Canvas Indexer 46 | ProxyPassMatch "^/cp/index/(.*)" "http://127.0.0.1:8002/$1" 47 | ProxyPassReverse "^/cp/index/(.*)" "http://127.0.0.1:8002/$1" 48 | # IIIF Curation Viewer 49 | ProxyPassMatch "^/cp/viewer/(.*)" "http://127.0.0.1:8003/viewer/$1" 50 | ProxyPassReverse "^/cp/viewer/(.*)" "http://127.0.0.1:8003/viewer/$1" 51 | # IIIF Curation Finder 52 | ProxyPassMatch "^/cp/finder/(.*)" "http://127.0.0.1:8003/finder/$1" 53 | ProxyPassReverse "^/cp/finder/(.*)" "http://127.0.0.1:8003/finder/$1" 54 | # IIIF Curation Manager 55 | ProxyPassMatch "^/cp/manager/(.*)" "http://127.0.0.1:8003/manager/$1" 56 | ProxyPassReverse "^/cp/manager/(.*)" "http://127.0.0.1:8003/manager/$1" 57 | # IIIF Curation Editor 58 | ProxyPassMatch "^/cp/editor/(.*)" "http://127.0.0.1:8003/editor/$1" 59 | ProxyPassReverse "^/cp/editor/(.*)" "http://127.0.0.1:8003/editor/$1" 60 | # IIIF Curation Player 61 | ProxyPassMatch "^/cp/player/(.*)" "http://127.0.0.1:8003/player/$1" 62 | ProxyPassReverse "^/cp/player/(.*)" "http://127.0.0.1:8003/player/$1" 63 | # # Loris (deactivated by default) 64 | # ProxyPassMatch "^/cp/image/(.*)" "http://127.0.0.1:8004/$1" 65 | # ProxyPassReverse "^/cp/image/(.*)" "http://127.0.0.1:8004/$1" 66 | 67 | ##### Restricting access 68 | 69 | * run `docker network inspect curationplatform9001_default`[2] while the containers are running 70 | * note the value of `Subnet` (for the network, not a single container) 71 | * if not already existing, generate a htpasswd file (e.g.: `sudo htpasswd -c /etc/apache2/.htpasswd curt`) 72 | * configure Apache as shown below 73 | * replace `` with the value you got in the first step 74 | * replace `` with the path to your htpasswd file 75 | 76 | [2] the network name may differ. run `docker network ls` to see all networks. 77 | 78 | ‌ 79 | 80 | 81 | Authtype Basic 82 | Authname "Password Required" 83 | AuthUserFile 84 | Require valid-user 85 | Deny from all 86 | Allow from 87 | Satisfy any 88 | 89 | 90 | #### Nginx 91 | 92 | # JSONkeeper 93 | location /cp/curation/ { 94 | proxy_pass http://127.0.0.1:8001/; 95 | } 96 | # Canvas Indexer 97 | location /cp/index/ { 98 | proxy_pass http://127.0.0.1:8002/; 99 | } 100 | # IIIF Curation Viewer 101 | location /cp/viewer/ { 102 | proxy_pass http://127.0.0.1:8003/viewer/; 103 | } 104 | # IIIF Curation Finder 105 | location /cp/finder/ { 106 | proxy_pass http://127.0.0.1:8003/finder/; 107 | } 108 | # IIIF Curation Manager 109 | location /cp/manager/ { 110 | proxy_pass http://127.0.0.1:8003/manager/; 111 | } 112 | # IIIF Curation Editor 113 | location /cp/editor/ { 114 | proxy_pass http://127.0.0.1:8003/editor/; 115 | } 116 | # IIIF Curation Player 117 | location /cp/player/ { 118 | proxy_pass http://127.0.0.1:8003/player/; 119 | } 120 | # # Loris (deactivated by default) 121 | # location /cp/image/ { 122 | # proxy_pass http://127.0.0.1:8004/; 123 | # } 124 | 125 | # Component specific notes 126 | 127 | ### JSONkeeper & Canvas Indexer 128 | 129 | #### Database 130 | 131 | JSONkeeper and Canvas Indexer are configured to use a SQLite database by default. You can use other types of databases by just changing the configuration. The Docker containers are set up to support SQLite and PostgreSQL out of the box. If you use another type of database, you might need to add installation instructions for an additional Python database driver in the respective `Dockerfile` files (see [SQLAlchemy supported databases](http://docs.sqlalchemy.org/en/latest/core/engines.html#supported-databases)). 132 | --------------------------------------------------------------------------------