Skip to content
Snippets Groups Projects
Commit ee460c0a authored by Anthony's avatar Anthony
Browse files

Merge remote-tracking branch 'origin/main'

parents 26ac6aa9 4097b56a
No related branches found
No related tags found
No related merge requests found
.env 0 → 100644
COMPOSE_FILE=docker-compose.yml:traefik.yml
# prod container restart policy
RESTART=always
HTTP_FOLDER=./upload
# hosts allowed to access ressources from $HTTP_FOLDER
# * to allow all, http://localhost:$DEV_PORT to allow only devserver
CORS_ALLOWED_HOSTS=*
# This is the host used by annotot request launched by the client using mirador
# It should be localhost on dev mode, an something like annotot.yourservice.com in production
# For production only
# For traefik (optionnal)
NAME=scene-uploads
HOST=scene-uploads.tetras-libre.fr
HTTPD_NAME=expose-scene-uploads
HTTPD_HOST=expose-scene-uploads.tetras-libre.fr
:80 {
root * /srv
file_server browse
header Access-Control-Allow-Origin "{env.CORS_ALLOWED_HOSTS}"
}
File moved
......@@ -2,11 +2,11 @@ const express = require('express');
const multer = require('multer');
const app = express();
const port = 3000;
app.use('/static', express.static('uploads'));
app.use('/static', express.static('upload'));
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'uploads/') // Make sure this folder exists
cb(null, 'upload/') // Make sure this folder exists
},
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
......
......@@ -4,8 +4,19 @@ services:
front:
build:
context: "docker/"
volumes:
- ${PWD}:/app
environment:
ENV:
volumes:
- ./app:/app
- ./app/upload:/app/upload
httpd:
hostname: expose-scene-uploads
image: caddy:latest
restart: $RESTART
environment:
- CORS_ALLOWED_HOSTS
- WEBPACK_MODE=production
volumes:
- ./app/upload:/srv
- ./Caddyfile:/etc/caddy/Caddyfile
#!/bin/bash
npm install
./cli post_install
if [ "$ENV" == "prod" ]; then
cmd="npm start"
......
version: "3.4"
services:
httpd:
networks:
- default
- traefik
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.${HTTPD_NAME}.rule=Host(`${HTTPD_HOST}`)"
- "traefik.http.routers.${HTTPD_NAME}.tls.certresolver=myresolver"
- "traefik.http.routers.${HTTPD_NAME}.entrypoints=web,websecure"
- "traefik.http.routers.${HTTPD_NAME}.middlewares=hardening@docker"
front:
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"
#- "traefik.http.services.${NAME}.loadbalancer.server.port=3000"
networks:
traefik:
external: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment