This repository contains a Home Assistant instance with an MQTT broker as well as a Postgres database.
Make sure that the nginx reverse proxy is already set up and started.
Clone the code to your server:
git clone [email protected]:hueske-digital/services/smarthome.git ~/services/smarthome
Create environment file and fill up with your values:
cd ~/services/smarthome && cp .env.example .env && vim .env
Pull images and start the docker compose file:
docker compose up -d
Add some configuration to Home Assistant:
docker compose exec app /bin/sh -c 'vi /config/configuration.yaml'
http:
use_x_forwarded_for: true
trusted_proxies:
- 172.16.0.0/12
recorder:
purge_keep_days: 14
commit_interval: 5
db_url: !env_var DATABASE_URL
Recreate all container to get things ready:
docker compose up -d --force-recreate
While waiting you can create a host in your nginx proxy manager which points to smarthome-app-1
with port 8123
and websockets enabled. Some other vhost should redirect to smarthome-bridge-1
with port 8080
and those for the config editor to smarthome-editor-1
and port 8443
. The mqtt broker can be used by adding host broker
on port 1883
in the Home Assistant integration.
If you want to make your broker available in your network start the container with
docker compose -f docker-compose.yml -f docker-compose.publicbroker.yml up -d
This repository ships with ESPHome. You can start it by adding the docker-compose.esphome.yml
when starting:
docker compose -f docker-compose.yml -f docker-compose.esphome.yml up -d
Add a host in the reverse proxy pointing to smarthome-esphome-1
on port 6052
.
Update all container images and recreate them if new images are available:
docker compose pull && docker compose up -d
Restart a single container:
docker compose restart app
Shutdown all container of this compose file:
docker compose down
Show and follow logs:
docker compose logs -ft
Additional configuration:
You can include any other docker config by using an additional compose file.