# Gleanvolt on a home NAS (issue #327): the controller and its web UI, nothing else -- what # deploy/README.md deploys on a Pi, in a form that a NAS's own container UI can take as it is. Synology Container # Manager ("Project"), QNAP Container Station ("Application"), Unraid's Compose Manager, TrueNAS SCALE # ("Install via YAML"), Portainer and plain `docker compose up -d` all accept this file unchanged. # docs/NAS.md walks through each of them. # # Nothing below has to be edited to get a running setup wizard. Three things are worth a look first: # # TZ your time zone. A NAS container runs in UTC unless told otherwise, and a site on UTC # files every charging session against the wrong day. # GLEANVOLT_DIR where the data lives. The default, ".", is the folder this file is in -- right for # Synology, which keeps a project in a folder you choose on a share, and for plain # `docker compose`. On QNAP, Unraid and TrueNAS set it to an absolute path on your # storage (/share/Container/gleanvolt, /mnt/user/appdata/gleanvolt, # /mnt/tank/apps/gleanvolt), because there "." is somewhere else. # WEB_PORT 8090 unless something else on the NAS already has it. # # Each can be set in an .env file beside this one, in the NAS UI's environment-variable list, or by # editing the default after ":-" directly. Everything else in deploy/.env.example works here the same # way, as an extra line under `environment:`. # # The data directory holds the charging-session and energy databases, the settings saved in the web UI # and the car-account sessions and keys, which are bearer secrets (README's "The data directory holds # secrets"). Put it on a share that is backed up, and that only you can read. name: gleanvolt services: # Runs once, as root, before the controller and exits. The controller runs as uid 1654, not root, and # a directory Docker creates for a bind mount -- or one made in a NAS file manager -- belongs to root # or to the NAS user, so the controller could not write to it. On the Pi the deploy scripts chown it # over ssh; on a NAS there is no such step, so the stack does it itself. It touches only these two # directories, and a restart or an image update runs it again harmlessly. gleanvolt-init: image: busybox:1.37 container_name: gleanvolt-init user: "0:0" # The plugins' directories too (#426, #444), closed to everyone else: they hold an API key, a charger's password. command: ["sh", "-c", "chown -R 1654:1654 /data /logs /plugins && chmod 700 /plugins/*"] volumes: - ${GLEANVOLT_DIR:-.}/data:/data - ${GLEANVOLT_DIR:-.}/logs:/logs - ${GLEANVOLT_DIR:-.}/plugins/openweather:/plugins/openweather - ${GLEANVOLT_DIR:-.}/plugins/solax:/plugins/solax - ${GLEANVOLT_DIR:-.}/plugins/huawei:/plugins/huawei - ${GLEANVOLT_DIR:-.}/plugins/goe:/plugins/goe - ${GLEANVOLT_DIR:-.}/plugins/shelly:/plugins/shelly restart: "no" network_mode: none gleanvolt-controller: image: ghcr.io/mpospisil/gleanvolt:${IMAGE_TAG:-latest} container_name: gleanvolt-controller # `on-failure`, not `unless-stopped` or `always` -- a NAS UI's usual default. The controller exits # 0 when asked to stop from the web UI and must then stay stopped; a restart from Settings exits 75, # a crash or a NAS reboot anything else, and all of those bring it back. docker-compose.yml explains # the exit codes. restart: on-failure # A real PID 1 (Docker's tini) in front of the worker. The worker as PID 1 ignores the signals a # crashing .NET process ends itself with, so a crash at startup left the container up and doing # nothing, and the restart policy never saw it end (#396). With an init it exits, and comes back. init: true # The host's network, not a bridge. The setup wizard's device search scans the network it finds # itself on, and in a bridge that is Docker's 172.x network rather than your LAN. The web UI then # binds the NAS's own WEB_PORT; there is nothing to publish. network_mode: host # Long enough for a stop to release the charger before Docker kills the container. stop_grace_period: 60s depends_on: gleanvolt-init: condition: service_completed_successfully environment: TZ: ${TZ:-Europe/Prague} Web__Port: ${WEB_PORT:-8090} # Optional: the setup wizard finds and asks for it. Setting it here only saves it the asking. The charger is # its plugin's (#445), below, at EV_CHARGER_HOST: the controller never opens a connection to it. Pv__Inverter__Host: ${INVERTER_HOST:-} volumes: - ${GLEANVOLT_DIR:-.}/data:/app/data - ${GLEANVOLT_DIR:-.}/logs:/app/logs # A ceiling, not a reservation: the controller uses about 75 MB. mem_limit: ${CONTROLLER_MEM_LIMIT:-512m} logging: driver: json-file options: max-size: "10m" max-file: "3" # The OpenWeather plugin (#424, #426): the weather, with "External" chosen under Settings -> Weather. # Opt-in: it starts only with the `openweather` profile (`docker compose --profile openweather up -d`, # or COMPOSE_PROFILES=openweather where the NAS UI takes environment variables) and with # GLEANVOLT_PROVIDER_TOKEN set to the token from Settings -> External providers. docs/NAS.md has it. gleanvolt-plugin-openweather: image: ghcr.io/mpospisil/gleanvolt-plugin-openweather:${IMAGE_TAG:-latest} container_name: gleanvolt-plugin-openweather restart: unless-stopped profiles: ["openweather"] init: true # On the host's network like the controller: it reaches Gleanvolt on localhost, and Gleanvolt sends # the browser to its page under the name the browser opened Gleanvolt at. network_mode: host depends_on: gleanvolt-init: condition: service_completed_successfully environment: TZ: ${TZ:-Europe/Prague} Urls: http://0.0.0.0:${OPENWEATHER_PORT:-8096} Gleanvolt__Endpoint: http://localhost:${WEB_PORT:-8090} Gleanvolt__Token: ${GLEANVOLT_PROVIDER_TOKEN:-} Gleanvolt__PageUrl: http://localhost:${OPENWEATHER_PORT:-8096}/ volumes: - ${GLEANVOLT_DIR:-.}/plugins/openweather:/data mem_limit: ${OPENWEATHER_MEM_LIMIT:-160m} logging: driver: json-file options: max-size: "5m" max-file: "3" # The solax charger plugin (#444): SolaX X1/X3-HAC and X1/X3-EVC, from gleanvolt-chargers. Opt-in with the `solax` profile; at most one charger # plugin. It is how the controller reaches the charger (#445). The charger's address is EV_CHARGER_HOST. gleanvolt-plugin-solax: image: ghcr.io/mpospisil/gleanvolt-plugin-solax:${SOLAX_PLUGIN_TAG:-latest} container_name: gleanvolt-plugin-solax restart: unless-stopped profiles: ["solax"] init: true network_mode: host depends_on: gleanvolt-init: condition: service_completed_successfully environment: TZ: ${TZ:-Europe/Prague} Urls: http://0.0.0.0:${SOLAX_PORT:-8098} Gleanvolt__Endpoint: http://localhost:${WEB_PORT:-8090} Gleanvolt__Token: ${GLEANVOLT_PROVIDER_TOKEN:-} Gleanvolt__PageUrl: http://localhost:${SOLAX_PORT:-8098}/ Solax__Host: ${EV_CHARGER_HOST:-} volumes: - ${GLEANVOLT_DIR:-.}/plugins/solax:/data mem_limit: ${SOLAX_MEM_LIMIT:-160m} logging: driver: json-file options: max-size: "5m" max-file: "3" # The huawei charger plugin (#444): Huawei SCharger-7KS-S0 and -22KT-S0, from gleanvolt-chargers. Opt-in with the `huawei` profile; at most one charger # plugin. It is how the controller reaches the charger (#445). The charger's address is EV_CHARGER_HOST. gleanvolt-plugin-huawei: image: ghcr.io/mpospisil/gleanvolt-plugin-huawei:${HUAWEI_PLUGIN_TAG:-latest} container_name: gleanvolt-plugin-huawei restart: unless-stopped profiles: ["huawei"] init: true network_mode: host depends_on: gleanvolt-init: condition: service_completed_successfully environment: TZ: ${TZ:-Europe/Prague} Urls: http://0.0.0.0:${HUAWEI_PORT:-8099} Gleanvolt__Endpoint: http://localhost:${WEB_PORT:-8090} Gleanvolt__Token: ${GLEANVOLT_PROVIDER_TOKEN:-} Gleanvolt__PageUrl: http://localhost:${HUAWEI_PORT:-8099}/ Huawei__Host: ${EV_CHARGER_HOST:-} volumes: - ${GLEANVOLT_DIR:-.}/plugins/huawei:/data mem_limit: ${HUAWEI_MEM_LIMIT:-160m} logging: driver: json-file options: max-size: "5m" max-file: "3" # The goe charger plugin (#444): the go-e Charger, from gleanvolt-chargers. Opt-in with the `goe` profile; at most one charger # plugin. It is how the controller reaches the charger (#445). The charger's address is EV_CHARGER_HOST. gleanvolt-plugin-goe: image: ghcr.io/mpospisil/gleanvolt-plugin-goe:${GOE_PLUGIN_TAG:-latest} container_name: gleanvolt-plugin-goe restart: unless-stopped profiles: ["goe"] init: true network_mode: host depends_on: gleanvolt-init: condition: service_completed_successfully environment: TZ: ${TZ:-Europe/Prague} Urls: http://0.0.0.0:${GOE_PORT:-8100} Gleanvolt__Endpoint: http://localhost:${WEB_PORT:-8090} Gleanvolt__Token: ${GLEANVOLT_PROVIDER_TOKEN:-} Gleanvolt__PageUrl: http://localhost:${GOE_PORT:-8100}/ Goe__Host: ${EV_CHARGER_HOST:-} volumes: - ${GLEANVOLT_DIR:-.}/plugins/goe:/data mem_limit: ${GOE_MEM_LIMIT:-160m} logging: driver: json-file options: max-size: "5m" max-file: "3" # The shelly charger plugin (#444): the Shelly TopAC, from gleanvolt-chargers. Opt-in with the `shelly` profile; at most one charger # plugin. It is how the controller reaches the charger (#445). The charger's address is EV_CHARGER_HOST. gleanvolt-plugin-shelly: image: ghcr.io/mpospisil/gleanvolt-plugin-shelly:${SHELLY_PLUGIN_TAG:-latest} container_name: gleanvolt-plugin-shelly restart: unless-stopped profiles: ["shelly"] init: true network_mode: host depends_on: gleanvolt-init: condition: service_completed_successfully environment: TZ: ${TZ:-Europe/Prague} Urls: http://0.0.0.0:${SHELLY_PORT:-8097} Gleanvolt__Endpoint: http://localhost:${WEB_PORT:-8090} Gleanvolt__Token: ${GLEANVOLT_PROVIDER_TOKEN:-} Gleanvolt__PageUrl: http://localhost:${SHELLY_PORT:-8097}/ Shelly__Host: ${EV_CHARGER_HOST:-} volumes: - ${GLEANVOLT_DIR:-.}/plugins/shelly:/data mem_limit: ${SHELLY_MEM_LIMIT:-160m} logging: driver: json-file options: max-size: "5m" max-file: "3"