This requires you to have the cloudflared tunnel config.json & <uuid>.json already generated as well as the dns cname.
- If you do not go follow the steps on Cloudflares docs Here and stop at step 6.
-
Copy the .json files that were generated in
~/.cloudflaredto your paperless-ng folder in a new folder calledcloudflared -
Edit the
config.jsonfile and modify thecredentials-filevalue to point to/etc/cloudflared/<uuid>.json& remove the line withurl -
Copy the section of the docker-compose.yml file on this page that has
cloudflareto the docker-compose in your paperless-ng folder.- Copy
cloudflare:down toTUNNEL_URL: http://webserver:8000. - Formatting and indents matter! Make sure it matches the formatting of yours.
- Copy
-
After all that run
docker-compose up -din your paperless-ng folder to update your paperless stack to include cloudflared and automatically create and proxy your instance through the dns zone you set up earlier.
If the cloudflared container errors and keeps restarting you can check the docker logs of it and the error will say what the problem is
Sidenotes:
- You may want to check what the latest version of cloudflared available on Docker Hub since cloudflare doesnt provide a
:latest. If its newer than2021.11.0then modify the docker-compose to reflect the new version and rundocker-compose up -dto rebuild you stack with the latest version. - The entire docker-compose.yml file on this page is the
tikaversion and is only modified to bind the data and media folders directly to the paperless-ng folder instead of using docker volumes to make easy client-side backups. You can use the entire thing if youre doing a fresh install.
References: https://github.com/judge2020/docker-cloudflared