caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
57.15k stars 3.99k forks source link

Hello, I found a problem that sometimes caddy just can't start without any logs. #1860

Closed Hevienz closed 7 years ago

Hevienz commented 7 years ago

1. What version of Caddy are you using (caddy -version)?

caddy 0.10.6

2. What are you trying to do?

I use caddy to serve ElasticSearch in our product.

3. What is your entire Caddyfile?

*:9200
proxy / 192.168.100.29:9200 192.168.100.27:9200 192.168.100.26:9200 {
    policy uri_hash
    health_check /
    health_check_timeout 5s
    transparent
}

4. How did you run Caddy (give the full command and describe the execution environment)?

I run it in docker and the image is based on openjdk:8-jre-alpine.

#!/bin/bash

echo "[Start] Preparing for starting caddy..."
. /opt/kibana/bin/func.sh

PID=`pidof caddy`
echo "[Start] Caddy pid is ${PID}."

if [ -z "$PID" ]; then
    echo "[Start] Starting caddy..."
    nohup caddy -conf /opt/kibana/config/Caddyfile >> /opt/qingcloud/app-agent/log/app.log 2>&1 &
    waitport 127.0.0.1 9200
    echo "[Start] Caddy is started."
else
    echo "[Start] Caddy is already started."
fi

5. Please paste any relevant HTTP request(s) here.

NaN.

6. What did you expect to see?

What can I do to find what happened that make caddy can't start.

7. What did you see instead (give full error messages and/or log)?

Sorry, no error message left here.

8. How can someone who is starting from scratch reproduce the bug as minimally as possible?

I don't know how to reproduce it, It just happened unpredictably.

francislavoie commented 7 years ago

Why are you running Caddy in an openjdk image? Maybe try using https://hub.docker.com/r/abiosoft/caddy/ with the same configuration first. Generally with docker, you want to keep your processes in separate containers.

mholt commented 7 years ago

You also should run caddy just on the command line without any extra complications like Docker, etc. And for logs you want the -log flag as documented here. Hope that helps. :)