From a376294eb74c2c075bd0107dbd9aa56e1914d90d Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Tue, 14 Jan 2020 14:56:01 +0200 Subject: [PATCH] Rearrange docker stuff Signed-off-by: Marko Korhonen --- .../homeautomation}/.gitignore | 0 .../homeautomation}/docker-compose.yml | 31 ++----- .../homeautomation}/init.sh | 4 - homeautomation/snips/Dockerfile.amd64 | 46 ---------- homeautomation/snips/build.sh | 2 - homeautomation/snips/start-snips.sh | 84 ------------------- root/etc/mkinitcpio.conf | 2 +- 7 files changed, 7 insertions(+), 162 deletions(-) rename {homeautomation => docker/homeautomation}/.gitignore (100%) rename {homeautomation => docker/homeautomation}/docker-compose.yml (62%) rename {homeautomation => docker/homeautomation}/init.sh (78%) delete mode 100644 homeautomation/snips/Dockerfile.amd64 delete mode 100755 homeautomation/snips/build.sh delete mode 100644 homeautomation/snips/start-snips.sh diff --git a/homeautomation/.gitignore b/docker/homeautomation/.gitignore similarity index 100% rename from homeautomation/.gitignore rename to docker/homeautomation/.gitignore diff --git a/homeautomation/docker-compose.yml b/docker/homeautomation/docker-compose.yml similarity index 62% rename from homeautomation/docker-compose.yml rename to docker/homeautomation/docker-compose.yml index 80712e0..3e8f60f 100644 --- a/homeautomation/docker-compose.yml +++ b/docker/homeautomation/docker-compose.yml @@ -7,7 +7,7 @@ services: restart: always image: homeassistant/home-assistant volumes: - - /homeautomation-config/home-assistant:/config + - /docker/homeautomation/home-assistant:/config network_mode: host depends_on: - deconz @@ -27,7 +27,7 @@ services: network_mode: host volumes: - /etc/localtime:/etc/localtime:ro - - /homeautomation-config/deconz:/root/.local/share/dresden-elektronik/deCONZ + - /docker/homeautomation/deconz:/root/.local/share/dresden-elektronik/deCONZ devices: - /dev/ttyACM0 @@ -40,7 +40,7 @@ services: ports: - '1880:1880' volumes: - - /homeautomation-config/node-red:/data + - /docker/homeautomation/node-red:/data depends_on: - home-assistant @@ -52,7 +52,7 @@ services: - '9000:9000' volumes: - /var/run/docker.sock:/var/run/docker.sock - - /homeautomation-config/portainer:/data + - /docker/homeautomation/portainer:/data mosquitto: container_name: mosquitto @@ -60,7 +60,7 @@ services: restart: always network_mode: host volumes: - - /homeautomation-config/mosquitto:/mosquitto + - /docker/homeautomation/mosquitto:/mosquitto mariadb: container_name: mariadb @@ -71,23 +71,4 @@ services: ports: - '3308:3306' volumes: - - /homeautomation-config/mariadb:/var/lib/mysql - - almond: - container_name: almond - image: stanfordoval/almond-server:latest-portable - ports: - - '3006:3000' - volumes: - - /homeautomation-config/almond -# snips: -# container_name: snips -# image: reekymarko/snips -# restart: always -# environment: -# ENABLE_MQTT: 'no' -# ENABLE_HOTWORD_SERVICE: 'no' -# volumes: -# - /homeautomation-config/snips/log/:/var/log -# - /homeautomation-config/snips/snips.toml:/etc/snips.toml -# - /homeautomation-config/snips/assistant:/usr/share/snips + - /docker/homeautomation/mariadb:/var/lib/mysql diff --git a/homeautomation/init.sh b/docker/homeautomation/init.sh similarity index 78% rename from homeautomation/init.sh rename to docker/homeautomation/init.sh index 8b90941..08b509f 100755 --- a/homeautomation/init.sh +++ b/docker/homeautomation/init.sh @@ -1,8 +1,4 @@ #!/bin/bash - -sudo mkdir -p /homeautomation-config/node-red -sudo chmod -R a+rw /homeautomation-config/node-red - cat < .env MYSQL_ROOT_PASSWORD=$(pass reekynet/docker-home-automation | rg 'MYSQL_ROOT_PASSWORD' | cut -d' ' -f2-) HA_MYSQL_PASSWORD="$(pass reekynet/docker-home-automation | rg 'HA_MYSQL_PASSWORD' | cut -d' ' -f2-) diff --git a/homeautomation/snips/Dockerfile.amd64 b/homeautomation/snips/Dockerfile.amd64 deleted file mode 100644 index 45c4d7d..0000000 --- a/homeautomation/snips/Dockerfile.amd64 +++ /dev/null @@ -1,46 +0,0 @@ -#version: 20181208_rc1 - -FROM debian:stretch-slim - -#Change the timezone to your current timezone!! -ENV TZ=Europe/Helsinki - -RUN set -x && \ - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN set -x && \ - sed -i "s#deb http://deb.debian.org/debian stretch main#deb http://deb.debian.org/debian stretch main non-free#g" /etc/apt/sources.list && \ - sed -i "s#deb http://security.debian.org/debian-security stretch/updates main#deb http://security.debian.org/debian-security stretch/updates main non-free#g" /etc/apt/sources.list && \ - sed -i "s#deb http://deb.debian.org/debian stretch-updates main#deb http://deb.debian.org/debian stretch-updates main non-free#g" /etc/apt/sources.list - -RUN set -x && \ - apt-get update && apt-get dist-upgrade -y - -RUN set -x && \ - apt-get install -y dirmngr apt-transport-https - -RUN set -x && \ - bash -c 'echo "deb https://debian.snips.ai/stretch stable main" > /etc/apt/sources.list.d/snips.list' - -RUN set -x && \ - apt-key adv --keyserver pgp.mit.edu --recv-keys F727C778CCB0A455 - -RUN set -x && \ - apt-get update - -RUN set -x && \ - apt-get install -y --allow-unauthenticated alsa-utils snips-platform-voice snips-skill-server curl unzip snips-template python-pip git - -RUN set -x && \ - pip install virtualenv - -#Is this really required? -RUN set -x && \ - usermod -aG snips-skills-admin root - -COPY start-snips.sh start-snips.sh - -EXPOSE 1883/tcp - - -CMD ["bash","/start-snips.sh"] diff --git a/homeautomation/snips/build.sh b/homeautomation/snips/build.sh deleted file mode 100755 index 0f3e43d..0000000 --- a/homeautomation/snips/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -docker build -f Dockerfile.amd64 -t reekymarko/snips . diff --git a/homeautomation/snips/start-snips.sh b/homeautomation/snips/start-snips.sh deleted file mode 100644 index 3252420..0000000 --- a/homeautomation/snips/start-snips.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -set -e - -#verify that environment variables have been passed to this container. set the default value if not. -ENABLE_MQTT=${ENABLE_MQTT:-yes} -ENABLE_HOTWORD_SERVICE=${ENABLE_HOTWORD_SERVICE:-yes} - - -#deploy apps (skills). See: https://snips.gitbook.io/documentation/console/deploying-your-skills -snips-template render - -#goto skill directory -cd /var/lib/snips/skills - -#start with a clear skill directory -rm -rf * - -#download required skills from git -for url in $(awk '$1=="url:" {print $2}' /usr/share/snips/assistant/Snipsfile.yaml); do - git clone $url -done - -#be shure we are still in the skill directory -cd /var/lib/snips/skills - -#run setup.sh for each skill. -find . -maxdepth 1 -type d -print0 | while IFS= read -r -d '' dir; do - cd "$dir" - if [ -f setup.sh ]; then - echo "Run setup.sh in "$dir - #run the scrips always with bash - bash ./setup.sh - fi - cd /var/lib/snips/skills -done - -#skill deployment is done - -#go back to root directory -cd / - - -#start own mqtt service. -if [ $ENABLE_MQTT == yes ]; then - mosquitto -c /etc/mosquitto/mosquitto.conf -d -fi - -#start Snips analytics service -snips-analytics 2> /var/log/snips-analytics.log & -snips_analytics_pid=$! - -#start Snips' Automatic Speech Recognition service -snips-asr 2> /var/log/snips-asr.log & -snips_asr_pid=$! - -#start Snips-dialogue service -snips-dialogue 2> /var/log/snips-dialogue.log & -snips_dialogue_pid=$! - -#start Snips hotword service - -if [ $ENABLE_HOTWORD_SERVICE == yes ]; then - snips-hotword 2> /var/log/snips-hotword.log & - snips_hotword_pid=$! -fi - -#start Snips Natural Language Understanding service -snips-nlu 2> /var/log/snips-nlu.log & -snips_nlu_pid=$! - -#start Snips Skill service -snips-skill-server 2> /var/log/snips-skill-server & -snips_skill_server_pid=$! - -#start Snips TTS service -snips-tts 2> /var/log/snips-tts.log & -snips_tts_pid=$! - -#start the snips audio server without playback and microphone -snips-audio-server --disable-playback --no-mike --hijack localhost:64321 2> /var/log/snips-audio-server.log & -snips_audio_server_pid=$! - -wait "$snips_analytics_pid" "$snips_asr_pid" "$snips_dialogue_pid" "$snips_hotword_pid" "$snips_nlu_pid" "$snips_skill_server_pid" "$snips_audio_server_pid" - diff --git a/root/etc/mkinitcpio.conf b/root/etc/mkinitcpio.conf index 417fa9e..1226416 100644 --- a/root/etc/mkinitcpio.conf +++ b/root/etc/mkinitcpio.conf @@ -2,7 +2,7 @@ MODULES=(amdgpu) BINARIES=() FILES=() {%@@ if profile == "Mirkwood" @@%} -HOOKS=(colors consolefont base udev autodetect modconf block filesystems keyboard btrfs welcomemessage encrypt resume fsck) +HOOKS=(base udev autodetect modconf block filesystems keyboard colors consolefont welcomemessage encrypt resume fsck) {%@@ elif profile == "Rivendell" @@%} HOOKS=(colors consolefont base udev autodetect modconf block filesystems keyboard fsck) {%@@ endif @@%}