executing /opt/caddy2/caddy run --environ --config /opt/caddy2/caddy.yaml --adapter yaml
I get
2020/04/18 19:18:29.666 INFO using provided configuration {"config_file": "/opt/caddy2/caddy.yaml", "config_adapter": "yaml"}
run: unrecognized config adapter: yaml
Are all the adapters not part of the base binary? if so why am I getting this error
if not what is the correct --with url to add yaml adapter. I tried --with github.com/iamd3vil/caddy_yaml_adapter
Also, it seems that xcaddy does not accept multiple --with per can be used multiple times in the docs as on compile it only pulls the first --with url.
build script
#!/bin/bash
DIR="$(dirname "$(readlink -f "$0")")"
ARCH=amd64
echo Caddy Executable will be in $DIR/$ARCH
OS=linux
REL=v2.0.0-rc.3
echo deleting any old executable
[ -f $DIR/$ARCH/caddy ] && rm $DIR/$ARCH/caddy
echo ...building
GOOS=$OS GOARCH=$ARCH xcaddy build $REL \
--output $DIR/$ARCH \
--with github.com/iamd3vil/caddy_yaml_adapter
--with github.com/dkebler/tls.dns@59adaa6eb0600309e8a28e5ce016c14614fed054
echo ...done building
[ -f $DIR/$ARCH/caddy ] && $DIR/$ARCH/caddy version
You’re missing a \ at the end of your yaml line! That’s why it’s only grabbing the first one
I have a feeling the reason the yaml plugin it’s not working is that Caddy’s undergone many changes since that plugin was created. I think it might need some updating to work, but I’m not certain.
finally get back to this. As I mention, total go noob so
Where is that init function to go? in the yaml plugin or in caddy source?
I forked the yaml adapter and changed things for my fork and updated to rc3 but can’t get by this error
2020/05/03 09:45:38 [INFO] exec (timeout=5m0s): /usr/local/go/bin/go get -d -v github.com/dkebler/tls.dns@59adaa6eb0600309e8a28e5ce016c14614fed054
go: github.com/dkebler/tls.dns 59adaa6eb0600309e8a28e5ce016c14614fed054 => v0.0.0-20200416152026-59adaa6eb060
2020/05/03 09:45:41 [INFO] Build environment ready
2020/05/03 09:45:41 [INFO] Building Caddy
2020/05/03 09:45:41 [INFO] exec (timeout=5m0s): /usr/local/go/bin/go build -o /opt/caddy2/amd64 -ldflags -w -s -trimpath
go: finding module for package github.com/caddyserver/caddy/caddyconfig
/opt/go/pkg/mod/github.com/dkebler/caddy_yaml_adapter@v0.0.0-20200503164444-281ce3872190/yaml.go:7:2: module github.com/caddyserver/caddy@latest fou
nd (v1.0.5), but does not contain package github.com/caddyserver/caddy/caddyconfig
2020/05/03 09:45:47 [INFO] Cleaning up temporary folder: /tmp/buildenv_2020-05-03-0945.544517954
2020/05/03 09:45:47 [FATAL] exit status 1
...done building
Also bit confused I thought the yaml adapter was part of caddy2 core? It’s only available if you build as plugin? In other words no third party plugin no yaml adapter?
Honestly I’d like to help but 1. I am not golang coder, 2. Not familiar at all with V2 code structure. By the time you try to explain how to help one of you could have made these changes.
That’s correct. The yaml plugin isn’t part of the Caddy core. The only config adapters that will be core are Caddyfile and JSON (although JSON isn’t really an adapter since it’s a 1:1 mapping to the internal configuration)
from my perspective the v2 docs as they are imply that this adapter is part of the “core”. So either it and some other popular formats should be or the docs should be changed to indicate that they may be available as a third party plugins. Maybe with a links.
Related to this now that caddy project expects sysops to compile their own with plugins (xcaddy, instead of webpage) the docs on setting that up that should be clearer and more detailed (not everyone is go coder). Maybe an example build script would be helpful like the one I wrote for myself. I’ll be changing this to add the plugins as file of urls instead of hard coded. That will make it easier to do builds with different plugins set and maintain those.
#!/bin/bash
DIR="$(dirname "$(readlink -f "$0")")"
ARCH=${1:-amd64}
echo Caddy Executable will be in $DIR/$ARCH
OS=linux
REL=v2.0.0-rc.3
echo deleting any old executable
[ -f $DIR/$ARCH/caddy ] && rm $DIR/$ARCH/caddy
echo ...building
GOOS=$OS GOARCH=$ARCH xcaddy build $REL \
--output $DIR/$ARCH \
--with github.com/dkebler/caddy_yaml_adapter@281ce3872190087364b3a8220ebbd7dee6ce6a5f \
--with github.com/dkebler/tls.dns@59adaa6eb0600309e8a28e5ce016c14614fed054
echo ...done building
[ -f $DIR/$ARCH/caddy ] && $DIR/$ARCH/caddy version