Difference between revisions of "Automation Analytics"

From tannerjc wiki
Jump to: navigation, search
(fullstack dev setup)
Line 65: Line 65:
 
The stack is heavily reliant on docker-compose to spin up and podman-compose will fail if used.
 
The stack is heavily reliant on docker-compose to spin up and podman-compose will fail if used.
  
The easypath is
+
; fix the spandx config
* vagrant
+
<syntaxhighlight lang="Diff">
* ubuntu 1804
+
[jtanner@corsair tower-analytics-frontend]$ git diff config/local-api.spandx.config.js
* docker-engine
+
diff --git a/config/local-api.spandx.config.js b/config/local-api.spandx.config.js
* docker-compose
+
index 0645a59..4529b37 100644
 +
--- a/config/local-api.spandx.config.js
 +
+++ b/config/local-api.spandx.config.js
 +
@@ -11,7 +11,6 @@ module.exports = {
 +
        '/apps/automation-analytics': { host: `https://${localhost}:8002` },
 +
        '/ansible/automation-analytics': { host: `https://${localhost}:8002` },
 +
        '/beta/ansible/automation-analytics': { host: `https://${localhost}:8002` },
 +
-        '/beta/config': { host: `http://${localhost}:8889` },
 +
        '/api/tower-analytics': { host: `http://${localhost}:8000` }
 +
    }
 +
};
 +
</syntaxhighlight>
  
; F31 host config
+
; run the insights proxy
 
<syntaxhighlight lang="Bash">
 
<syntaxhighlight lang="Bash">
dnf -y install nfs-utils
+
cd ~/workspace/github/RedHatInsights/insights-proxy
systemctl enable nfs-server
+
SPANDX_CONFIG=~/workspace/github/RedHatInsights/tower-analytics-frontend/config/local-api.spandx.config.js ./scripts/run.sh
systemctl enable rpcbind
+
systemctl start nfs-server
+
systemctl start rpcbind
+
 
+
rpcinfo -p 192.168.122.1 | awk '{print $4}' | fgrep -v port | sort -u | xargs -I {} firewall-cmd --zone=libvirt --permanent --add-port={}/tcp
+
rpcinfo -p 192.168.122.1 | awk '{print $4}' | fgrep -v port | sort -u | xargs -I {} firewall-cmd --zone=libvirt --permanent --add-port={}/udp
+
firewall-cmd --zone=libvirt --add-service=nfs --permanent
+
firewall-cmd --zone=libvirt --add-service=rpc-bind --permanent
+
firewall-cmd --reload
+
 
</syntaxhighlight>
 
</syntaxhighlight>
  
; Vagrantfile
+
; run the frontend
<syntaxhighlight lang="Ruby">
+
# -*- mode: ruby -*-
+
# vi: set ft=ruby :
+
 
+
Vagrant.configure("2") do |config|
+
  config.vm.box = "generic/ubuntu1804"
+
  config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_udp: false
+
  config.vm.provider :libvirt do |libvirt|
+
    libvirt.cpus = 2
+
    libvirt.memory = 4096
+
  end
+
end
+
</syntaxhighlight>
+
 
+
 
+
; setupdocker.sh
+
 
<syntaxhighlight lang="Bash">
 
<syntaxhighlight lang="Bash">
#!/bin/bash
+
nvm use 10.15
 
+
cd ~/workspace/github/RedHatInsights/tower-analytics-frontend
# https://docs.docker.com/engine/install/ubuntu/
+
npm install
 
+
npm start
sudo apt-get update
+
sudo apt-get install -y \
+
    apt-transport-https \
+
    ca-certificates \
+
    curl \
+
    gnupg-agent \
+
    software-properties-common
+
 
+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+
sudo add-apt-repository \
+
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+
  $(lsb_release -cs) \
+
  stable"
+
sudo apt-get update
+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
+
sudo apt-get install -y docker-compose
+
 
+
sudo usermod -aG docker vagrant
+
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 12:52, 8 June 2020


frontend dev setup

use nvm to install and use node 10.15
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install 10.15
nvm use 10.15
clone the various repos
mkdir -p ~/workspace/github/RedHatInsights
git clone https://github.com/RedHatInsights/tower-analytics-frontend ~/workspace/github/RedHatInsights/tower-analytics-frontend
git clone https://github.com/RedHatInsights/insights-proxy ~/workspace/github/RedHatInsights/insights-proxy
fix the frontend spandx config
diff --git a/config/spandx.config.js b/config/spandx.config.js
index c40e554..611bc40 100644
--- a/config/spandx.config.js
+++ b/config/spandx.config.js
@@ -9,6 +9,5 @@ module.exports = {
         '/apps/automation-analytics': { host: `https://${localhost}:8002` },
         '/ansible/automation-analytics': { host: `https://${localhost}:8002` },
         '/beta/ansible/automation-analytics': { host: `https://${localhost}:8002` },
-        '/beta/config': { host: `http://${localhost}:8889` }
     }
 };
set the hosts file
cd ~/workspace/github/RedHatInsights/insights-proxy
sudo ./scripts/patch-etc-hosts.sh


start the proxy [requires docker or podman-docker]
cd ~/workspace/github/RedHatInsights/insights-proxy
SPANDX_CONFIG=~/workspace/github/RedHatInsights/tower-analytics-frontend/config/spandx.config.js ./scripts/run.sh


install the npm packages
cd ~/workspace/github/RedHatInsights/tower-analytics-frontend
npm install
npm run


open the "prod" url

https://prod.foo.redhat.com:1337/beta/ansible/automation-analytics/clusters


fullstack dev setup

The backend stack is in a private repo https://github.com/RedHatInsights/tower-analytics-backend

The stack is heavily reliant on docker-compose to spin up and podman-compose will fail if used.

fix the spandx config
[jtanner@corsair tower-analytics-frontend]$ git diff config/local-api.spandx.config.js
diff --git a/config/local-api.spandx.config.js b/config/local-api.spandx.config.js
index 0645a59..4529b37 100644
--- a/config/local-api.spandx.config.js
+++ b/config/local-api.spandx.config.js
@@ -11,7 +11,6 @@ module.exports = {
         '/apps/automation-analytics': { host: `https://${localhost}:8002` },
         '/ansible/automation-analytics': { host: `https://${localhost}:8002` },
         '/beta/ansible/automation-analytics': { host: `https://${localhost}:8002` },
-        '/beta/config': { host: `http://${localhost}:8889` },
         '/api/tower-analytics': { host: `http://${localhost}:8000` }
     }
 };
run the insights proxy
cd ~/workspace/github/RedHatInsights/insights-proxy
SPANDX_CONFIG=~/workspace/github/RedHatInsights/tower-analytics-frontend/config/local-api.spandx.config.js ./scripts/run.sh
run the frontend
nvm use 10.15
cd ~/workspace/github/RedHatInsights/tower-analytics-frontend
npm install
npm start

debugging

enable the console

eslint disabes console.log entries in the code, and needs configuration to allow it ...

diff --git a/.eslintrc.yml b/.eslintrc.yml
index c5d7d33..61835e5 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -72,6 +72,7 @@ rules:
   new-cap: 2
   no-bitwise: 2
   no-caller: 2
+  no-console: "off"
   no-mixed-spaces-and-tabs: 2
   no-multiple-empty-lines:
     - error
Another option is to add
\* eslint-disable *\
at the top of the individual files.

troubleshooting

podman permission or OCI errors ...
sudo rm -rf  ~/.local/share/containers/