gitlabhq / gitlab-recipes

Mostly unofficial GitLab recipes for setup on different platforms, update etc...
Other
745 stars 420 forks source link

Caddy recipe does not work using docker-compose.yml configuration #311

Open tomsiwik opened 6 years ago

tomsiwik commented 6 years ago

I'm unsuccessfully trying to make caddy work with gitlab using given recipe. However, i'm currently stuck at 502 and searching and finding the same configurations of caddy and gitlab through a reverse proxy setup everywhere. Can somebody help me out and tell me if my current configuration is valid or what i'm actually doing wrong?

Caddyfile:

https://git.example.com {

    tls info@example.com

    log git.access.log {
        rotate_size     50
        rotate_age      90
        rotate_keep     20
        rotate_compress
    }

    errors git.errors.log {
        404 /var/gitlab/404.html
        422 /var/gitlab/422.html
        500 /var/gitlab/500.html
        502 /var/gitlab/502.html
    }

    proxy / gitlab:8181 {
        fail_timeout 0s
        header_upstream X-Forwarded-Ssl on
        transparent
    }
}

https://*.pages.example.com {
    tls { max_certs 15 }

    proxy / gitlab:8090 {
        fail_timeout 0s
        transparent
    }
}

docker-compose.yml:

version: '3.3'

volumes:
    gitlab:

services:
    gitlab:
        container_name: gitlab
        image: gitlab/gitlab-ee:latest
        restart: always
        expose:
            - "8181"
            - "8090"
        environment:
            GITLAB_OMNIBUS_CONFIG: |
                external_url 'https://git.example.com'
                gitlab_workhorse['listen_network'] = "tcp"
                gitlab_workhorse['listen_addr'] = "localhost:8181"
                nginx['enable'] = "false"
                nginx['custom_gitlab_server_config'] = "proxy_buffering off;"

                pages_external_url 'https://pages.example.com'
                gitlab_pages['enable'] = true
                gitlab_pages['listen_proxy'] = "localhost:8090"
                gitlab_pages['redirect_http'] = true
                gitlab_pages['use_http2'] = true
        volumes:
            - "gitlab:/opt/gitlab/embedded/service/gitlab-rails/public"
            - "./gitlab:/etc/gitlab"
            - "./log/gitlab:/var/log/gitlab"
            - "./opt/gitlab:/var/opt/gitlab"

    caddy:
        build:
            context: github.com/abiosoft/caddy-docker.git
            args:
                plugins: reauth
        image: abiosoft/caddy
        container_name: caddy
        ports:
            - "80:80"
            - "443:443"
        links:
            - gitlab
        volumes:
            - "gitlab:/var/gitlab"
            - "./Caddyfile:/etc/Caddyfile"
            - "./www:/var/www"
        restart: always

Troubleshooting so far:

curl -L gitlab:8181 inside caddy container returns connection refused. curl -L localhost:8181 inside caddy container returns valid html.

Any suggestions i might try?

Freekers commented 3 years ago

Almost 3 years later and I'm experiencing exactly the same issue. Did you ever manage to figure this one out?

Thanks

tomsiwik commented 3 years ago

Yes, using the official caddy docker v2, a custom dockerfile building my needed plugins and something similar to the following config: https://caddy.community/t/caddy-reverse-proxying-gitlab/5178/5 - tl;dr: I had to re-enable nginx and proxy back to it

Freekers commented 3 years ago

Yes, using the official caddy docker v2, a custom dockerfile building my needed plugins and something similar to the following config: https://caddy.community/t/caddy-reverse-proxying-gitlab/5178/5 - tl;dr: I had to re-enable nginx and proxy back to it

Thanks, that did the trick!!