0

I've got a test installation of Titra on a local system, and I've got it answering http on port 80 with this docker-compose file:

version: "2.0"
services:
  titra:
    image: kromit/titra
    container_name: titra
    depends_on:
      - mongodb
    environment:
      - ROOT_URL=http://timesheet
      - MONGO_URL=mongodb://mongodb/titra
      - PORT=3000
    ports:
      - "80:3000"
    restart: always
  mongodb:
    image: mongo:4.4
    container_name: mongodb
    restart: always
    volumes:
      - /root/titradb:/data/db

That works, but I'd kind of like the thing to answer https instead, but I'm not that familiar with Titra itself, nor Meteor (the framework it's written in), and my poking around the available documentation hasn't turned up anything about https for self-hosted Titra instances.

Michael Kohne
  • 2,284
  • 1
  • 16
  • 29

1 Answers1

1

You could add a nginx reverse proxy to your docker-compose file:

reverse:
  container_name: reverse
  hostname: reverse
  image: nginx:latest
  ports:
    - 80:80
    - 443:443
  restart: always
  volumes:
    - ./nginx/conf/:/etc/nginx/conf.d/:ro
titra:
  image: kromit/titra
  container_name: titra
  hostname: titra
  depends_on:
    - mongodb
  environment:
    - ROOT_URL=https://timesheet
    - MONGO_URL=mongodb://mongodb/titra
    - PORT=3000
  ports:
    - "3000:3000"
  restart: always

mongodb:
  image: mongo:4.4
  container_name: mongodb
  hostname: mongodb
  restart: always
  volumes:
   - /srv/mongodb/:/data/db

Your nginx should be configured with a *.conf like containing something like this: upstream titra { server titra:3000; }

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name timesheet;

    ssl_certificate /etc/nginx/ssl/live/timesheet/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/live/timesheet/privkey.pem;
    

    location / {
      proxy_pass  http://titra;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
    }
}

I have a similar setup and it works fine. It's based loosely on

https://www.freecodecamp.org/news/docker-nginx-letsencrypt-easy-secure-reverse-proxy-40165ba3aee2/