Comments (6)
FWIW I tried to write this but since I've never worked with Go I have no idea what I'm doing and it didn't seem to work. I spent way too much time trying to understand how to replace a module to even attempt to run the code. Anyway - here's a link to a broken/partial implementation:
from cloudflare.
This does work with some compose file magic. Overriding the entrypoint of the image is clunky as you can see but functional.
services:
reverseproxy:
container_name: caddy
build: .
restart: always
ports:
- 443:443
- 80:80
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./site:/site
- /shares/caddy/data:/data
- /shares/caddy/config:/config
secrets:
- cloudflare-api-key
entrypoint: ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile", "--envfile", "/run/secrets/cloudflare-api-key"]
secrets:
cloudflare-api-key:
file: ./cloudflare-api-key.secret
from cloudflare.
Nice, thanks for posting your solution!
(Going to close if that's alright, since that works. Would prefer to not have to reinvent env files for each plugin...)
from cloudflare.
I think it's fine to close. https://docs.docker.com/engine/swarm/secrets/ says "Docker secrets do not set environment variables directly. This was a conscious decision, because environment variables can unintentionally be leaked between containers (for instance, if you use --link)." I think the caddy --envfile
approach does not violate this because caddy loading its own environment state, not modifying the container's state (I assume). Seems like a fine approach.
from cloudflare.
Note I worked around this by putting the secret in a .env file instead, but as the Docker documentation argues, this is probably less secure than putting it in a secret file https://docs.docker.com/compose/environment-variables/
from cloudflare.
Can you use the --envfile
flag to give Caddy the environment file that way? https://caddyserver.com/docs/command-line#caddy-run
from cloudflare.
Related Issues (20)
- Certificate for private ip HOT 6
- Error building with cloudflare dns and xcaddy (i/o timeout) HOT 3
- Issue with resolvers HOT 1
- unrecognized directive: dns HOT 2
- Caddy Github Repo Link HOT 2
- Split DNS issue HOT 1
- Latest dependencies update broke caddy builder HOT 14
- malformed module path "https:/github.com/caddy-dns/cloudflare": invalid char ':' HOT 2
- Fails to build: cannot use h.allow0RTT (variable of type bool) as tls.QUICSessionTicketOptions HOT 2
- [Feature Request] Please consider tagging this repo to Caddy versions HOT 6
- Docker builds fail due to requirement for unreleased Caddy version HOT 2
- Dependencies with caddy 2.7.3 should be 2.7.2 HOT 1
- Building Doesn't work with the Latest Caddy Version 2.7.2 HOT 3
- Building with caddy from OMV terminal just gets exit status 2 HOT 1
- Build failed with golang 1.21 HOT 1
- Can modules be installed to an existing caddy installation? HOT 4
- Fatal error build with windows using master with latest release HOT 2
- Missing API token results in unintuitve error message HOT 5
- Adding temporary record for zone .in? HOT 3
- docker compose up error value in struct literal HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare.