infogulch / xtemplate

A html/template-based hypertext preprocessor and rapid application development web server written in Go.
Apache License 2.0
74 stars 1 forks source link

caddy add package support. #19

Closed gedw99 closed 2 months ago

gedw99 commented 2 months ago

in the latest tagged caddy you dont need to use xacddy.

Instead you can use the package cmd calls like below.

works for me :) Might be a good one for xtemplate ?

It will take ANY caddy and recompile it to have the package inside.

caddy-run-package-add:
    $(CADDY_RUN_CMD) add-package -h
    $(CADDY_RUN_CMD) add-package $(CADDY_RUN_VAR_PACKAGE)

    #$(CADDY_RUN_CMD) add-package github.com/Odyssey346/ListenCaddy
    #$(CADDY_RUN_CMD) add-package github.com/abiosoft/caddy-exec
    #$(CADDY_RUN_CMD) add-package github.com/greenpau/caddy-git
caddy-run-package-del:
    $(CADDY_RUN_CMD) remove-package github.com/Odyssey346/ListenCaddy
    $(CADDY_RUN_CMD) remove-package github.com/abiosoft/caddy-exec
caddy-run-package-ls:
    $(CADDY_RUN_CMD) list-modules --packages
gedw99 commented 2 months ago

hey @infogulch

The above is a botnet I think. Can you delete it ?

gedw99 commented 2 months ago

@infogulch

https://github.com/caddyserver/caddy/issues/6548 would be useful ?

Its not idempotent, which kind of sucks.

caddy add-package github.com/abiosoft/caddy-exec
Error: package is already added
gedw99 commented 2 months ago

xtemplate works btw :)

appd github.com/greenpau/caddy-appd
exec github.com/abiosoft/caddy-exec
git github.com/greenpau/caddy-git
http.handlers.exec github.com/abiosoft/caddy-exec
http.handlers.git github.com/greenpau/caddy-git
http.handlers.xtemplate github.com/infogulch/xtemplate-caddy

I think your xtemplate can also include the SQLite db features and needs CGO if we want SQL included ?

francislavoie commented 2 months ago

in the latest tagged caddy you dont need to use xacddy.

But you still should, if possible. caddy add-package downloads from https://caddyserver.com/download which has no uptime guarantees. If this is for automation at all, you should avoid it. add-package is specifically meant for manual usage (individual end-users), not automation. Using xcaddy is strongly preferred because you're always building from source, relying on Github infrastructure etc rather than cheap/unreliable caddyserver.com infrastructure.

infogulch commented 2 months ago

Recommending xcaddy seems to be the way. I'll update the readme to reflect this soon. Thanks all for your input. :)

gedw99 commented 1 month ago

Recommending xcaddy seems to be the way. I'll update the readme to reflect this soon. Thanks all for your input. :)

Got it :)

did not realise add package was dependent on their server

infogulch commented 1 month ago

I looked at moving the caddy-xtemplate package into a subdirectory/package of the Go module in this repo, but it looks like caddy packages must be the root Go package in a Go module, so this won't work. Is this correct @francislavoie ?

francislavoie commented 1 month ago

No, they can be in subdirectories, you just need to make their package name (in your go.mod) match. For example https://github.com/RussellLuo/caddy-ext has multiple plugins organized that way (I don't necessarily agree though, there's advantages to having it one per repo)