diff --git a/.env.template b/.env.template index 120aad36df7f40771e3e3a117113d21e1c38971c..475f031ad80ba309d13a68c4e5f7b3dc37c5f1ce 100644 --- a/.env.template +++ b/.env.template @@ -1,5 +1,10 @@ -# docker-compose components replace by devserver.yml to run the dev server (default is prod) or append ':devserver.yml' to run both -COMPOSE_FILE=docker-compose.yml +# COMPOSE_FILE : +# + docker-compose.yml = production service, no port exposed +# + docker-compose.yml:dev.yml = production service + devserver, front services ports are exposed +# + docker-compose.yml:traefik.yml = production services + traefik mapping (see README) +COMPOSE_FILE=docker-compose.yml:dev.yml +#COMPOSE_FILE=docker-compose.yml +#COMPOSE_FILE=docker-compose.yml:traefik.yml # prod server host port PORT=8080 # prod container restart policy @@ -14,3 +19,5 @@ HTTP_FOLDER=./www # hosts allowed to access ressources from $HTTP_FOLDER # * to allow all, http://localhost:$DEV_PORT to allow only devserver CORS_ALLOWED_HOSTS=http://localhost:$DEV_PORT +NAME=IIIF +HOST=IIIF.tetras-lab.io diff --git a/README.md b/README.md index 155805fdda8c92e25798633f9a57127e847efe09..5aa601816b3a7be1af1d387e05c3bbf73240937a 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,44 @@ ## Mirador Video Annotation POC -Copy `.env.template` to `.env` and change variables to suit your need (you can skip the edit step) +### What is this repository + +This is a [Mirador](https://projectmirador.org/) based application that provides video annotation edition features : + ++ [x] Video rendering in mirador base on the work of [Tokyo university](https://github.com/2SC1815J/mirador) ++ [x] Annotation persistance using [annotot](https://github.com/PenguinParadigm/annotot) ++ [x] Manifest storage and persistance ++ [-] Annotation on video (currently only working on images) ++ [ ] Multi user and per-user workspace + +### Requirements + ++ [docker](https://docs.docker.com/) ++ [docker-compose](https://docs.docker.com/compose/install/) + +This readme assumes that you now a few basic about `docker` and `docker-compose`, if you are not familliar with `docker-compose` we recommand to read [the documentation](https://docs.docker.com/compose/) first. + +### Install + +Copy `.env.template` to `.env` and change variables to suit your need. -Run `docker-compose up -d`, which will serve a mirador instance at `http://localhost:$PORT` (default port is 8080). The `$HTTP_FOLDER` (`./www` by default) directory will be accessible via HTTP at `http://localhost:$PORT/data` and can be used to store manifests and theirs ressources and see them in Mirador. -If sources files are modified, run `docker-compose up -d --build` to update Mirador +Run `docker-compose up -d`, which will serve a mirador instance at `http://localhost:$DEV_PORT` (default port is 9000) with live rebuild/reload enabled on each `src/` and `public/` files modifications. +### Production -#### Use the development server +For production, one **also** need to setup : -Follow the previous instructions if you want to access ressources from `$HTTP_FOLDER` via HTTP in the devserver. ++ `COMPOSE_FILE` should be at least `docker-compose.yml` +Run `docker-compose up -d`, which will serve a mirador instance at `http://localhost:$PORT` (default port is 8080). + +If sources files are modified, run `docker-compose up -d --build` to update Mirador -Edit `.env` (copy it from `.env.template` if needed), set `COMPOSE_FILE=docker-compose.yml:devserver.yml` and adapt `DEV_*` variables to your needs. +#### Traefik -Run `docker-compose up -d --build devserver`, which will serve a mirador instance at `http://localhost:$DEV_PORT` (default port is 9000) with live rebuild/reload enabled on each `src/` and `public/` files modifications. +We provide a `traefik.yml` file to use behind [traefik](https://traefik.io/) this file does the following assumptions : ++ A traefik container exists and is running in an external docker network called `traefik` ++ Traefik has a tls resolver called `myresolver` ++ Traefik has a middleware called `hardening@docker` that adds the usual security headers diff --git a/devserver.yml b/dev.yml similarity index 84% rename from devserver.yml rename to dev.yml index 5aded5dc6e859c7a3bee4e0f495b7b6fd331816e..62146828dcb7fefb384c5df5d7710f4187540516 100644 --- a/devserver.yml +++ b/dev.yml @@ -1,4 +1,4 @@ -version: "3.9" +version: "3.3" services: devserver: build: @@ -14,3 +14,7 @@ services: - DEV_PORT volumes: - ./:/opt + + httpd: + ports: + - $PORT:80 diff --git a/docker-compose.yml b/docker-compose.yml index 31ae053949e0adfac62183b4bf71ca9facc51ad8..19661442781fef917b2633380deabdaacb2ebb62 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,8 @@ -version: "3.9" +version: "3.3" services: httpd: build: . restart: $RESTART - ports: - - $PORT:80 environment: - CORS_ALLOWED_HOSTS - WEBPACK_MODE=production diff --git a/traefik.yml b/traefik.yml new file mode 100644 index 0000000000000000000000000000000000000000..d6ccaef82556712b5a55da226a351a7b4f7f67c3 --- /dev/null +++ b/traefik.yml @@ -0,0 +1,18 @@ +version: "3.3" +services: + httpd: + networks: + - default + - traefik + labels: + - "traefik.enable=true" + - "traefik.docker.network=traefik" + - "traefik.http.routers.${NAME}.rule=Host(`${HOST}`)" + - "traefik.http.routers.${NAME}.tls.certresolver=myresolver" + - "traefik.http.routers.${NAME}.entrypoints=web,websecure" + - "traefik.http.routers.${NAME}.middlewares=hardening@docker" + + +networks: + traefik: + external: true