Erisa / cloudflared-docker

Simple Alpine-built scratch-runtime Dockerfile for cloudflared, with support for multiple architectures.
https://hub.docker.com/r/erisamoe/cloudflared
Other
158 stars 22 forks source link

[Documentation] Tunnel config file #3

Closed hackmonker closed 2 years ago

hackmonker commented 2 years ago

Anyway we can add a configuration file for cloudflared to look at? Did not see it mention anywhere so asked

https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/configuration/configuration-file

hackmonker commented 2 years ago

Ah we can add in command if I am not wrong

Erisa commented 2 years ago

You can mount a config file to /etc/cloudflared/config.yml in the container.

e.g. docker run -v $PWD/config.yml:/etc/cloudflared/config.yml erisamoe/cloudflared

hackmonker commented 2 years ago

I am using compose so we run that command once?

Erisa commented 2 years ago

No, you include it as a volume in your compose file:

  cloudflared:
    image: erisamoe/cloudflared
    volumes:
        - ./config.yml:/etc/cloudflared/config.yml

You may also want to mount other files like your cert.pem or your tunnels json credentials file. Add these as extra volumes in the compose file.

Eventually I hope to add this to the docs here: https://docs.erisa.uk/cloudflared-docker/ But right now haven't found the time.

hackmonker commented 2 years ago

nice idea about the docs. I learned config and cloudflared with a bit difficulty since the docs are not that good. it will help a lot new users.

montoyasg commented 2 years ago

For those who are not very sure you can follow this guide to generate the YAML config file & tunnel-creds JSON

After that just mount the folder containing these files to '/etc/cloudflared' and run this command instead 'tunnel --config /etc/cloudflared/config.yml run'

Probably UDP Receive Buffer size could be increased on this container to support QUIC

Erisa commented 2 years ago

Probably UDP Receive Buffer size could be increased on this container to support QUIC

Is that something we can configure on the container? I was under the impression it was a host setting.

Your flow for named tunnels looks about right, though the explicit --config isn't strictly required, my containers run tunnel run with no issue since that's the default config location anyway.

montoyasg commented 2 years ago

Probably UDP Receive Buffer size could be increased on this container to support QUIC

Is that something we can configure on the container? I was under the impression it was a host setting.

Your flow for named tunnels looks about right, though the explicit --config isn't strictly required, my containers run tunnel run with no issue since that's the default config location anyway.

you're right. followed this guide to increase buffer size (https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size). Tunnel comes online but no traffic passes thru it after a few mins. HTTP2 is still much more stable