1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
using docker serivce create
with sending volume for config : /etc/config
a. System environment:
docker swarm
b. Command:
docker inspect ca
[
{
"ID": "on9r4k07vpt2btgvpby0pz0os",
"Version": {
"Index": 29832599
},
"CreatedAt": "2022-11-25T11:01:35.25925543Z",
"UpdatedAt": "2022-11-25T11:01:35.261731579Z",
"Spec": {
"Name": "ca",
"Labels": {},
"TaskTemplate": {
"ContainerSpec": {
"Image": "caddy",
"Args": [
"caddy",
"run",
"--config",
"/etc/caddy/caddy.json"
],
"Mounts": [
{
"Type": "bind",
"Source": "/mo/certsFinal",
"Target": "/mo/certsFinal"
},
{
"Type": "bind",
"Source": "/mo/config/caddy",
"Target": "/etc/caddy"
},
{
"Type": "bind",
"Source": "/mo/upload",
"Target": "/mo/upload"
}
],
"StopGracePeriod": 10000000000,
"DNSConfig": {},
"Isolation": "default"
},
"Resources": {
"Limits": {},
"Reservations": {}
},
"RestartPolicy": {
"Condition": "any",
"Delay": 5000000000,
"MaxAttempts": 0
},
"Placement": {},
"LogDriver": {
"Name": "json-file",
"Options": {
"max-file": "3",
"max-size": "10M"
}
},
"ForceUpdate": 0,
"Runtime": "container"
},
"Mode": {
"Replicated": {
"Replicas": 1
}
},
"UpdateConfig": {
"Parallelism": 0,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"RollbackConfig": {
"Parallelism": 0,
"FailureAction": "pause",
"Monitor": 5000000000,
"MaxFailureRatio": 0,
"Order": "stop-first"
},
"Networks": [
{
"Target": "l8dnnagdjobzp73vxonpwjc3l"
}
],
"EndpointSpec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 31080,
"PublishedPort": 31080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 2019,
"PublishedPort": 2019,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 31443,
"PublishedPort": 31443,
"PublishMode": "ingress"
}
]
}
},
"Endpoint": {
"Spec": {
"Mode": "vip",
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 31080,
"PublishedPort": 31080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 2019,
"PublishedPort": 2019,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 31443,
"PublishedPort": 31443,
"PublishMode": "ingress"
}
]
},
"Ports": [
{
"Protocol": "tcp",
"TargetPort": 31080,
"PublishedPort": 31080,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 2019,
"PublishedPort": 2019,
"PublishMode": "ingress"
},
{
"Protocol": "tcp",
"TargetPort": 31443,
"PublishedPort": 31443,
"PublishMode": "ingress"
}
],
"VirtualIPs": [
{
"NetworkID": "hifr8m195ctdt4c8t7gabgbx7",
"Addr": "10.0.0.101/24"
},
{
"NetworkID": "l8dnnagdjobzp73vxonpwjc3l",
"Addr": "10.0.1.103/24"
}
]
}
}
]
c. Service/unit/compose file:
docker service was created via an app, not via command line. Added service inspect above.
d. My complete Caddy config:
{
"admin": {
"disabled": false
},
"logging": {
"logs": {
"":{
"level": "DEBUG"
}
}
},
"apps": {
"http": {
"servers": {
"example": {
"listen": [
":31080" ,":31443"
],
"routes": [
{
"handle": [
{
"handler": "static_response",
"body": "Hello, world!"
}
]
}
]
}
}
},
"tls": {
"automation": {
"policies": [
{
"on_demand": true
}
],
"on_demand": {
"rate_limit": {
"interval": "10m",
"burst": 2
}
}
}
}
}
}
3. The problem I’m having:
on my webserver, :80 is mapped to :31080 and :443 is mapped to :31443. I am trying to automatically generate certificates. I am using json file(see above config) as config rater than Caddyfile. But certificates are not getting created. Also even with DEBUG logging, its not logging. Also can’t get admin port :2019 to work, curl doesn’t work.
4. Error messages and/or full log output:
docker logs didn’t had any logs for access / issuing of certificate.
Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.
5. What I already tried:
Trying to create auto certificates, on_demand; and it’s not issuing certificates.
But couldn’t find examples of json config to refer to.