julienhmmt/docker-compose

Getting 404 and errors in traefik.log

ottobaer opened this issue · 6 comments

I'm trying to get it running on a fresh Ubuntu 20.04 install but something doesn't work here.
The certifcate is pulled as it should but when I try to visit the nextcloud installation I get a 404 page not found error and these mesages in the traefik.log

time="2020-12-15T10:12:44Z" level=warning msg="Failed to inspect container 1a25f503516215d02b01557752b16010b48e221607675f803a2d34103191fc68, error: error during connect: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/1a25f503516215d02b01557752b16010b48e221607675f803a2d34103191fc68/json\": context canceled" providerName=docker time="2020-12-15T10:12:44Z" level=warning msg="Failed to inspect container a4e4325be058ea3f2889c04a7bb9dadd31fc2c20c840544e09efc1294e526e9e, error: error during connect: Get \"http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/a4e4325be058ea3f2889c04a7bb9dadd31fc2c20c840544e09efc1294e526e9e/json\": context canceled" providerName=docker time="2020-12-15T10:12:44Z" level=error msg="Cannot connect to docker server context canceled" providerName=docker

I attached the docker-compose.yml I use :

`---
version: '3.6'
services:
traefik:
image: traefik:${TRAEFIKVERSION}
restart: unless-stopped
ports:
- 80:80
- 443:443
- 8080:8080 # used to have the traefik dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./conf/traefik.yml:/etc/traefik/traefik.yml:ro
- ./conf/traefikdynamic:/traefikdynamic:ro
- ./logs/traefik.log:/etc/traefik/applog.log
- ./conf/acme.json:/acme.json

nginxnextcloud:
image: nginx:${NGINXVERSION}
restart: unless-stopped
container_name: nginxnextcloud
volumes:
- datanextcloud:/var/www/html
- datanginxnextcloudlogs:/var/log/nginx
- ./conf/nginx-nextcloud:/etc/nginx
labels:
traefik.enable: true
traefik.http.routers.nginxnextcloud-https.entrypoints: "websecure"
traefik.http.routers.nginxnextcloud-https.rule: "Host(cloud.server.domain)"
traefik.http.routers.nginxnextcloud-https.middlewares: "security@file, compression@file"
traefik.http.routers.nginxnextcloud-https.tls: "true"
traefik.http.routers.nginxnextcloud-https.tls.certresolver: "letsencrypt"

nextcloud:
image: nextcloud:${NEXTCLOUDVERSION}
restart: unless-stopped
container_name: nextcloudfpm
volumes:
- /opt/nextcloud/data:/var/www/html
environment:
MYSQL_HOST: sqlnextcloud
MYSQL_USER: ${MYSQLUSER}
MYSQL_PASSWORD: ${MYSQLPASSWORD}
MYSQL_DATABASE: ${MYSQLDB}
REDIS_HOST: redisnextcloud
links:
- mariadb
labels:
traefik.enable: false

mariadb:
image: mariadb:${MARIADBVERSION}
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: unless-stopped
container_name: sqlnextcloud
volumes:
- datadbnextcloud:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: '1'
MYSQL_USER: ${MYSQLUSER}
MYSQL_PASSWORD: ${MYSQLPASSWORD}
MYSQL_DATABASE: ${MYSQLDB}
labels:
traefik.enable: false

redis:
image: redis:${REDISVERSION}
restart: unless-stopped
volumes:
- dataredisnextcloud:/data
labels:
traefik.enable: false

volumes:
datanextcloud:
datadbnextcloud:
datanginxnextcloudlogs:
dataredisnextcloud:`

I'm documenting here, maybe it might be useful to someone.

Turns out the newer traefik version doesn't like an option and so it won't start correctly. You need to comment/delete the following line in conf/traefikdynamic/traefik_dynamic.yml :

stsIncludeSubdomain: true

Now redis has problems getting my hostname/ip adress:

Warning: Redis::connect(): php_network_getaddresses: getaddrinfo failed: Try again in /var/www/html/lib/private/RedisFactory.php on line 92

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/lib/private/RedisFactory.php:92) in /var/www/html/lib/private/legacy/OC_Template.php on line 350
Internal Server Error The server encountered an internal error and was unable to complete your request. Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report. More details can be found in the server log. 

I'm giving up here since it seems that the configuration is outdated so the newer versions of redis/traefik won't work.

Thank you for the stsIncludeSubdomain: true - I've updated the conf files.

Glad to help. I'm still stuck with the php_network_getaddresses: getaddrinfo failed:, do you have an idea ?

;-)
Do you name your container ? Maybe there's a mistake between the service name and the container name in your docker-compose file. Are they (redis and Traefik) in the same subnetwork ?

I didn't rename them. I'm trying with the default directory names now.

9a56a5507f8a   bridge                                      bridge    local
6ac6e8983f08   host                                        host      local
85fcdcf2bc36   none                                        null      local
1dcd1e3f5688   traefik-nginx-nextcloud-sql-redis_default   bridge    local

Everything is in the same subnet


    {
        "Name": "traefik-nginx-nextcloud-sql-redis_default",
        "Id": "1dcd1e3f5688ede162df542e08c0e37f71478807819b9ea85da3099f32f55c56",
        "Created": "2020-12-27T10:31:27.435574191+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.30.0.0/16",
                    "Gateway": "172.30.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "15c02e1637e427310e28d3d6eaef2d10f0e9734c8df1c1fe21e1476f1591327c": {
                "Name": "nextcloudfpm",
                "EndpointID": "3f518b0d393e65ea625b8abf3d10d06e1ec3a450406a4c4517d1df72dd44ff39",
                "MacAddress": "02:42:ac:1e:00:06",
                "IPv4Address": "172.30.0.6/16",
                "IPv6Address": ""
            },
            "571ecef40518f3a35928d93d59f1ea294e16d95de7b558e91380de75f0b241cc": {
                "Name": "nginxnextcloud",
                "EndpointID": "34481894bd833f8c25c62fe63261e9a3f6421c6dcd919808f00318d27b78d652",
                "MacAddress": "02:42:ac:1e:00:03",
                "IPv4Address": "172.30.0.3/16",
                "IPv6Address": ""
            },
            "5d714a8b7a50494d8a6387fc7a292ff1c64662689c48182af090535bb1d2bef7": {
                "Name": "traefik-nginx-nextcloud-sql-redis_redis_1",
                "EndpointID": "77bc5ba5a11a4825bf2c9f7d39ea48ba030ae6edc07187cdfbda007538ffac95",
                "MacAddress": "02:42:ac:1e:00:04",
                "IPv4Address": "172.30.0.4/16",
                "IPv6Address": ""
            },
            "aa18806e91b3e225d63199c25c328c307b3edf4b83a76700f317348dd7eb52e4": {
                "Name": "traefik-nginx-nextcloud-sql-redis_traefik_1",
                "EndpointID": "2414387d6e3dd7d256be709ffe87e0ded4f0176a3cda148f52a554c788814e4c",
                "MacAddress": "02:42:ac:1e:00:02",
                "IPv4Address": "172.30.0.2/16",
                "IPv6Address": ""
            },
            "c016713448aee975f1bc876596204ccdeb41adb2f6dce1dec6f44de530f85623": {
                "Name": "sqlnextcloud",
                "EndpointID": "5f5ac1e4dddd3c14d6981fb26a5695a76f4ff293fcdfbf031dcb618b4a51bb3b",
                "MacAddress": "02:42:ac:1e:00:05",
                "IPv4Address": "172.30.0.5/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "traefik-nginx-nextcloud-sql-redis",
            "com.docker.compose.version": "1.25.0"
        }
    }
]



Hello, sorry for delay.
Do you still have any errors ?