a. System environment:
Windows 10 X64
WSL2 (aka. Windows Subsystem linux) Ubuntu 20.04
b. Command:
caddy start
d. My complete Caddyfile or JSON config:
requests.movies4you.digital {
encode gzip
log {
output file C:\caddy2\log\ombi_access.log
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
handle_errors C:\caddy\log\ombi_error.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
reverse_proxy 127.0.0.1:5000
tls {
dns cloudflare {YR-58NwJN3ZdE42yww3qRQeEL5Y0D9c8CB9DrFFb}
}
}
accounts.movies4you.digital {
encode gzip
log {
output file C:\caddy2\log\accounts_access.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
handle_errors C:\caddy\log\accounts_error.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
reverse_proxy 127.0.0.1:8056
tls {
dns cloudflare {YR-58NwJN3ZdE42yww3qRQeEL5Y0D9c8CB9DrFFb}
}
}
stream.movies4you.digital {
encode gzip
log {
output file C:\caddy\log\jellyfin_access.log{
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
handle_errors C:\caddy\log\jellyfin_error.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
}
reverse_proxy 127.0.0.1:8096
tls {
dns cloudflare {YR-58NwJN3ZdE42yww3qRQeEL5Y0D9c8CB9DrFFb}
}
}
The problem Iām having:
I saw this post by bugs181
Thanks for this! Somewhat new to Dockerfiles and have never used them before. I generally just follow self hosted tutorials and itās all done via Docker Compose. What I donāt understand is that how does docker compose know to use the image from the Dockerfile?
Example:
Docker file:
FROM caddy:2.0.0-builder AS builder
RUN caddy-builder \
github.com/caddy-dns/cloudflare
FROM caddy:2.0.0
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
im sorry if im a bit of a noob. But im still very cconfused. Im trying to have my caddy v2 work with cloudflare dns.
i got the GitHub - caddy-dns/cloudflare: Caddy module: dns.providers.cloudflare download. But implementing it is rather difficult for me. I know theirs a way to do so. But everything i could find on a more in depth detail was either 404 on github from Feb 13, 2020 or didnt tell detail instructions.
Essentially im trying to build it to work natively in Windows 10. Ive already setup cloudflare to correctly work with v2. Meaning changing the api setup from v1 global key to cloudflares api key.
I can build using WSL ubuntu 20.04. So using linux on the same pc is not a problem. But i do want to make sure it works natively for Windows 10. Meaning when i build ill have to build likes so.
xcaddy build \
--with github.com/caddy-dns/cloudflare
--output GOOS=windows go build
i need to know what directory to build from, what directory the cloudflare-master folder goes in. What commands in detail are needed to build. Again most of the references were scattered and not very detail on what exactly to do. It would be really helpful to have like all in one tutorial on how to build using xcaddy from steps 1-10 or however many steps there are. If you give me the info. Ide be more than happy to write one out as well as make a video on youtube if you guys want.
By default it should output a new caddy.exe to your current directory, and GOOS will use the default which will already be windows if you run it on windows.
ive tried xcaddy which is installed on my wsl2 Ubuntu 20.04 but i get xcaddy is not a valid command. But ive triple checked that xcaddy is installed and a directory is there for it? Do you know if it has to be ran in a certain directory inside terminal?
In Linux/WSL, you need to give xcaddy executable permissions with chmod +x xcaddy and then if itās in your current directory, prefix it with ./ to tell the shell you want to run it. If you move it to somewhere thatās in your PATH (like /usr/bin) then you donāt need to use ./
Should i chmod with root permissions. If not what permissions exactly should i give it. also if i were to move the xcaddy to /usr/bin then should i copy the directory or move the entire directory?
okay now im getting confused. how would i install xcaddy correctly. i cant find the post on how i installed it but i know i installed it via caddys docs. Could you please explain to make sure i did correctly install xcaddy
sudo tar -C /usr/local -xvf go1.14.4.linux-amd64.tar.gz
this was actually the only one that would work on my WSL2 Ubunutu 20.04. It let me build the xcaddy package. the only issue is i cant figure out how to build it for windows because im using a Windows Subsystem Linux Distro. It thinks its actually a linux install. So i need to output it to windows. Could you please respond with the correct info to ouput it in Windows X64
Thank you!
i built it succesfully but in my directories theres no exe for windows nor a linux caddy output. Im just wondering if you can tell me from the log if and where the file location is with my built caddy.exe
but is that the exe file or a linux ubuntu file. Im trying to build it for windows 10 in WSL2 Ubuntu 20.04. So im not understanding if theres suppose to be an exe or is it outputting a linux file. because i need a exe file. I was told above that i dont have to run --output GOOS=windows go build command. Do i infact have to run xcaddy build --with github.com/caddy-dns/cloudflare --output GOOS=windows go build becuase its running WSL2 on a linux kernal technically?
btw everytime i try to run that exact command xcaddy build --with github.com/caddy-dns/cloudflare --output GOOS=windows go build
i get this output 2020/06/07 19:18:47 [ERROR] missing flag; caddy version already set at go
heres my caddy directory
Are you sure? Can you post a screenshot where it says that, because I donāt see that anywhere in the readme.
Setting environment variables has nothing to do with xcaddy or caddy ā this is simply basic knowledge, āhow to use your computerā kind of thing. There are too many systems for us to document how to use every single one.
As far as I can tell, the readme is correct.
Iām not sure. Make certain that the file is executable and that youāre in a folder where you have permission to execute programs.
im sorry for the late response i had to reboot my server. but i did succesfully compile the caddy.exe thank you so much! but now i am having the same problem as before when trying to run the caddy reload command.
2020/06/08 01:40:30.987 ā[34mINFOā[0m using adjacent Caddyfile
reload: adapting config using caddyfile: parsing caddyfile tokens for 'log': Caddyfile:5 - Error during parsing: unrecognized subdirective: roll_size
any ideas?
btw heres my caddyfile im trying to reload
requests.movies4you.digital {
encode gzip
log {
output file C:\caddy2\log\ombi_access.log
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
handle_errors C:\caddy\log\ombi_error.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
reverse_proxy 127.0.0.1:5000
tls {
dns cloudflare {cloudlare api key}
}
}
accounts.movies4you.digital {
encode gzip
log {
output file C:\caddy2\log\accounts_access.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
handle_errors C:\caddy\log\accounts_error.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
reverse_proxy 127.0.0.1:8056
tls {
dns cloudflare {cloudflare api key}
}
}
stream.movies4you.digital {
encode gzip
log {
output file C:\caddy\log\jellyfin_access.log{
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
handle_errors C:\caddy\log\jellyfin_error.log {
roll_size 150 # Set max size 150 MB
roll_keep 7 # Keep log files for 7 days
roll_keep_for 7 # Keep at most 2 log files
}
}
reverse_proxy 127.0.0.1:8096
tls {
dns cloudflare {cloudflare api key}
}
}
Your syntax for the log directive is incorrect. Looks at the examples here:
handle_errors is not a replacement for errors in Caddy v1, thatās also incorrect usage. That directive defines a set of handlers that get executed if Caddy encounters an error (i.e. 502 if the proxy upsteam is not accessible). Thereās no separation between access and error logging in Caddy v2.