ESPHome Auto-Restart Script
Introduction Running various services at home can be a great convenience, but it’s incredibly frustrating when the network goes down and you’re not there to restart everything. I’ve …
Docker is a great lightweight container system for running applications on your home server. I run it on my Synology DS918+, which stores all our backups and runs most of the services for our home network.
InfluxDB is a great lightweight time-series database that’s ideal for monitoring other value-based systems. I feed all of our home automation data, the data I scrape from our utility meters, and our network SNMP data into this system, which I can then use to report on.
First, start by making a folder to store the data. I put mine in
Next, SSH into your Synology and then run the following command:
docker run \ --name=influxdb2 \ --hostname=influxdb2 \ --env="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ --env="GOSU_VER=1.12" \ --env="INFLUXDB_VERSION=2.0.7" \ --env="INFLUX_CONFIGS_PATH=/etc/influxdb2/influx-configs" \ --env="INFLUXD_INIT_PORT=9999" \ --env="INFLUXD_INIT_PING_ATTEMPTS=600" \ --volume="/volume1/docker/influxdb2:/var/lib/influxdb2:rw" \ --volume="/etc/influxdb2" \ --volume="/var/lib/influxdb2" \ --network=bridge -p 0.0.0.0:8086:8086 \ --restart=always \ --detach=true \ -t \ influxdb:2.0.7-alpine \ influxd
This is pretty routine. It’ll download the docker image, spin it up (storing the data in
/volume1/docker/influxdb2) and make port 8086 to your internal network. This presumes that your Synology is not accessible to the internet at large.
Now you can visit http://your.ip.address:8086 in a browser to complete the setup. It’ll show you a screen like this:
I created a user called
admin and set my organization to
pshome. Your default bucket doesn’t matter much.
Once you are in, you can explore the default configuration and use the web interface to make additional users.