ct: add Alpine Linux Caddy

This commit is contained in:
cobaltgit 2025-09-15 13:05:14 +01:00
parent 569384b5d0
commit a781427451
No known key found for this signature in database
GPG Key ID: 699CFDA808E52696
4 changed files with 155 additions and 0 deletions

47
ct/alpine-caddy.sh Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 cobalt
# Author: cobalt (cobaltgit)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://caddyserver.com/
APP="Alpine-Caddy"
var_tags="${var_tags:-webserver}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-256}"
var_disk="${var_disk:-3}"
var_os="${var_os:-alpine}"
var_version="${var_version:-3.22}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /etc/caddy ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating $APP LXC"
$STD apk -U upgrade
msg_ok "Updated $APP LXC"
msg_info "Restarting Caddy"
rc-service caddy restart
msg_ok "Restarted Caddy"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

6
ct/headers/alpine-caddy Normal file
View File

@ -0,0 +1,6 @@
___ __ _ ______ __ __
/ | / /___ (_)___ ___ / ____/___ _____/ /___/ /_ __
/ /| | / / __ \/ / __ \/ _ \______/ / / __ `/ __ / __ / / / /
/ ___ |/ / /_/ / / / / / __/_____/ /___/ /_/ / /_/ / /_/ / /_/ /
/_/ |_/_/ .___/_/_/ /_/\___/ \____/\__,_/\__,_/\__,_/\__, /
/_/ /____/

View File

@ -0,0 +1,59 @@
{
"name": "Caddy",
"slug": "caddy",
"categories": [
21
],
"date_created": "2024-05-11",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 80,
"documentation": "https://caddyserver.com/docs/",
"website": "https://caddyserver.com/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/caddy.webp",
"config_path": "/etc/caddy/Caddyfile",
"description": "Caddy is a powerful, extensible platform to serve your sites, services, and apps, written in Go.",
"install_methods": [
{
"type": "default",
"script": "ct/caddy.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "debian",
"version": "12"
},
{
"type": "alpine",
"script": "ct/alpine-caddy.sh",
"resources": {
"cpu": 1,
"ram": 256,
"hdd": 3,
"os": "alpine",
"version": "3.22"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"text": "xcaddy needs to be updated manually after a caddy update!",
"type": "warning"
},
{
"text": "if you need an internal module run: `caddy add-package PACKAGENAME`",
"type": "info"
},
{
"text": "if you need an external module run: `xcaddy build --with github.com/caddy-dns/cloudflare`",
"type": "info"
}
]
}

View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 cobalt
# Author: cobalt (cobaltgit)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://caddyserver.com/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Caddy"
$STD apk add --no-cache caddy caddy-openrc
msg_ok "Installed Caddy"
read -r -p "${TAB3}Would you like to install xCaddy Addon? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
setup_go
msg_info "Setup xCaddy"
$STD apk add --no-cache git
cd /opt
RELEASE=$(curl -fsSL https://api.github.com/repos/caddyserver/xcaddy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
curl -fsSL "https://github.com/caddyserver/xcaddy/releases/download/${RELEASE}/xcaddy_${RELEASE:1}_linux_amd64.tar.gz" -o "xcaddy_${RELEASE:1}_linux_amd64.tar.gz"
$STD tar xzf xcaddy_"${RELEASE:1}"_linux_amd64.tar.gz -C /usr/local/bin
rm -rf /opt/xcaddy*
$STD xcaddy build
msg_ok "Setup xCaddy"
fi
msg_info "Enabling Caddy Service"
$STD rc-update add caddy default
msg_ok "Enabled Caddy Service"
msg_info "Starting Caddy"
$STD service caddy start
msg_ok "Started Caddy"
motd_ssh
customize