gitlab-recipes icon indicating copy to clipboard operation
gitlab-recipes copied to clipboard

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

Open tomsiwik opened this issue 6 years ago • 3 comments

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 [email protected]

    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?

tomsiwik avatar Feb 27 '18 17:02 tomsiwik

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

Thanks

Freekers avatar Dec 30 '20 18:12 Freekers

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

tomsiwik avatar Jan 03 '21 00:01 tomsiwik

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!!

Freekers avatar Jan 03 '21 19:01 Freekers