0

My problem is similar to this one, which is apparently unsolved to this day :/ I was following this tutorial to setup my Theia IDE, the IDE is working but I want my 8080 port to be open for testing out the node.js backend I host on the Theia IDE using the terminal. Here are my docker-compose files I used for setting up the open ports and etc:

version: '2.2'

services:
  eclipse-theia:
    restart: always
    image: theiaide/theia:latest
    init: true
    environment:
      - VIRTUAL_HOST=mydomainhere.com
      - LETSENCRYPT_HOST=mydomainhere.com

version: '2'

services:
  nginx-proxy:
    restart: always
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "/etc/nginx/htpasswd:/etc/nginx/htpasswd"
      - "/etc/nginx/vhost.d"
      - "/usr/share/nginx/html"
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "/etc/nginx/certs"

  letsencrypt-nginx-proxy-companion:
    restart: always
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    volumes_from:
      - "nginx-proxy"

If I add expose: - "8080" to the eclipse-theia docker-compose file I get a 502 error returned... So that's not the way to go I guess. I also tried running netcat to check whether the port 8080 was open and it was.

UPDATE I get the following error in the logs when I get the 502 error: [error] 136#136: *21 no live upstreams while connecting to upstream If I add ports: - "8080" instead I get a HSTS error..

UPDATE 2

I tried the following config following the advice from the answer below:

version: '2.2'

services:
  eclipse-theia:
    restart: always
    image: theiaide/theia:latest
    init: true
    environment:
      - VIRTUAL_HOST=mysubdomain1.domain.com,mysubdomain2.domain.com
      - VIRTUAL_PORT=80,8080
      - LETSENCRYPT_HOST=mysubdomain1.domain.com,mysubdomain2.domain.com
      - LETSENCRYPT_EMAIL=mymail@domain.com

But this appears to not work either, Port 8080 seems to simply not work. I also tried specifying port 8080 on the nginx-proxy config, it does not work :/

Community
  • 1
  • 1
Munchkin
  • 857
  • 5
  • 24
  • 51

2 Answers2

1

do you use port 8080 on the proxy for something else? I just use 80 and 443 on the proxy...

If you use 8080 just on your eclipse-theia, why not define

ports: 
  - "8080:8080"

on the docker compose of theia instead of the nginx-proxy?

The proxy has the sense, to use several domains/subdomains on ports 80 and 443 instead of using weird port mess.

I cant explain how to use it like you described, cause since it makes no sense to me to use it that way i wont dive into that further.

  • `ports: - "8080"` is not the same as `ports: - "8080:8080"`? Because I already tried that. I wanted the port 8080 to be accessable thru the nginx proxy, that's why I wrote it down there. It might be that a made a logical error. – Munchkin May 19 '20 at 10:22
  • In other words, I want the port 8080 app to be accessible thru the nginx reverse proxy. – Munchkin May 19 '20 at 10:26
  • No thats not the same. take a look here: https://docs.docker.com/config/containers/container-networking/ When you want to use your nginx proxy, why would you use that 8080 port instead of a domain/subdomain with http https? That makes no sense to me.? My suggestion is to NOT use the proxy, or port 80/443 with the proxy. – Samuel Breu May 20 '20 at 08:10
  • following your advice I tried using a different subdomain and setting VIRTUAL_HOST to 8080 but that did not work as well :/ please check out the UPDATE 2 on the question. – Munchkin May 20 '20 at 13:03
  • Just checked the theia image, thats listening on port 3000... so you need to configure `- VIRTUAL_PORT=3000`. sometimes restarting nginx proxy and letsencrypt container helps. if it still does not work take a look into the nginx logs of your proxy container. By the and you should be able to reach your theia instance with one of these domains. – Samuel Breu May 20 '20 at 17:46
  • Setting the `VIRTUAL_PORT` to 3000 was the wrong decision. I figured it out and will post an answer below soon. – Munchkin May 22 '20 at 15:53
0

So what I had to do was set the config to:

version: '2.2'

services:
  eclipse-theia:
    restart: always
    image: theiaide/theia:latest
    init: true
    environment:
      - VIRTUAL_HOST=mysubdomain1.domain.com,mysubdomain2.domain.com
      - LETSENCRYPT_HOST=mysubdomain1.domain.com,mysubdomain2.domain.com
      - LETSENCRYPT_EMAIL=mymail@domain.com

and in the jwilder/nginx-proxy container there is apt installed so just execute apt install nano and then execute nano /etc/nginx/conf.d/default.conf and edit the second upstream port from 3000 to 8080 and voilá it works!

P.S. Don't add ports 8080 to the nginx-proxy config, that's completely unnecessary!

Munchkin
  • 857
  • 5
  • 24
  • 51