Yotter configuration

1. Caddy version (caddy version):

v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=

2. How I run Caddy:

see docker compose

a. System environment:

Ubuntu 20 lts
Linux hostname 5.4.0-65-generic

b. Command:

docker-compose up -d/restart or caddy restart

c. Service/unit/compose file:

version: "3.7"

services:
  caddy:
    image: caddy:2
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - /home/user/Yotter/app:/var/www/yotter
      - /home/user/Yotter/ytproxy:/var/run/ytproxy
    restart: unless-stopped

d. My complete Caddyfile or JSON config:

subdomain.domain.tld { 

  route {
    file_server /static/* {
      root /var/www/yotter
    }

    reverse_proxy (/videoplayback/*|/vi/*|/a/*) unix//var/run/ytproxy/http-proxy.sock

    reverse_proxy yotter:5000
  }

}

3. The problem I’m having:

I’m trying to run Yotter. If I use a simplified version of the caddyfile it works except for the youtube part

subdomain.domain.tld { 
    reverse_proxy yotter:5000
}

I’m trying to use the suggested nginx configuration to get it working.

server {
    listen 80;
    server_name <example.com>; # ChangeME
    access_log off;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }

    location /static/ {
        root /home/ubuntu/Yotter/app/; # Change this depending on where you clone Yotter
        sendfile on;
        aio threads=default;
    }

    location ~ (^/videoplayback$|/videoplayback/|/vi/|/a/) {
        proxy_pass http://unix:/var/run/ytproxy/http-proxy.sock;
        add_header Access-Control-Allow-Origin *;
        sendfile on;
        tcp_nopush on;
        aio_write on;
        aio threads=default;
        directio 512;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
    }
}

4. Error messages and/or full log output:

The configuration is accepted by caddy but it does not work ni the browser since all I get is 502

5. What I already tried:

The current Caddyfile configuration is what I came up with. Since I’m getting 502 I suppose they’re getting redirected to the wrong containers/routes. I used route to try and get them in the right order since I read about the priority order “issues”

6. Links to relevant resources:

Yotter

Self Hosting Yotter

Please don’t forget to make a volume for the /data directory for the Caddy container. You risk data loss and hitting rate limits with either of the enabled ACME issuers. See Docker Hub

That’s not a valid matcher. Inline matchers can only be a basic path matcher that starts with /, a named matcher reference (starts with @) or * to match all requests.

To match multiple paths, you need to use a named matcher, like this:

@ytproxy path /videoplayback/* /vi/* /a/*
reverse_proxy @ytproxy unix//var/run/ytproxy/http-proxy.sock

Thanks, I have the volume mounted, I deleted some rows before posting the compose here.

Anyway your suggestion worked. I had to change /videoplayback/* to /videoplayback* since it has some parameters appended and add /ytc/* since I was getting 500 errors there (I think they forgot to update their own docs).

For anyone wanting to use Yotter with caddy 2 this is my (working) config

yotter.domain.tld { 

    @ytproxy path /videoplayback* /vi/* /a/* /ytc/*

  route {
    file_server /static/* {
      root /var/www/yotter
    }

    reverse_proxy @ytproxy unix//var/run/ytproxy/http-proxy.sock

    reverse_proxy yotter:5000
  }

}

Where /var/www/yotter is the folder mounted in the caddy docker compose pointing to the yotter app directory and /var/run/ytproxy is the folder mounted in the caddy docker compose from the ytproxy container. My (partial) docker-compose for Yotter is

version: "3.8"
services:
  mariadb:
    image: mariadb:10.5
    ...
  
  ytproxy:
    image: 1337kavin/ytproxy:latest
    restart: unless-stopped
    volumes:
      - "/home/user/Yotter/ytproxy:/app/socket"

  yotter:
    image: ytorg/yotter:latest
    restart: unless-stopped
    #ports:
    #  - "127.0.0.1:5000:5000"
    environment:
      DATABASE_URL: mysql+pymysql://${DB_USER}:${DB_PASSWORD}@mariadb:3306/${DB_NAME}
    depends_on:
      - mariadb
      - ytproxy
    volumes:
      - migrations:/usr/src/app/migrations
      - ./yotter-config.json:/usr/src/app/yotter-config.json

    
volumes:
  migrations:

The twitter section is not working. I get a 500 on the /twitter endpoint. I think it should be passed to reverse_proxy yotter:5000 like we did in the configuration. Will update when/if I fix it

This topic was automatically closed after 30 days. New replies are no longer allowed.