Merge pull request #1584 from glabutis/feat/companion

feat: add Bitfocus Companion LXC installer
This commit is contained in:
CanbiZ (MickLesk)
2026-03-27 14:09:25 +01:00
committed by GitHub
3 changed files with 195 additions and 0 deletions

71
ct/companion.sh Normal file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG
# Author: glabutis
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/bitfocus/companion
APP="Companion"
var_tags="${var_tags:-automation;media}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
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 /opt/companion/companion_headless.sh ]]; then
msg_error "No ${APP} Installation Found!"
exit 1
fi
RELEASE_JSON=$(curl -fsSL "https://api.bitfocus.io/v1/product/companion/packages?limit=20")
PACKAGE_JSON=$(echo "$RELEASE_JSON" | jq -c '(if type == "array" then . else .packages end) | [.[] | select(.target=="linux-tgz" and (.uri | contains("linux-x64")))] | first')
RELEASE=$(echo "$PACKAGE_JSON" | jq -r '.version // empty')
ASSET_URL=$(echo "$PACKAGE_JSON" | jq -r '.uri // empty')
if [[ -z "$RELEASE" || -z "$ASSET_URL" ]]; then
msg_error "Could not resolve a matching Linux x64 Companion package from the Bitfocus API."
exit 1
fi
if [[ "${RELEASE}" == "$(cat ~/.companion 2>/dev/null)" ]]; then
msg_ok "No update required. ${APP} is already at v${RELEASE}"
exit
fi
msg_info "Stopping ${APP}"
systemctl stop companion
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP} to v${RELEASE}"
CLEAN_INSTALL=1 fetch_and_deploy_from_url "$ASSET_URL" "/opt/companion"
chown -R companion:companion /opt/companion
echo "${RELEASE}" >~/.companion
msg_ok "Updated ${APP} to v${RELEASE}"
msg_info "Starting ${APP}"
systemctl start companion
msg_ok "Started ${APP}"
msg_ok "Update Successful"
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}:8000${CL}"

View File

@@ -0,0 +1,81 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: glabutis
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/bitfocus/companion
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
jq \
libusb-1.0-0
msg_ok "Installed Dependencies"
msg_info "Fetching Latest Bitfocus Companion Release"
RELEASE_JSON=$(curl -fsSL "https://api.bitfocus.io/v1/product/companion/packages?limit=20")
PACKAGE_JSON=$(echo "$RELEASE_JSON" | jq -c '(if type == "array" then . else .packages end) | [.[] | select(.target=="linux-tgz" and (.uri | contains("linux-x64")))] | first')
RELEASE=$(echo "$PACKAGE_JSON" | jq -r '.version // empty')
ASSET_URL=$(echo "$PACKAGE_JSON" | jq -r '.uri // empty')
if [[ -z "$RELEASE" || -z "$ASSET_URL" ]]; then
msg_error "Could not resolve a matching Linux x64 Companion package from the Bitfocus API."
exit 1
fi
msg_ok "Found Companion v${RELEASE}"
msg_info "Downloading Bitfocus Companion v${RELEASE}"
fetch_and_deploy_from_url "$ASSET_URL" "/opt/companion"
msg_ok "Downloaded and Extracted Bitfocus Companion v${RELEASE}"
msg_info "Installing udev Rules"
if [[ -f /opt/companion/50-companion-headless.rules ]]; then
cp /opt/companion/50-companion-headless.rules /etc/udev/rules.d/
udevadm control --reload-rules
udevadm trigger
fi
msg_ok "Installed udev Rules"
msg_info "Creating companion User"
useradd --system --no-create-home --shell /usr/sbin/nologin companion 2>/dev/null || true
mkdir -p /opt/companion-config
chown -R companion:companion /opt/companion-config
chown -R companion:companion /opt/companion
msg_ok "Created companion User"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/companion.service
[Unit]
Description=Bitfocus Companion
After=network.target
Wants=network-online.target
[Service]
Type=simple
User=companion
ExecStart=/opt/companion/companion_headless.sh --config-dir /opt/companion-config
WorkingDirectory=/opt/companion
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
SyslogIdentifier=companion
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now companion
msg_ok "Created Service"
echo "${RELEASE}" >~/.companion
motd_ssh
customize
cleanup_lxc

43
json/companion.json Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "Bitfocus Companion",
"slug": "companion",
"categories": [
19
],
"date_created": "2026-03-16",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 8000,
"documentation": "https://user.bitfocus.io/docs",
"website": "https://bitfocus.io/companion",
"logo": "https://raw.githubusercontent.com/bitfocus/companion/main/assets/icon.png",
"description": "Bitfocus Companion enables the Elgato Stream Deck and other controllers to trigger actions in broadcast software. Installs headless with a dedicated system user and systemd service, fetching the latest release via the Bitfocus API.",
"install_methods": [
{
"type": "default",
"script": "ct/companion.sh",
"resources": {
"cpu": 2,
"ram": 512,
"hdd": 8,
"os": "debian",
"version": "12"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"text": "Companion v4.x downloads are served through the Bitfocus API, not GitHub Releases.",
"type": "info"
},
{
"text": "Requires libusb for USB device (Stream Deck) bindings.",
"type": "info"
}
]
}