dockeramazon-ec2cloudflarecaddytaskwarrior

Unable to connect to port 53589 on EC2 instance using Docker and Caddy server


What I'm trying to do

Host a Taskwarrior Server on an AWS EC2 instance, and connect to it via a subdomain (e.g. task.mydomain.dev).

Taskwarrior server operates on port 53589.

Tech involved

How I've tried to do this

I have:

Config files

/opt/task/docker-compose.yml

version: '3.3'

services:
  taskd:
    image: connectical/taskd
    restart: always
    volumes:
      - /opt/task:/var/taskd
    ports:
      - 53589:53589

networks:
  default:
    external:
      name: caddy_net

/opt/caddy/docker-compose.yml

version: "3.4"

services:
  caddy:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: caddy
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./config:/config
      - ./data:/data
      - ./Caddyfile:/etc/caddy/Caddyfile

networks:
  default:
    external:
      name: caddy_net

/opt/caddy/Caddyfile:

task.mydomain.dev:53589 {
  reverse_proxy taskd:53589
  tls {
    dns cloudflare myCloudflareAPIkey
  }
}

What's actually happening

What I've tried to fix it

Does anyone have any idea what's happening or could point me in the right direction?


Solution

  • If you are attempting to proxy HTTPS traffic on Cloudflare on a port not on the standard list, you will need to follow one of these options:

    1. Set it up as a Cloudflare HTTPS Spectrum app on the required port 53589
    2. Set up the record in the Cloudflare DNS tab as Grey cloud (in other words, it will only perform the DNS resolution - meaning you will need to manage the certificates on your side)
    3. Change your service so that it listens on one of the standard HTTPS ports listed in the documentation in point (1)