commit
d8eb9e5aa1
47
ct/alpine-caddy.sh
Normal file
47
ct/alpine-caddy.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# 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
6
ct/headers/alpine-caddy
Normal file
@ -0,0 +1,6 @@
|
||||
___ __ _ ______ __ __
|
||||
/ | / /___ (_)___ ___ / ____/___ _____/ /___/ /_ __
|
||||
/ /| | / / __ \/ / __ \/ _ \______/ / / __ `/ __ / __ / / / /
|
||||
/ ___ |/ / /_/ / / / / / __/_____/ /___/ /_/ / /_/ / /_/ / /_/ /
|
||||
/_/ |_/_/ .___/_/_/ /_/\___/ \____/\__,_/\__,_/\__,_/\__, /
|
||||
/_/ /____/
|
60
frontend/public/json/caddy.json
Normal file
60
frontend/public/json/caddy.json
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "Alpine-Caddy",
|
||||
"slug": "alpine-caddy",
|
||||
"categories": [
|
||||
21
|
||||
],
|
||||
"date_created": "2025-09-17",
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
83
install/alpine-caddy-install.sh
Normal file
83
install/alpine-caddy-install.sh
Normal file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# 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
|
||||
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 * /var/www/html
|
||||
|
||||
# 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
|
||||
mkdir -p /var/www/html
|
||||
cat<<EOF>/var/www/html/index.html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Caddy works!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello Caddy!</h1>
|
||||
<p>For more information, refer to the Caddy <a href="https://caddyserver.com/docs/">documentation</a><p>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
msg_ok "Installed Caddy"
|
||||
|
||||
read -r -p "${TAB3}Would you like to install xCaddy Addon? <y/N> " prompt
|
||||
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
|
||||
GO_VERSION="$(curl -fsSL https://go.dev/VERSION?m=text | head -1 | cut -c3-)" setup_go
|
||||
msg_info "Setup xCaddy"
|
||||
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 xcaddy
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user