From 2d0dcf524d1b89d1aeccc5fb8552faf2869446d3 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 14 Jul 2021 07:59:44 -0700 Subject: [PATCH] Update Almond to 2.0.0 (#2042) Co-authored-by: Franck Nijhof --- almond/CHANGELOG.md | 136 ++++++++++++---------- almond/DOCS.md | 7 +- almond/Dockerfile | 88 +++++++++----- almond/README.md | 14 ++- almond/build.json | 10 +- almond/config.json | 9 +- almond/rootfs/etc/almond/default-prefs.db | 7 ++ almond/rootfs/etc/cont-init.d/almond.sh | 14 --- almond/rootfs/etc/nginx/nginx.conf | 2 - almond/rootfs/etc/services.d/almond/run | 5 + 10 files changed, 168 insertions(+), 124 deletions(-) create mode 100644 almond/rootfs/etc/almond/default-prefs.db delete mode 100644 almond/rootfs/etc/cont-init.d/almond.sh diff --git a/almond/CHANGELOG.md b/almond/CHANGELOG.md index 4c9143fa76c..9a42463789e 100644 --- a/almond/CHANGELOG.md +++ b/almond/CHANGELOG.md @@ -1,62 +1,74 @@ -# Changelog - -## 1.1.2 - -- Revert restart nginx service on error - -## 1.1.1 - -- Fix issue with some Almond packages - -## 1.1.0 - -- Restart nginx service on error -- Use Alpine 3.13 - -## 1.0.1 - -- Keep unzip dependency installed - -## 1.0.0 - -- Update Almond to 1.8.0 -- Rewrite onto S6 overlay -- Reduce add-on image size -- Updates Supervisor API token and endpoint - -## 0.9 - -- Update Almond to 1.7.3 - -## 0.8 - -- Update Almond to 1.7.2 - -## 0.7 - -- Change startup type to Application - -## 0.6 - -- Fix issue with restart / Hass.io token handling - -## 0.5 - -- Update Almond to 1.7.1 - -## 0.4 - -- Update Almond to 1.7.0 - -## 0.3 - -- Add automatic Almond setup - -## 0.2 - -- Add Ingress -- Update almond to 1.6.0 - -## 0.1 - -- Initial version +# Changelog + +## 2.0.0 + +- Almond was updated to 2.0.0: this is a major release that + brings significant changes to the supported skills. Additional + details are in the release notes: https://wiki.almond.stanford.edu/en/release-planning/two-point-oh + All users are encouraged to upgrade as soon as possible, because + the previous release line is unmaintained and unsupported. Cloud + services that Almond relies on might drop compatibility with + Almond 1.* at some point in the future. +- Voice support is now included in this addon, and the Ada add-on + is not required (in fact, it should not be enabled at the same time). + +## 1.1.2 + +- Revert restart nginx service on error + +## 1.1.1 + +- Fix issue with some Almond packages + +## 1.1.0 + +- Restart nginx service on error +- Use Alpine 3.13 + +## 1.0.1 + +- Keep unzip dependency installed + +## 1.0.0 + +- Update Almond to 1.8.0 +- Rewrite onto S6 overlay +- Reduce add-on image size +- Updates Supervisor API token and endpoint + +## 0.9 + +- Update Almond to 1.7.3 + +## 0.8 + +- Update Almond to 1.7.2 + +## 0.7 + +- Change startup type to Application + +## 0.6 + +- Fix issue with restart / Hass.io token handling + +## 0.5 + +- Update Almond to 1.7.1 + +## 0.4 + +- Update Almond to 1.7.0 + +## 0.3 + +- Add automatic Almond setup + +## 0.2 + +- Add Ingress +- Update almond to 1.6.0 + +## 0.1 + +- Initial version diff --git a/almond/DOCS.md b/almond/DOCS.md index 2fbcf21800f..20caab3b2fe 100644 --- a/almond/DOCS.md +++ b/almond/DOCS.md @@ -29,7 +29,9 @@ You have several options to get them answered: - The [Home Assistant Discord Chat Server][discord]. - The Home Assistant [Community Forum][forum]. -- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]. +- The [Almond Discord Chat Server][discordalmond]. +- The Almond [Community Forum][forumalmond]. In case you've found a bug, please [open an issue on our GitHub][issue]. @@ -37,4 +39,5 @@ In case you've found a bug, please [open an issue on our GitHub][issue]. [forum]: https://community.home-assistant.io [issue]: https://github.com/home-assistant/hassio-addons/issues [reddit]: https://reddit.com/r/homeassistant -[repository]: https://github.com/hassio-addons/repository +[discordalmond]: https://discord.gg/anthtR4 +[forumalmond]: https://community.almond.stanford.edu diff --git a/almond/Dockerfile b/almond/Dockerfile index d7aea58afa0..69679f70dd1 100644 --- a/almond/Dockerfile +++ b/almond/Dockerfile @@ -5,50 +5,73 @@ FROM ${BUILD_FROM} ENV \ LANG="en_US.utf8" \ THINGENGINE_HOME="/data/almond-server" \ - THINGENGINE_HOST_BASED_AUTHENTICATION="local-ip" + THINGENGINE_HAS_REVERSE_PROXY=true \ + THINGENGINE_HOST_BASED_AUTHENTICATION=insecure \ + THINGENGINE_IN_HOME_ASSISTANT_ADDON=true WORKDIR /opt/almond ARG ALMOND_VERSION RUN \ set -x \ - && apk add --no-cache \ - nodejs \ - npm \ - yarn \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + libcanberra-dev \ + libcanberra0 \ + libpulse-dev \ + libatlas-base-dev \ + libatlas3-base \ + pkg-config \ + ca-certificates \ + git \ + gnupg \ nginx \ + python-dev \ + software-properties-common \ unzip \ - blas \ sqlite \ coreutils \ - && apk add --no-cache --virtual .build-dependencies \ - build-base \ - blas-dev \ - git \ - linux-headers \ - sqlite-dev \ - pkgconf \ - python3 \ + pulseaudio \ + pulseaudio-utils \ + gettext \ + zip \ + wget \ + gstreamer1.0-plugins-base-apps \ + gstreamer1.0-plugins-good \ + gstreamer1.0-pulseaudio \ \ - && npm config set unsafe-perm \ - && ln -s /usr/bin/python3 /usr/bin/python \ + && curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key \ + | apt-key add - \ + && echo "deb https://deb.nodesource.com/node_12.x buster main" \ + > /etc/apt/sources.list.d/nodesource.list \ \ - && git clone -b "${ALMOND_VERSION}" --depth 1 \ - "https://github.com/stanford-oval/almond-server" . \ - && rm -fr .git \ - && yarn \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + nodejs \ + \ + && npm config set unsafe-perm \ \ - && yarn global add modclean \ - && modclean \ - --path /opt/almond \ - --no-progress \ - --keep-empty \ - --run \ - && yarn global remove modclean \ + && git clone -b "${ALMOND_VERSION}" --depth 1 https://github.com/stanford-oval/almond-server . \ + && npm ci \ + && npm install --no-package-lock --ignore-scripts snowboy@1.3.1 \ + && cd node_modules/snowboy/ \ + && PYTHON=python2 npx node-pre-gyp clean configure \ + && make -C build/ \ + && rm -fr /root/.cache \ + && rm -fr /root/.npm \ + && mkdir /root/.cache \ \ - && yarn cache clean \ - && apk del --no-cache \ - .build-dependencies \ + && apt-get purge -y --auto-remove \ + build-essential \ + libcanberra-dev \ + libpulse-dev \ + libatlas-base-dev \ + pkg-config \ + git \ + gnupg \ + python-dev \ + software-properties-common \ \ && rm -rf \ /opt/almond/.[!.]* \ @@ -57,6 +80,9 @@ RUN \ /tmp/.[!.]* \ /tmp/* \ /usr/local/share/.cache \ - /usr/local/share/.config + /usr/local/share/.config \ + /usr/lib/nginx \ + /var/lib/apt/lists/* \ + /var/www COPY rootfs / diff --git a/almond/README.md b/almond/README.md index a6cb9f2b4de..729c9ec366f 100644 --- a/almond/README.md +++ b/almond/README.md @@ -1,10 +1,20 @@ # Home Assistant Add-on: Almond -[Almond] For Home Servers. +The Open-source, Privacy-Preserving Voice Assistant. ![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield] -The Open, Privacy-Preserving Virtual Assistant. +[Almond] provides a complete solution to turn your Home Assistant +into a smart speaker. It supports playing music, controlling your +IoT, checking the weather, and other simple questions. + +To use Almond as a voice assistant, you should connect a microphone and speaker to the +device where Home Assistant is installed. + +**Note**: since version 2.0.0 of the add-on, the use of the separate +Ada add-on is not required. Almond includes built-in voice capabilities, +using the wake-word "computer". It is recommended to avoid using Ada +with Almond >= 2.0.0. [Almond]: https://almond.stanford.edu/ [aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg diff --git a/almond/build.json b/almond/build.json index 1818b2f746c..b8280df7bc5 100644 --- a/almond/build.json +++ b/almond/build.json @@ -1,12 +1,10 @@ { "build_from": { - "aarch64": "homeassistant/aarch64-base:3.13", - "amd64": "homeassistant/amd64-base:3.13", - "i386": "homeassistant/i386-base:3.13", - "armv7": "homeassistant/armv7-base:3.13", - "armhf": "homeassistant/armhf-base:3.13" + "aarch64": "homeassistant/aarch64-base-debian:buster", + "amd64": "homeassistant/amd64-base-debian:buster", + "armv7": "homeassistant/armv7-base-debian:buster" }, "args": { - "ALMOND_VERSION": "v1.8.0" + "ALMOND_VERSION": "v2.0.1" } } diff --git a/almond/config.json b/almond/config.json index 55c0851a0f9..4e70c665a2b 100644 --- a/almond/config.json +++ b/almond/config.json @@ -1,17 +1,16 @@ { "name": "Almond", - "version": "1.1.2", + "version": "2.0.0", "slug": "almond", - "description": "The home server version of Almond", + "description": "The open-source, privacy-preserving voice assistant", "url": "https://github.com/home-assistant/hassio-addons/blob/master/almond", - "arch": ["armv7", "armhf", "aarch64", "amd64", "i386"], + "arch": ["armv7", "aarch64", "amd64"], "init": false, "discovery": ["almond"], "ingress": true, + "audio": true, "panel_icon": "mdi:comment-eye-outline", "homeassistant": "0.102.0", "homeassistant_api": true, - "options": {}, - "schema": {}, "image": "homeassistant/{arch}-addon-almond" } diff --git a/almond/rootfs/etc/almond/default-prefs.db b/almond/rootfs/etc/almond/default-prefs.db new file mode 100644 index 00000000000..ba94f517928 --- /dev/null +++ b/almond/rootfs/etc/almond/default-prefs.db @@ -0,0 +1,7 @@ +{ + "server-login": { + "password":"x", + "salt":"x", + "sqliteKeySalt":"x" + } +} diff --git a/almond/rootfs/etc/cont-init.d/almond.sh b/almond/rootfs/etc/cont-init.d/almond.sh deleted file mode 100644 index 640897f3dd9..00000000000 --- a/almond/rootfs/etc/cont-init.d/almond.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/with-contenv bashio -# ============================================================================== -# Prepare the Almond service for running -# ============================================================================== -readonly PREFS_DB="${THINGENGINE_HOME}/prefs.db" - -if ! bashio::fs.file_exists "${PREFS_DB}"; then - # Ensure Thing Engine home directory exists - mkdir -p "${THINGENGINE_HOME}" - - # Skip authentication handling - echo '{"server-login":{"password":"x","salt":"x","sqliteKeySalt":"x"}}' \ - > "${PREFS_DB}" -fi diff --git a/almond/rootfs/etc/nginx/nginx.conf b/almond/rootfs/etc/nginx/nginx.conf index 281d9216280..fc2709cb137 100644 --- a/almond/rootfs/etc/nginx/nginx.conf +++ b/almond/rootfs/etc/nginx/nginx.conf @@ -52,8 +52,6 @@ http { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; - proxy_set_header Host "127.0.0.1:3000"; - proxy_set_header Origin "http://127.0.0.1:3000"; } } } diff --git a/almond/rootfs/etc/services.d/almond/run b/almond/rootfs/etc/services.d/almond/run index ac4906cf13b..0888d11d087 100644 --- a/almond/rootfs/etc/services.d/almond/run +++ b/almond/rootfs/etc/services.d/almond/run @@ -7,6 +7,11 @@ export THINGENGINE_BASE_URL # Set the Ingress URL as Almond base URL for correct handling THINGENGINE_BASE_URL=$(bashio::addon.ingress_entry) +mkdir -p /data/almond-server +if [ ! -f /data/almond-server/prefs.db ]; then + cp /etc/almond/default-prefs.db /data/almond-server/prefs.db +fi + # Send out discovery information to Home Assistant ./discovery &