lancachenet / monolithic

A monolithic lancache service capable of caching all CDNs in a single instance
https://hub.docker.com/r/lancachenet/monolithic
Other
728 stars 73 forks source link

Lancache Continuous Restart on 60 Second Cycle #59

Closed HumanJHawkins closed 4 years ago

HumanJHawkins commented 4 years ago

Describe the issue you are having

Suspect these two issues may be related so posting together. Symptoms/Issues:

  1. Suggested install (from github instructions) breaks on Ubuntu Server. Ubuntu ships with systemd-resolved running by default. So lancache-dns will fail to start. I disabled systemd-resolve and this may be irrelevant to the main problem. But I'm not familiar with this so report it.
  2. Lancache goes into an immediate restart on launch, and continues restarting indefinitely. Unsure if it is related, but lancache is listening on port 443... That might be the problem, as sniproxy needs (and is using) that port. I assume this is coming from the Nginx base image, but could not figure out how to turn it off. Is it normal that lancache would be listening on this port too?

(See "Output of containers" for the container and ports list.)

How are you running the container(s)?

docker run --restart unless-stopped --name lancache-dns --detach \
  -p 192.168.0.151:53:53/udp \
  -p 172.17.0.1:53:53/udp \
  -e USE_GENERIC_CACHE=true -e LANCACHE_IP="192.168.0.151 172.17.0.1" lancachenet/lancache-dns:latest
docker run \
  --restart unless-stopped \
  --name lancache \
  --detach \
  -v /cache/data:/data/cache \
  -v /cache/logs:/data/logs \
  -e UPSTREAM_DNS="1.1.1.1 1.0.0.1" \
  -e CACHE_MEM_SIZE=4000m \
  -e CACHE_DISK_SIZE=1t \
  -p 192.168.0.151:80:80 \
  -p 172.17.0.1:80:80 \
  lancachenet/monolithic:latest
docker run --restart unless-stopped --name sniproxy --detach \
  -p 192.168.0.151:443:443 \
  -p 172.17.0.1:443:443 \
  lancachenet/sniproxy:latest

DNS Configuration

Here is where I may have broken something... Because it wouldn't install due to port 53 being in use, I looked at three different sites explaining how to turn off systemd-resolved... The first part (stop and disable) worked. The second part (edit configs to apply manual DNS) was no-go... The configs referenced did not exist.

But, since I was installing a replacement DNS anyway, I continued. And lancache-dns appears to be working. I am posting this from a computer that got it's DNS from this instance of lancache-dns.

Output of container(s)

Insure what you mean, but here is a snapshot of the containers/ports in the single second befor lancache restarts:

CONTAINER ID        IMAGE                             COMMAND                  CREATED              STATUS              PORTS                                                      NAMES
f106a1f66b87        lancachenet/sniproxy:latest       "/scripts/bootstrap.…"   34 seconds ago       Up 32 seconds       172.17.0.1:443->443/tcp, 192.168.0.151:443->443/tcp        sniproxy
e193af15121e        lancachenet/monolithic:latest     "/bin/bash -e /init/…"   44 seconds ago       Up 1 second         172.17.0.1:80->80/tcp, 192.168.0.151:80->80/tcp, 443/tcp   lancache
faa271c246dc        lancachenet/lancache-dns:latest   "/bin/bash -e /init/…"   About a minute ago   Up About a minute   172.17.0.1:53->53/udp, 192.168.0.151:53->53/udp            lancache-dns
csamsel commented 4 years ago

Don't detach it and look at the log.

VibroAxe commented 4 years ago

We need the container logs

docker logs lancache should be the secret sauce

HumanJHawkins commented 4 years ago

Sorry for the delay... Originally I thought my logs were empty, but your secret sauce did the trick. The logs showed a different issue... Related to cache size, the documentation (main page here and at dockerhub) says "They accept the standard nginx notation for sizes (k/m/g/t) and durations (m/h/d)". It turns out "t" (or at least "1t") is an invalid size... Up through "g" only perhaps.

I spent a fair bit of time trying to find NGINX documentation to support this, but never found a list of the acceptable units. I think the safe thing would be to just remove the "t" from the documentation.

Relevant bit from the log was: nginx: [emerg] invalid max_size value "max_size=1t" in /etc/nginx/conf.d/20_proxy_cache_path.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

Thanks much.

Lepidopterist commented 4 years ago

Hello,

Please can you set the CACHE_DISK_SIZE environment variable to 1000g (rather than 1t) and try again?

You will likely need to 'docker stop ' followed by 'docker rm ' before re-starting the container for this to pick up successfully.

Cheers!

B.

HumanJHawkins commented 4 years ago

Sorry to have been unclear. I did that and it worked. So this is just a documentation issue. I can make a pull request with a fix for the README.md file, but the same documentation is also copied to the main page at dockerhub. So I hesitated to do so, lest the instructions get updated on only one of two spots.

VibroAxe commented 4 years ago

If you would be so kind as to do a PR we then copy it into docker hub. Thanks for the offer

HumanJHawkins commented 4 years ago

Done. Thanks.

HumanJHawkins commented 4 years ago

Verified fixed.