mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-28 16:34:21 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03303e1b9d |
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: Tom Frenzel (tomfrenzel)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/chirpstack/chirpstack
|
||||
|
||||
APP="ChirpStack"
|
||||
var_tags="${var_tags:-lorawan;iot}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /etc/chirpstack/chirpstack.toml ]]; then
|
||||
msg_error "No ChirpStack Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Updating ChirpStack"
|
||||
$STD apt update
|
||||
upgrade_packages_with_retry "chirpstack" "chirpstack-gateway-bridge"
|
||||
msg_ok "Updated ChirpStack"
|
||||
msg_ok "Updated successfully!"
|
||||
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 "${GATEWAY}${BGN}http://${IP}:8080${CL}"
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: Tom Frenzel (tomfrenzel)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/chirpstack/chirpstack
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
if [[ -z "${var_region:-}" ]]; then
|
||||
echo -e "${INFO}${YW}Available regions: https://github.com/chirpstack/chirpstack/tree/master/chirpstack/configuration${CL}"
|
||||
read -r -p "${TAB3}Gateway region ID (e.g. eu868, us915_0): " var_region || true
|
||||
fi
|
||||
if [[ -z "${var_region:-}" ]]; then
|
||||
msg_error "Gateway region ID is required (set var_region or enter it when prompted)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
mosquitto \
|
||||
redis-server
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PG_VERSION="18" setup_postgresql
|
||||
PG_DB_NAME="chirpstack" PG_DB_USER="chirpstack" PG_DB_EXTENSIONS="pg_trgm" setup_postgresql_db
|
||||
|
||||
msg_info "Installing ChirpStack"
|
||||
setup_deb822_repo \
|
||||
"chirpstack" \
|
||||
"https://artifacts.chirpstack.io/packages/chirpstack.key" \
|
||||
"https://artifacts.chirpstack.io/packages/4.x/deb" \
|
||||
"stable" \
|
||||
"main"
|
||||
$STD apt install -y \
|
||||
chirpstack-gateway-bridge \
|
||||
chirpstack
|
||||
msg_ok "Installed ChirpStack"
|
||||
|
||||
msg_info "Configuring ChirpStack"
|
||||
sed -i "s|^\(\s*dsn = \).*|\1\"postgres://chirpstack:${PG_DB_PASS}@localhost/chirpstack?sslmode=disable\"|" /etc/chirpstack/chirpstack.toml
|
||||
if ! grep -Eq "^[[:space:]]*\"${var_region,,}\"[[:space:]]*,?[[:space:]]*$" /etc/chirpstack/chirpstack.toml; then
|
||||
sed -i "/^[[:space:]]*enabled_regions = \\[$/a\\ \"${var_region,,}\"," /etc/chirpstack/chirpstack.toml
|
||||
fi
|
||||
sed -i -E "s#^(\s*(event|command)_topic_template\s*=\s*\")#\1${var_region,,}/#" /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
|
||||
mkdir -p /etc/systemd/system/chirpstack.service.d
|
||||
cat <<EOF >/etc/systemd/system/chirpstack.service.d/override.conf
|
||||
[Unit]
|
||||
After=postgresql.service redis-server.service mosquitto.service
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
# the packaged unit starts on the stock DSN, crash-loops and hits its start limit
|
||||
systemctl reset-failed chirpstack
|
||||
systemctl restart chirpstack chirpstack-gateway-bridge
|
||||
msg_ok "Configured ChirpStack"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in new issue
Block a user