Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Almond to 2.0.0 #2042

Merged
merged 15 commits into from
Jul 14, 2021
132 changes: 70 additions & 62 deletions almond/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,70 @@
# 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-1

- 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
- 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).
gcampax marked this conversation as resolved.
Show resolved Hide resolved

## 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
13 changes: 5 additions & 8 deletions almond/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ Got questions?

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]
- The [Almond Discord Chat Server][discord].
- The Almond [Community Forum][forum].

In case you've found a bug, please [open an issue on our GitHub][issue].

[discord]: https://discord.gg/c5DvZ4e
[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
[discord]: https://discord.gg/anthtR4
[forum]: https://community.almond.stanford.edu
[issue]: https://github.com/stanford-oval/almond-server/issues
frenck marked this conversation as resolved.
Show resolved Hide resolved
92 changes: 61 additions & 31 deletions almond/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,77 @@ 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

WORKDIR /opt/almond
ARG ALMOND_VERSION

RUN adduser --disabled-password almond && \
chown almond:almond /opt/almond
gcampax marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /opt/almond

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 \
sudo \
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 \
\
&& yarn global add modclean \
&& modclean \
--path /opt/almond \
--no-progress \
--keep-empty \
--run \
&& yarn global remove modclean \
&& npm config set unsafe-perm \
\
&& yarn cache clean \
&& apk del --no-cache \
.build-dependencies \
&& sudo -u almond git clone -b "${ALMOND_VERSION}" --depth 1 \
"https://github.com/stanford-oval/almond-server" . && \
sudo -u almond npm ci && \
gcampax marked this conversation as resolved.
Show resolved Hide resolved
sudo -u almond npm install --no-package-lock --ignore-scripts snowboy && \
cd node_modules/snowboy/ && \
sudo -u almond PYTHON=python2 npx node-pre-gyp clean configure && \
sudo -u almond make -C build/ && \
rm -fr /home/almond/.cache && \
rm -fr /home/almond/.npm && \
mkdir /home/almond/.cache \
&& apt-get purge -y --auto-remove \
gcampax marked this conversation as resolved.
Show resolved Hide resolved
build-essential \
libcanberra-dev \
libpulse-dev \
libatlas-base-dev \
pkg-config \
git \
gnupg \
python-dev \
software-properties-common \
\
&& rm -rf \
/opt/almond/.[!.]* \
Expand All @@ -57,6 +84,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 /
9 changes: 7 additions & 2 deletions almond/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Home Assistant Add-on: Almond

[Almond] For Home Servers.
## The Open-source, Privacy-Preserving Voice Assistant.
gcampax marked this conversation as resolved.
Show resolved Hide resolved

![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
IoTs, checking the weather, and other simple questions.
gcampax marked this conversation as resolved.
Show resolved Hide resolved

To use Almond, you should connect a microphone and speaker to the
gcampax marked this conversation as resolved.
Show resolved Hide resolved
device where Home Assistant is installed.

[Almond]: https://almond.stanford.edu/
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
Expand Down
11 changes: 5 additions & 6 deletions almond/build.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"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",
"armhf": "homeassistant/armhf-base-debian:buster",
gcampax marked this conversation as resolved.
Show resolved Hide resolved
"armv7": "homeassistant/armv7-base-debian:buster"
frenck marked this conversation as resolved.
Show resolved Hide resolved
},
"args": {
"ALMOND_VERSION": "v1.8.0"
"ALMOND_VERSION": "v2.0.0"
}
}
13 changes: 6 additions & 7 deletions almond/config.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "Almond",
"version": "1.1.2",
"slug": "almond",
"description": "The home server version of Almond",
"name": "Almond - Edge",
gcampax marked this conversation as resolved.
Show resolved Hide resolved
"version": "2.0.0-1",
gcampax marked this conversation as resolved.
Show resolved Hide resolved
"slug": "edge",
gcampax marked this conversation as resolved.
Show resolved Hide resolved
"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"],
frenck marked this conversation as resolved.
Show resolved Hide resolved
"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"
}
14 changes: 0 additions & 14 deletions almond/rootfs/etc/cont-init.d/almond.sh

This file was deleted.

2 changes: 0 additions & 2 deletions almond/rootfs/etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
}
7 changes: 7 additions & 0 deletions almond/rootfs/etc/services.d/almond/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ 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
# Skip authentication handling
echo '{"server-login":{"password":"x","salt":"x","sqliteKeySalt":"x"}}' \
> /data/almond-server/prefs.db
gcampax marked this conversation as resolved.
Show resolved Hide resolved
fi

# Send out discovery information to Home Assistant
./discovery &

Expand Down