Skip to content

Conversation

cobaltgit
Copy link

@cobaltgit cobaltgit commented Sep 15, 2025

🛑 New scripts must first be submitted to ProxmoxVED for testing.
PRs for new scripts that skip this process will be closed.


✍️ Description

This PR adds an additional option for the Caddy LXC to utilise an Alpine Linux-based container template instead of the existing Debian 12.

🔗 Related PR / Issue

Link: #

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No breaking changes – Existing functionality remains intact.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔍 Code & Security Review (X in brackets)

  • Follows Code_Audit.md & CONTRIBUTING.md guidelines
  • Uses correct script structure (AppName.sh, AppName-install.sh, AppName.json)
  • No hardcoded credentials

📋 Additional Information (optional)

@cobaltgit
Copy link
Author

cobaltgit commented Sep 15, 2025

I could switch to using the xcaddy apk package (apk add --no-cache xcaddy) or would it be better to download straight from GH releases? Then again it depends on the golang apk package which might conflict with the setup_go call?

@MickLesk
Copy link
Member

apk is better for alpine, its much smarter and smoother

@cobaltgit
Copy link
Author

cobaltgit commented Sep 15, 2025

Seems the golang in alpine 3.22's repos is just ever so slightly outdated...1.25 is in the edge repos though.

Might have to revert to manually downloading and extracting both go and xcaddy

caddy-test:~# xcaddy build
2025/09/15 16:30:51 [INFO] absolute output file path: /root/caddy
2025/09/15 16:30:51 [INFO] Temporary folder: /tmp/buildenv_2025-09-15-1630.1086491535
2025/09/15 16:30:51 [INFO] Writing main module: /tmp/buildenv_2025-09-15-1630.1086491535/main.go
package main

import (
        caddycmd "github.com/caddyserver/caddy/v2/cmd"

        // plug in Caddy modules here
        _ "github.com/caddyserver/caddy/v2/modules/standard"
)

func main() {
        caddycmd.Main()
}
2025/09/15 16:30:51 [INFO] Initializing Go module
2025/09/15 16:30:51 [INFO] exec (timeout=0s): /usr/bin/go mod init caddy 
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2025/09/15 16:30:51 [INFO] Pinning versions
2025/09/15 16:30:51 [INFO] exec (timeout=0s): /usr/bin/go get -v github.com/caddyserver/caddy/v2 
go: downloading github.com/caddyserver/caddy/v2 v2.10.2
go: downloading github.com/caddyserver/caddy v1.0.5
go: github.com/caddyserver/caddy/[email protected] requires go >= 1.25 (running go 1.24.7; GOTOOLCHAIN=local)
2025/09/15 16:30:52 [FATAL] exit status 1

@tremor021
Copy link
Member

You can specify which version to install like:

GO_VERSION="1.22.2" setup_go

or w/e version you need

Alpine repos currently have an outdated version of Golang, latest version of caddy refuses to build with xcaddy
@cobaltgit
Copy link
Author

You can specify which version to install like:

GO_VERSION="1.22.2" setup_go

or w/e version you need

Yea i've done it to fetch the latest version of go! Thanks for the tip either way

@community-scripts community-scripts deleted a comment from cobaltgit Sep 15, 2025
@tremor021
Copy link
Member

Disregard what i said. When we merge func to main repo it will work fine

@cobaltgit
Copy link
Author

cobaltgit commented Sep 15, 2025

Seems the binary built by xcaddy is placed in the current working directory and so it's not being used if we select the install xcaddy option. Same situation as the debian image then again so...

@cobaltgit
Copy link
Author

cobaltgit commented Sep 16, 2025

Should I port over the default configuration from the Debian version? The default webpage does contain systemd references then again, unless I replace those with OpenRC equivalents

...
cat<<EOF>/etc/caddy/Caddyfile
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

:80 {
        # Set this path to your site's directory.
        root * /usr/share/caddy

        # Enable the static file server.
        file_server

        # Another common task is to set up a reverse proxy:
        # reverse_proxy localhost:8080

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
EOF
...

@michelroegl-brunner
Copy link
Member

Just do the default config, should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants