add CaddyManager script
This commit is contained in:
parent
9743e23292
commit
32436eed56
46
ct/caddymanager.sh
Normal file
46
ct/caddymanager.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
|
# Author: Slaviša Arežina (tremor021)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/caddymanager/caddymanager
|
||||||
|
|
||||||
|
APP="CaddyManager"
|
||||||
|
var_tags="${var_tags:-}"
|
||||||
|
var_cpu="${var_cpu:-1}"
|
||||||
|
var_ram="${var_ram:-512}"
|
||||||
|
var_disk="${var_disk:-4}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-13}"
|
||||||
|
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 /opt/caddymanager ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_info "Updating Debian LXC"
|
||||||
|
$STD apt update
|
||||||
|
$STD apt upgrade -y
|
||||||
|
msg_ok "Updated Debian LXC"
|
||||||
|
cleanup_lxc
|
||||||
|
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}${CL}"
|
||||||
85
install/caddymanager-install.sh
Normal file
85
install/caddymanager-install.sh
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2026 community-scripts ORG
|
||||||
|
# Author: Slaviša Arežina (tremor021)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/caddymanager/caddymanager
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies"
|
||||||
|
$STD apt install -y \
|
||||||
|
git \
|
||||||
|
build-essential \
|
||||||
|
caddy
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
NODE_VERSION=22 setup_nodejs
|
||||||
|
fetch_and_deploy_gh_release "caddymanager" "caddymanager/caddymanager" "tarball"
|
||||||
|
systemctl disable -q caddy
|
||||||
|
|
||||||
|
msg_info "Configuring CaddyManager"
|
||||||
|
SECRET_JWT=$(openssl rand -hex 32)
|
||||||
|
cd /opt/caddymanager/backend
|
||||||
|
$STD npm install
|
||||||
|
cd /opt/caddymanager/frontend
|
||||||
|
$STD npm install
|
||||||
|
|
||||||
|
cat <<EOF >/opt/caddymanager/caddymanager.env
|
||||||
|
PORT=3000
|
||||||
|
DB_ENGINE=sqlite
|
||||||
|
SQLITE_DB_PATH=/opt/caddymanager/caddymanager.sqlite
|
||||||
|
CORS_ORIGIN=${LOCAL_IP}:80
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
CADDY_SANDBOX_URL=http://localhost:2019
|
||||||
|
PING_INTERVAL=30000
|
||||||
|
PING_TIMEOUT=2000
|
||||||
|
AUDIT_LOG_MAX_SIZE_MB=100
|
||||||
|
AUDIT_LOG_RETENTION_DAYS=90
|
||||||
|
METRICS_HISTORY_MAX=1000
|
||||||
|
JWT_SECRET=${SECRET_JWT}
|
||||||
|
JWT_EXPIRATION=24h
|
||||||
|
EOF
|
||||||
|
sed -i 's|/usr/share/caddy|/opt/caddymanager/frontend/dist|g' /opt/caddymanager/frontend/Caddyfile
|
||||||
|
msg_ok "Configured CaddyManager"
|
||||||
|
|
||||||
|
msg_info "Creating services"
|
||||||
|
cat <<EOF >/etc/systemd/system/caddymanager-backend.service
|
||||||
|
[Unit]
|
||||||
|
Description=Caddymanager Backend Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/opt/caddymanager/backend
|
||||||
|
ExecStart=/usr/bin/npm start
|
||||||
|
Restart=always
|
||||||
|
EnvironmentFile=/opt/caddymanager/caddymanager.env
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/etc/systemd/system/caddymanager-frontend.service
|
||||||
|
[Unit]
|
||||||
|
Description=Caddymanager Frontend Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/opt/caddymanager/frontend
|
||||||
|
ExecStart=/usr/bin/caddy run --config Caddyfile
|
||||||
|
Restart=always
|
||||||
|
EnvironmentFile=/opt/caddymanager/caddymanager.env
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
cleanup_lxc
|
||||||
Loading…
x
Reference in New Issue
Block a user