mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-08-10 14:49:13 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 89ee9955e5 | |||
| b611150c43 |
+1
-1
@@ -47,7 +47,7 @@ function update_script() {
|
|||||||
systemctl stop ersatzTV
|
systemctl stop ersatzTV
|
||||||
msg_ok "Stopped ErsatzTV"
|
msg_ok "Stopped ErsatzTV"
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "ersatztv-ffmpeg" "ErsatzTV/ErsatzTV-ffmpeg" "prebuild" "latest" "/opt/ErsatzTV-ffmpeg" "*-$(arch_resolve "linux64" "linuxarm64")-gpl-8.1.tar.xz"
|
fetch_and_deploy_gh_release "ersatztv-ffmpeg" "ErsatzTV/ErsatzTV-ffmpeg" "prebuild" "latest" "/opt/ErsatzTV-ffmpeg" "*-$(arch_resolve "linux64" "linuxarm64")-gpl-7.1.tar.xz"
|
||||||
|
|
||||||
msg_info "Set ErsatzTV-ffmpeg links"
|
msg_info "Set ErsatzTV-ffmpeg links"
|
||||||
chmod +x /opt/ErsatzTV-ffmpeg/bin/*
|
chmod +x /opt/ErsatzTV-ffmpeg/bin/*
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
______ __ __ ___ __
|
||||||
|
/_ __/__ _____/ /___ _/ |/ /___ _/ /____
|
||||||
|
/ / / _ \/ ___/ / __ `/ /|_/ / __ `/ __/ _ \
|
||||||
|
/ / / __(__ ) / /_/ / / / / /_/ / /_/ __/
|
||||||
|
/_/ \___/____/_/\__,_/_/ /_/\__,_/\__/\___/
|
||||||
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
|
# 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/teslamate-org/teslamate
|
||||||
|
|
||||||
|
APP="TeslaMate"
|
||||||
|
var_tags="${var_tags:-car;monitoring}"
|
||||||
|
var_cpu="${var_cpu:-2}"
|
||||||
|
var_ram="${var_ram:-4096}"
|
||||||
|
var_disk="${var_disk:-16}"
|
||||||
|
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 [[ ! -d /opt/teslamate ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if check_for_gh_release "teslamate" "teslamate-org/teslamate"; then
|
||||||
|
msg_info "Stopping Service"
|
||||||
|
systemctl stop teslamate
|
||||||
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "teslamate" "teslamate-org/teslamate" "tarball"
|
||||||
|
|
||||||
|
msg_info "Building TeslaMate (Patience)"
|
||||||
|
cd /opt/teslamate
|
||||||
|
export MIX_ENV=prod
|
||||||
|
$STD mix local.hex --force
|
||||||
|
$STD mix local.rebar --force
|
||||||
|
$STD mix deps.get --only prod
|
||||||
|
$STD npm install --prefix ./assets
|
||||||
|
$STD npm run deploy --prefix ./assets
|
||||||
|
$STD mix do phx.digest, release --overwrite
|
||||||
|
msg_ok "Built TeslaMate"
|
||||||
|
|
||||||
|
msg_info "Starting Service"
|
||||||
|
systemctl start teslamate
|
||||||
|
systemctl restart grafana-server
|
||||||
|
msg_ok "Started Service"
|
||||||
|
msg_ok "Updated successfully!"
|
||||||
|
fi
|
||||||
|
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}:4000${CL}"
|
||||||
|
echo -e "${INFO}${YW}Grafana dashboards (admin/admin):${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
||||||
@@ -15,7 +15,7 @@ update_os
|
|||||||
|
|
||||||
setup_hwaccel
|
setup_hwaccel
|
||||||
fetch_and_deploy_gh_release "ersatztv" "ErsatzTV/ErsatzTV" "prebuild" "latest" "/opt/ErsatzTV" "*linux-$(arch_resolve "x64" "arm64").tar.gz"
|
fetch_and_deploy_gh_release "ersatztv" "ErsatzTV/ErsatzTV" "prebuild" "latest" "/opt/ErsatzTV" "*linux-$(arch_resolve "x64" "arm64").tar.gz"
|
||||||
fetch_and_deploy_gh_release "ersatztv-ffmpeg" "ErsatzTV/ErsatzTV-ffmpeg" "prebuild" "latest" "/opt/ErsatzTV-ffmpeg" "*-$(arch_resolve "linux64" "linuxarm64")-gpl-8.1.tar.xz"
|
fetch_and_deploy_gh_release "ersatztv-ffmpeg" "ErsatzTV/ErsatzTV-ffmpeg" "prebuild" "latest" "/opt/ErsatzTV-ffmpeg" "*-$(arch_resolve "linux64" "linuxarm64")-gpl-7.1.tar.xz"
|
||||||
|
|
||||||
msg_info "Set ErsatzTV-ffmpeg links"
|
msg_info "Set ErsatzTV-ffmpeg links"
|
||||||
chmod +x /opt/ErsatzTV-ffmpeg/bin/*
|
chmod +x /opt/ErsatzTV-ffmpeg/bin/*
|
||||||
|
|||||||
@@ -0,0 +1,183 @@
|
|||||||
|
#!/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/teslamate-org/teslamate
|
||||||
|
|
||||||
|
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 \
|
||||||
|
build-essential \
|
||||||
|
erlang \
|
||||||
|
erlang-dev \
|
||||||
|
erlang-syntax-tools \
|
||||||
|
elixir \
|
||||||
|
mosquitto \
|
||||||
|
locales
|
||||||
|
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
|
||||||
|
$STD locale-gen
|
||||||
|
systemctl enable -q --now mosquitto
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
PG_VERSION="17" setup_postgresql
|
||||||
|
PG_DB_NAME="teslamate" PG_DB_USER="teslamate" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db
|
||||||
|
NODE_VERSION="22" setup_nodejs
|
||||||
|
|
||||||
|
setup_deb822_repo \
|
||||||
|
"grafana" \
|
||||||
|
"https://apt.grafana.com/gpg.key" \
|
||||||
|
"https://apt.grafana.com" \
|
||||||
|
"stable" \
|
||||||
|
"main"
|
||||||
|
|
||||||
|
msg_info "Installing Grafana"
|
||||||
|
$STD apt install -y grafana
|
||||||
|
msg_ok "Installed Grafana"
|
||||||
|
|
||||||
|
fetch_and_deploy_gh_release "teslamate" "teslamate-org/teslamate" "tarball"
|
||||||
|
|
||||||
|
msg_info "Building TeslaMate (Patience)"
|
||||||
|
cd /opt/teslamate
|
||||||
|
export MIX_ENV=prod
|
||||||
|
$STD mix local.hex --force
|
||||||
|
$STD mix local.rebar --force
|
||||||
|
$STD mix deps.get --only prod
|
||||||
|
$STD npm install --prefix ./assets
|
||||||
|
$STD npm run deploy --prefix ./assets
|
||||||
|
$STD mix do phx.digest, release --overwrite
|
||||||
|
msg_ok "Built TeslaMate"
|
||||||
|
|
||||||
|
msg_info "Configuring TeslaMate"
|
||||||
|
cat <<EOF >/opt/teslamate.env
|
||||||
|
HOME=/opt/teslamate
|
||||||
|
LANG=en_US.UTF-8
|
||||||
|
LC_CTYPE=en_US.UTF-8
|
||||||
|
TZ=UTC
|
||||||
|
PORT=4000
|
||||||
|
ENCRYPTION_KEY=$(openssl rand -hex 32)
|
||||||
|
DATABASE_USER=teslamate
|
||||||
|
DATABASE_PASS=${PG_DB_PASS}
|
||||||
|
DATABASE_NAME=teslamate
|
||||||
|
DATABASE_HOST=127.0.0.1
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
MQTT_HOST=127.0.0.1
|
||||||
|
EOF
|
||||||
|
chmod 600 /opt/teslamate.env
|
||||||
|
msg_ok "Configured TeslaMate"
|
||||||
|
|
||||||
|
msg_info "Provisioning Grafana"
|
||||||
|
mkdir -p /etc/grafana/provisioning/{datasources,dashboards}
|
||||||
|
cat <<EOF >/etc/grafana/provisioning/datasources/teslamate.yml
|
||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
datasources:
|
||||||
|
- name: TeslaMate
|
||||||
|
type: postgres
|
||||||
|
url: 127.0.0.1:5432
|
||||||
|
user: teslamate
|
||||||
|
access: proxy
|
||||||
|
isDefault: true
|
||||||
|
secureJsonData:
|
||||||
|
password: ${PG_DB_PASS}
|
||||||
|
jsonData:
|
||||||
|
postgresVersion: 1700
|
||||||
|
sslmode: disable
|
||||||
|
database: teslamate
|
||||||
|
version: 1
|
||||||
|
editable: true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/etc/grafana/provisioning/dashboards/teslamate.yml
|
||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
providers:
|
||||||
|
- name: "teslamate"
|
||||||
|
orgId: 1
|
||||||
|
folder: TeslaMate
|
||||||
|
folderUid: Nr4ofiDZk
|
||||||
|
type: file
|
||||||
|
disableDeletion: false
|
||||||
|
allowUiUpdates: true
|
||||||
|
updateIntervalSeconds: 86400
|
||||||
|
options:
|
||||||
|
path: /opt/teslamate/grafana/dashboards
|
||||||
|
foldersFromFilesStructure: false
|
||||||
|
- name: "teslamate_internal"
|
||||||
|
orgId: 1
|
||||||
|
folder: Internal
|
||||||
|
folderUid: Nr5ofiDZk
|
||||||
|
type: file
|
||||||
|
disableDeletion: false
|
||||||
|
allowUiUpdates: true
|
||||||
|
updateIntervalSeconds: 86400
|
||||||
|
options:
|
||||||
|
path: /opt/teslamate/grafana/dashboards/internal
|
||||||
|
- name: "teslamate_reports"
|
||||||
|
orgId: 1
|
||||||
|
folder: Reports
|
||||||
|
folderUid: Nr6ofiDZk
|
||||||
|
type: file
|
||||||
|
disableDeletion: false
|
||||||
|
allowUiUpdates: true
|
||||||
|
updateIntervalSeconds: 86400
|
||||||
|
options:
|
||||||
|
path: /opt/teslamate/grafana/dashboards/reports
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/etc/grafana/grafana.ini
|
||||||
|
[analytics]
|
||||||
|
reporting_enabled = false
|
||||||
|
check_for_updates = false
|
||||||
|
check_for_plugin_updates = false
|
||||||
|
|
||||||
|
[security]
|
||||||
|
allow_embedding = true
|
||||||
|
disable_gravatar = true
|
||||||
|
|
||||||
|
[users]
|
||||||
|
allow_sign_up = false
|
||||||
|
|
||||||
|
[dashboards]
|
||||||
|
default_home_dashboard_path = /opt/teslamate/grafana/dashboards/internal/home.json
|
||||||
|
|
||||||
|
[date_formats]
|
||||||
|
use_browser_locale = true
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now grafana-server
|
||||||
|
msg_ok "Provisioned Grafana"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
cat <<EOF >/etc/systemd/system/teslamate.service
|
||||||
|
[Unit]
|
||||||
|
Description=TeslaMate
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target postgresql.service mosquitto.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
|
WorkingDirectory=/opt/teslamate
|
||||||
|
EnvironmentFile=/opt/teslamate.env
|
||||||
|
ExecStartPre=/opt/teslamate/_build/prod/rel/teslamate/bin/teslamate eval "TeslaMate.Release.migrate"
|
||||||
|
ExecStart=/opt/teslamate/_build/prod/rel/teslamate/bin/teslamate start
|
||||||
|
ExecStop=/opt/teslamate/_build/prod/rel/teslamate/bin/teslamate stop
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now teslamate
|
||||||
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
cleanup_lxc
|
||||||
Reference in New Issue
Block a user