Compare commits

..

3 Commits

Author SHA1 Message Date
tteckster f8c38b8177
Add AppDaemon install to HA Core script (#1167) (#1168)
Co-authored-by: Sergio Rius
2023-03-15 09:45:06 -04:00
tteckster aee311706e
Update clean-lxcs.sh
skip non Debian/Ubuntu containers
2023-03-14 08:01:43 -04:00
tteckster ea7d5ae514
Update vaultwarden-v5.sh
recommend 4vCPU & 4096MiB RAM minimum for update
2023-03-13 03:42:02 -04:00
3 changed files with 83 additions and 3 deletions

View File

@ -356,10 +356,11 @@ header_info
function update_script() {
PY=$(ls /srv/homeassistant/lib/)
IP=$(hostname -I | awk '{print $1}')
UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \
UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \
"1" "Update Core" ON \
"2" "Install HACS" OFF \
"3" "Install FileBrowser" OFF \
"4" "Install/Update AppDaemon" OFF \
3>&1 1>&2 2>&3)
header_info
if [ "$UPD" == "1" ]; then
@ -431,6 +432,78 @@ echo -e "FileBrowser should be reachable by going to the following URL.
${BL}http://$IP:8080${CL} admin|changeme\n"
exit
fi
if [ "$UPD" == "4" ]; then
clear
header_info
if [[ ! -d /srv/appdaemon ]]; then
msg_info "Installing AppDaemon"
mkdir /srv/appdaemon
cd /srv/appdaemon
python3 -m venv .
source bin/activate
pip install appdaemon &>/dev/null
mkdir -p /root/.homeassistant/appdaemon/apps
cat > /root/.homeassistant/appdaemon/appdaemon.yaml << EOF
# Sample appdaemon.yml file
# For configuration, please visit: https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html
appdaemon:
time_zone: CET
latitude: 51.725
longitude: 14.3434
elevation: 0
plugins:
HASS:
type: hass
ha_url: <home_assistant_base_url>
token: <some_long_lived_access_token>
http:
url: http://127.0.0.1:5050
admin:
api:
EOF
msg_ok "Installed AppDaemon"
msg_info "Creating Service"
cat > /etc/systemd/system/appdaemon.service << EOF
[Unit]
Description=AppDaemon
After=homeassistant.service
Requires=homeassistant.service
[Service]
Type=simple
WorkingDirectory=/root/.homeassistant/appdaemon
ExecStart=/srv/appdaemon/bin/appdaemon -c "/root/.homeassistant/appdaemon"
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now appdaemon &>/dev/null
msg_ok "Created Service"
msg_ok "Completed Successfully!\n"
echo -e "AppDaemon should be reachable by going to the following URL.
${BL}http://$IP:5050${CL}\n"
exit
else
msg_info "Upgrading AppDaemon"
msg_info "Stopping AppDaemon"
systemctl stop appdaemon
msg_ok "Stopped AppDaemon"
msg_info "Updating AppDaemon"
source /srv/appdaemon/bin/activate
pip install --upgrade appdaemon &>/dev/null
msg_ok "Updated AppDaemon"
msg_info "Starting AppDaemon"
systemctl start appdaemon
sleep 2
msg_ok "Started AppDaemon"
msg_ok "Update Successful"
echo -e "\n Go to http://${IP}:5050 \n"
exit
fi
fi
}
if command -v pveversion >/dev/null 2>&1; then

View File

@ -367,7 +367,7 @@ UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spaceb
header_info
if [ "$UPD" == "1" ]; then
echo -e "\n ⚠️ Ensure you set 2vCPU & 3072MiB RAM MIMIMUM!!! \n"
echo -e "\n ⚠️ Ensure you set 4vCPU & 4096MiB RAM minimum!!! \n"
msg_info "Stopping Vaultwarden"
systemctl stop vaultwarden.service
msg_ok "Stopped Vaultwarden"

View File

@ -5,7 +5,7 @@
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
function header_info() {
clear
cat <<"EOF"
________ __ _ ________
@ -44,6 +44,13 @@ function clean_container() {
}
for container in $containers; do
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
if [ "$os" != "debian" ] && [ "$os" != "ubuntu" ]; then
header_info
echo -e "${BL}[Info]${GN} Skipping ${name} ${RD}$container is not Debian or Ubuntu ${CL} \n"
sleep 1
continue
fi
status=$(pct status $container)
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then