diff --git a/.env.template b/.env.template index d7a95869ee04faff42b9e08d164499863ff4b7ba..a51a08256bb473621bbdbde229c0d9f9c829966d 100644 --- a/.env.template +++ b/.env.template @@ -1,7 +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:devserver.yml:annotot.yml -#COMPOSE_FILE=docker-compose.yml:annotot.yml -COMPOSE_FILE=devserver.yml:annotot.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 @@ -26,3 +29,6 @@ ANNOTOT_LISTEN_IP=0.0.0.0 ANNOTOT_HOST=localhost # For production only ANNOTOT_SECRET_KEY_BASE=insert-a-random-key-here +# For traefik (optionnal) +NAME=IIIF +HOST=IIIF.tetras-lab.io diff --git a/README.md b/README.md index e86549d8b503c586f72076c8aefe01d86b783613..2c8bb5e7780f70ef6d7e57f2beeb4fd0d6e458d8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,18 @@ ## Mirador Video Annotation POC + +### Install + Copy `.env.template` to `.env` and change variables to suit your need. You **MUST** set at least the `ANNOTOT_SECRET_KEY_BASE` to a random string, the rest is preconfigured for a local development environment. +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 + +### Production + For production, one **also** need to setup : + `COMPOSE_FILE` should be at least `docker-compose.yml:annotot.yml` @@ -12,12 +21,16 @@ For production, one **also** need to setup : 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. +#### Traefik -If sources files are modified, run `docker-compose up -d --build` to update Mirador +We provide a `traefik.yml` file to use behind [traefik](https://traefik.io/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 -#### Use the development server +#### Developpement Follow the previous instructions if you want to access ressources from `$HTTP_FOLDER` via HTTP in the devserver. diff --git a/annotot.yml b/annotot.yml deleted file mode 100644 index 3122dfa2aaa935c713ee99bb710e6dba6f573f22..0000000000000000000000000000000000000000 --- a/annotot.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: "3.9" -services: - annotot: - image: tetraslibre/annotot-app - ports: - - ${ANNOTOT_PORT}:3000 - environment: - - IP=${ANNOTOT_LISTEN_IP} - - ENV=${ANNOTOT_ENV} - - SECRET_KEY_BASE=${ANNOTOT_SECRET_KEY_BASE} - volumes: - - ./annotot-db:/app/db diff --git a/docker-compose.yml b/docker-compose.yml index 31ae053949e0adfac62183b4bf71ca9facc51ad8..7da79bd5b5c5e20283fc65f985c20a54cc5bcf3f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,11 +3,18 @@ services: httpd: build: . restart: $RESTART - ports: - - $PORT:80 environment: - CORS_ALLOWED_HOSTS - WEBPACK_MODE=production volumes: - $HTTP_FOLDER:/srv/data - ./Caddyfile:/etc/caddy/Caddyfile + + annotot: + image: tetraslibre/annotot-app + environment: + - IP=${ANNOTOT_LISTEN_IP} + - ENV=${ANNOTOT_ENV} + - SECRET_KEY_BASE=${ANNOTOT_SECRET_KEY_BASE} + volumes: + - ./annotot-db:/app/db