Skip to content

Commit 85109ec

Browse files
authored
Feature: Add xCaddy for external Modules on Caddy-LXC (#1613)
* add xcaddy to caddy for advanced modules * increase space of caddy * Update caddy.json * fix deps
1 parent fb67025 commit 85109ec

File tree

3 files changed

+47
-9
lines changed

3 files changed

+47
-9
lines changed

ct/caddy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ APP="Caddy"
1010
var_tags="webserver"
1111
var_cpu="1"
1212
var_ram="512"
13-
var_disk="2"
13+
var_disk="4"
1414
var_os="debian"
1515
var_version="12"
1616
var_unprivileged="1"
@@ -46,4 +46,4 @@ description
4646
msg_ok "Completed Successfully!\n"
4747
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
4848
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
49-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"
49+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

install/caddy-install.sh

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/usr/bin/env bash
22

33
# Copyright (c) 2021-2025 tteck
4-
# Author: tteck (tteckster)
5-
# License: MIT
6-
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
4+
# Author: tteck (tteckster) | Co-Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
76

87
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
98
color
@@ -14,7 +13,14 @@ network_check
1413
update_os
1514

1615
msg_info "Installing Dependencies"
17-
$STD apt-get install -y {debian-keyring,debian-archive-keyring,apt-transport-https,gpg,curl,sudo,mc}
16+
$STD apt-get install -y \
17+
debian-keyring \
18+
debian-archive-keyring \
19+
apt-transport-https \
20+
gpg \
21+
curl \
22+
sudo \
23+
mc
1824
msg_ok "Installed Dependencies"
1925

2026
msg_info "Installing Caddy"
@@ -24,6 +30,29 @@ $STD apt-get update
2430
$STD apt-get install -y caddy
2531
msg_ok "Installed Caddy"
2632

33+
read -r -p "Would you like to install xCaddy Addon? <y/N> " prompt
34+
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
35+
msg_info "Installing Golang"
36+
cd /opt
37+
set +o pipefail
38+
GOLANG=$(curl -s https://go.dev/dl/ | grep -o "go.*\linux-amd64.tar.gz" | head -n 1)
39+
wget -q https://golang.org/dl/$GOLANG
40+
tar -xzf $GOLANG -C /usr/local
41+
ln -s /usr/local/go/bin/go /usr/local/bin/go
42+
set -o pipefail
43+
rm -rf /opt/go*
44+
msg_ok "Installed Golang"
45+
46+
msg_info "Setup xCaddy"
47+
cd /opt
48+
RELEASE=$(curl -s https://api.github.com/repos/caddyserver/xcaddy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
49+
wget -q https://github.com/caddyserver/xcaddy/releases/download/${RELEASE}/xcaddy_${RELEASE:1}_linux_amd64.deb
50+
$STD dpkg -i xcaddy_${RELEASE:1}_linux_amd64.deb
51+
rm -rf /opt/xcaddy*
52+
$STD xcaddy build
53+
msg_ok "Setup xCaddy"
54+
fi
55+
2756
motd_ssh
2857
customize
2958

json/caddy.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"resources": {
2121
"cpu": 1,
2222
"ram": 512,
23-
"hdd": 2,
23+
"hdd": 4,
2424
"os": "debian",
2525
"version": "12"
2626
}
@@ -30,5 +30,14 @@
3030
"username": null,
3131
"password": null
3232
},
33-
"notes": []
34-
}
33+
"notes": [
34+
{
35+
"text": "if you need an internal module run: `caddy add-package PACKAGENAME`",
36+
"type": "info"
37+
},
38+
{
39+
"text": "if you need an external module run: `xcaddy build --with github.com/caddy-dns/cloudflare`",
40+
"type": "info"
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)