From c80d95507c4812c1589409cadcbe7523bdf125f0 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 31 Mar 2021 10:51:54 +0200
Subject: [PATCH] Configure host to allow ELK stack to run, if needed

---
 docker-compose/elk.yml                      | 10 ++++++++
 docker-compose/lofar-device-base/Dockerfile |  3 +++
 jupyter-notebooks/Start All Devices.ipynb   | 27 ++++++++++++---------
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/docker-compose/elk.yml b/docker-compose/elk.yml
index ecf63e9fd..c8a5c24ab 100644
--- a/docker-compose/elk.yml
+++ b/docker-compose/elk.yml
@@ -3,11 +3,19 @@
 # See https://elk-docker.readthedocs.io/
 #
 # Defines:
+#   - elk-configure-host: Configures the hosts's kernel to be able to use the ELK stack
 #   - elk: ELK stack
 #
 version: '2'
 
 services:
+  elk-configure-host:
+    image: elk-configure-host
+    build:
+        context: elk-configure-host
+    container_name: ${CONTAINER_NAME_PREFIX}elk-configure-host
+    network_mode: ${NETWORK_MODE}
+
   elk:
     image: sebp/elk
     container_name: ${CONTAINER_NAME_PREFIX}elk
@@ -16,3 +24,5 @@ services:
       - "5601:5601"
       - "9200:9200"
       - "5044:5044"
+    depends_on:
+      - elk-configure-host
diff --git a/docker-compose/lofar-device-base/Dockerfile b/docker-compose/lofar-device-base/Dockerfile
index cd6b59511..2f00d2316 100644
--- a/docker-compose/lofar-device-base/Dockerfile
+++ b/docker-compose/lofar-device-base/Dockerfile
@@ -2,3 +2,6 @@ FROM nexus.engageska-portugal.pt/ska-docker/tango-itango:latest
 
 COPY lofar-requirements.txt /lofar-requirements.txt
 RUN pip3 install -r /lofar-requirements.txt
+
+ENV TANGO_LOG_PATH=/var/log/tango
+RUN sudo mkdir -p /var/log/tango && sudo chmod a+rwx /var/log/tango
diff --git a/jupyter-notebooks/Start All Devices.ipynb b/jupyter-notebooks/Start All Devices.ipynb
index beb52a381..1707fdf18 100644
--- a/jupyter-notebooks/Start All Devices.ipynb	
+++ b/jupyter-notebooks/Start All Devices.ipynb	
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": null,
    "id": "social-massachusetts",
    "metadata": {},
    "outputs": [],
@@ -22,20 +22,13 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": null,
    "id": "defined-apache",
    "metadata": {},
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "Device PCC(lts/pcc/1) is now in state FAULT\n",
-      "Device SDP(lts/sdp/1) is now in state ON\n"
-     ]
-    }
-   ],
+   "outputs": [],
    "source": [
+    "sdp = DeviceProxy(\"SDP/LTS/1\")\n",
+    "sdp.force_start()\n",
     "for d in devices:\n",
     "    print(\"Device %s is now in state %s\" % (d, force_start(d)))"
    ]
@@ -46,6 +39,16 @@
    "id": "superior-wheel",
    "metadata": {},
    "outputs": [],
+   "source": [
+    "devices"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "fifteen-transportation",
+   "metadata": {},
+   "outputs": [],
    "source": []
   }
  ],
-- 
GitLab