This repository builds the danielriedl/truenas-scale-restart-app Docker Image.
It can be used to restart TrueNAS Scale Applications from anywhere, as it uses midclt from here.
These instructions will cover usage information and for the docker container
In order to run this container you'll need TrueNAS Scale installed.
docker run -it --rm danielriedl/truenas-scale-restart-app -h
usage: app.py [-h] [-s SERVICE_ID] [--start-api | --no-start-api] [-u URI] [-U USERNAME] [-P PASSWORD]
optional arguments:
-h, --help show this help message and exit
-s SERVICE_ID, --service-id SERVICE_ID
The service ID to restart
--start-api, --no-start-api
-u URI, --uri URI
-U USERNAME, --username USERNAME
-P PASSWORD, --password PASSWORDdocker run -it --rm danielriedl/truenas-scale-restart-app \
-s my-scale-app \
-u ws://10.0.1.6:8080/websocket \
-U root \
-P MySecret
INFO:root:Will scale service my-scale-app to 0.
INFO:root:Created scale job 8296
INFO:root:Waiting for Job 8296 to finish
[... SNIP]
INFO:root:Waiting for Job 8296 to finish
INFO:root:Job 8296 succeeded
INFO:root:Will scale service my-scale-app to 1.
INFO:root:Created scale job 8301
INFO:root:Waiting for Job 8301 to finish
INFO:root:Job 8301 succeeded
INFO:root:Guess it worked, as this is the end of the script.The application offers an Flask API. Start it with:
docker run -it --rm -p 8080:8080 danielriedl/truenas-scale-restart-app --start-apiDo a POST request to /restart do the same thing as above:
{
"uri": "ws://10.0.1.6:8080/websocket",
"username": "root",
"password": "MySecret",
"service_id": "my-scale-app"
}- Go to
/ui/appsand click top right onLaunch Docker Image - (1) Application Name - Set
Application Nametorestart-app - (2) Container Images - Set
Image repositorytodanielriedl/truenas-scale-restart-app - (3) Configure Entrypoint - Set
Configure Container Argsto--start-api - (6) Port Forwarding - Add one Rule to forward
Container Portof8080to your desiredNode Porte.g10011 - (13) Confirm Options - Click on Save
Now you can use the API from other TrueNAS Scale apps with following URL:
http://restart-app-ix-chart.ix-restart-app.svc.cluster.local:8080/restart
Or from somewhere else
http://ip-of-system:10011/restart
So I made a mistake and was setting up home-assistant for my dad.
Kind of funny architecture, as I use the wireguard addon of the home-assistant chart to connect to his FritzBox VPN.
As our ISP decides randomly, when to assign new IPv4 Adresses to private households the connection drops from both sides,
resulting in a call from Dad Dan wtf nothing works.
So the goal was to restart the whole home-assistant TrueNAS Scale App of his installation, to reconnect everything.
This was approached by a simple node-red flow:
If certain entities are unavailable for 5 minutes trigger the /restart API endpoint.
Since then - no calls (atleast those where he's reporting network problems).
- Dan Riedl - Initial work - danriedl
Everything relys on a forum thread I found while searching for solutions.
So kudos to MVP kiler129