Getting 504 Gateway Timeout when connecting to Gitlab hosted on docker

29 Views Asked by At

I restarted my gitlab hosted on docker and then suddenly nginx cant connect to it anymore.

When I do docker exec inside the container and do localhost:8080/gitlab it gives me back a sign in result.

This is netstat INSIDE of my gitlab_web container:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:9090          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:9093          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.11:32805        0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:9094            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:9229          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:9168          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:9236          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8150          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8151          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8153          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8154          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8155          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8092          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:9121          0.0.0.0:*               LISTEN
netstat: /proc/net/tcp6: No such file or directory
udp        0      0 0.0.0.0:9094            0.0.0.0:*
udp        0      0 127.0.0.11:35306        0.0.0.0:*
netstat: /proc/net/udp6: No such file or directory

Docker ps: 71709ac689bd gitlab/gitlab-ee:16.1.5-ee.0 "/assets/wrapper" 52 minutes ago Up 52 minutes (healthy) 80/tcp, 0.0.0.0:5005->5005/tcp, 0.0.0.0:222->22/tcp, 0.0.0.0:4433->443/tcp, 0.0.0.0:800->8080/tcp gitlab_web

Our nginx conf:

http {
    client_max_body_size 2000M;

    upstream gitlab_web {
        server 10.2.1.85:800;
    }

 
    server {
        listen 80;

        return 301 https://$host$request_uri;
    }

    server {
        client_max_body_size 2000M;
        server_tokens off;
        listen 443 ssl;
        server_name apprepodev;
        server_name apprepodev.ddnyi.local;

        ssl_certificate apprepodev.cer;
        ssl_certificate_key apprepodev.key;

        ssl_session_cache  builtin:1000  shared:SSL:10m;
        ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        ssl_prefer_server_ciphers on;

        proxy_set_header Connection '';
        proxy_http_version 1.1;
        chunked_transfer_encoding off;

        location /gitlab {
            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_pass http://gitlab_web/gitlab;
        }

...

docker-config for our gitlab_web:

version: '3.6'
services:
  web:
    container_name: gitlab_web
    image: 'gitlab/gitlab-ee:16.1.5-ee.0'
    restart: always
    hostname: 'apprepodev'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://apprepodev/gitlab'
        gitlab_rails['gitlab_shell_ssh_port'] = 222
        # Add any other gitlab.rb configuration here, each on its own line
    ports:
      - '800:8080'
      - '4433:443'
      - '222:22'
      - '5005:5005'
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
    shm_size: '256m'
    networks:
      - gitlab_network
  runner:
    container_name: gitlab_runner
    depends_on:
      - 'web'
    image: 'gitlab/gitlab-runner:alpine3.17'
    restart: always
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - './runner:/etc/gitlab-runner'
      - '/etc/ssl/certs:/etc/ssl/certs'
      - '/mnt:/mnt'
    networks:
      - gitlab_network

networks:
  gitlab_network:

It should set take the request when we go to apprepodev.ddnyi.local/gitlab -> forward it to nginx -> forwards it our linux server (10.2.1.85:800) -> sends it to docker. Isnt this the expected behavior?

Thank you for all help!

I tried changing the ports to 800->80 but still doesn't work.

0

There are 0 best solutions below