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
@@ -2,24 +2,20 @@
|
||||
_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: MickLesk (CanbiZ)
|
||||
# Author: Tom Frenzel (tomfrenzel)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/coder/coder
|
||||
# Source: https://github.com/chirpstack/chirpstack
|
||||
|
||||
APP="Coder"
|
||||
var_tags="${var_tags:-development;ide;workspaces}"
|
||||
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:-yes}"
|
||||
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
export var_access_url="${var_access_url:-}"
|
||||
export var_admin_email="${var_admin_email:-}"
|
||||
export var_admin_pass="${var_admin_pass:-}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
@@ -30,15 +26,16 @@ function update_script() {
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /etc/coder.d/coder.env ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
if [[ ! -f /etc/chirpstack/chirpstack.toml ]]; then
|
||||
msg_error "No ChirpStack Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "coder" "coder/coder"; then
|
||||
DPKG_FORCE_CONFOLD=1 fetch_and_deploy_gh_release "coder" "coder/coder" "binary" "latest" "" "coder_*_linux_$(arch_resolve "amd64" "arm64").deb"
|
||||
msg_ok "Updated successfully!"
|
||||
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
|
||||
}
|
||||
|
||||
@@ -49,5 +46,4 @@ 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}:3000${CL}"
|
||||
echo -e "${INFO}${YW}Admin credentials: /opt/coder_data/.env${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
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/coder/coder
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
setup_postgresql
|
||||
PG_DB_NAME="coder" PG_DB_USER="coder" PG_DB_CREDS_FILE="/dev/null" setup_postgresql_db
|
||||
|
||||
fetch_and_deploy_gh_release "coder" "coder/coder" "binary" "latest" "" "coder_*_linux_$(arch_resolve "amd64" "arm64").deb"
|
||||
|
||||
var_access_url="${var_access_url:-http://${LOCAL_IP}:3000}"
|
||||
if [[ ! "$var_access_url" =~ ^https?:// ]]; then
|
||||
msg_warn "Access URL '${var_access_url}' has no scheme, using http://${var_access_url}"
|
||||
var_access_url="http://${var_access_url}"
|
||||
fi
|
||||
|
||||
msg_info "Configuring Coder"
|
||||
cat <<EOF >/etc/coder.d/coder.env
|
||||
CODER_HTTP_ADDRESS=0.0.0.0:3000
|
||||
CODER_ACCESS_URL=${var_access_url}
|
||||
CODER_PG_CONNECTION_URL=postgres://coder:${PG_DB_PASS}@127.0.0.1:5432/coder?sslmode=disable
|
||||
EOF
|
||||
chmod 640 /etc/coder.d/coder.env
|
||||
chown root:coder /etc/coder.d/coder.env
|
||||
mkdir -p /opt/coder_data
|
||||
cat <<EOF >/opt/coder_data/.env
|
||||
CODER_ADMIN_USERNAME=admin
|
||||
CODER_ADMIN_EMAIL=${var_admin_email:-admin@coder.local}
|
||||
CODER_ADMIN_PASSWORD=${var_admin_pass:-$(random_password)}
|
||||
EOF
|
||||
chmod 600 /opt/coder_data/.env
|
||||
# The first start runs all database migrations before it reports ready, longer than 90s on slow disks
|
||||
mkdir -p /etc/systemd/system/coder.service.d
|
||||
cat <<EOF >/etc/systemd/system/coder.service.d/override.conf
|
||||
[Service]
|
||||
TimeoutStartSec=30min
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q --now coder
|
||||
msg_ok "Configured Coder"
|
||||
|
||||
msg_info "Creating Coder Admin"
|
||||
source /opt/coder_data/.env
|
||||
for _ in {1..60}; do
|
||||
curl -fsS http://127.0.0.1:3000/healthz >/dev/null 2>&1 && break
|
||||
sleep 2
|
||||
done
|
||||
$STD coder login http://127.0.0.1:3000 \
|
||||
--first-user-username "$CODER_ADMIN_USERNAME" \
|
||||
--first-user-email "$CODER_ADMIN_EMAIL" \
|
||||
--first-user-password "$CODER_ADMIN_PASSWORD" \
|
||||
--first-user-full-name "Admin" \
|
||||
--first-user-trial=false
|
||||
msg_ok "Created Coder Admin"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in new issue
Block a user