nginx, trino, client connection Failes

57 Views Asked by At

I've started to learn trino lately, so consider me a noob and forgive my foolishness please :) I've been having some problems when setting up trino behind a subdomain using nginx, here is my configurations, I can't really get it to connect, Can anyone please help me? here is my docker-compose: version: '3.7'

services:
  trino:
    image: trinodb/trino:439
    container_name: trino
    restart: unless-stopped
    ports:
      - "8086:8086"
      - "8443:8443"
    volumes:
      - ./etc:/etc/trino 
      # - ./etc/word.db:/etc
      - trino_data:/data/trino
      - ./ssl:/etc/ssl/trino
      - ./ssl/clustercoord.pem:/home/trino/.postgresql/root.crt
      - ./secrets:/etc/secrets
    env_file:
      - ./.env
  volumes:
    trino_data:

here is the config file:

coordinator=true
node-scheduler.include-coordinator=true
http-server.process-forwarded=true
hide-inaccessible-columns=true
web-ui.enabled=true
query.max-memory=5GB
query.max-memory-per-node=1GB
http-server.authentication.type=PASSWORD
internal-communication.shared-secret=somestuff
http-server.http.port=8086
discovery.uri=http://localhost:8086

and here is my nginx setup:

upstream trino {
  server localhost:8086;
}


server {
    #listen 80;

    listen 443 ssl; # managed by Certbot
    server_name trino.example.com;  # Replace with your domain or IP

    ssl_certificate /etc/ssl/certs/cert.crt;
    ssl_certificate_key /etc/ssl/private/cert.key;

    location / {
        proxy_pass http://trino;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-URI $request_uri;
        proxy_set_header X-Forwarded-Scheme $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Url-Scheme $scheme;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Can anyone please tell me how to connect to it using the cli, I've tried https://trino.example.com , https://trino.example.com:443 , https://trino.example.com:8086 and so on, it keeps waiting for 2m and then it fails, I've also set the file password authentication.

and here is some of the errors I got:

com.google.common.cache.LocalCache$Segment lambda$loadAsync$0
WARNING: Exception thrown during refresh
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Error fetching next (attempts: 4, duration: 2.01m)
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:594)

whenever I connect towards docker with:

docker exec -it trino trino --server https://trino.example.com --username bluh --password --schema default 

I get the same result

1

There are 1 best solutions below

0
Alireza Khorami On

The problem was because nginx and trino, were not able to see each other, just a simple docker networking problem :), I changed the discovery uri to this discovery.uri=http://0.0.0.0:8086 and now everything is functioning as expected.