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

Add Vagrant support #9

Closed
wants to merge 1 commit into from
Closed

Conversation

ghoneycutt
Copy link
Member

@bastelfreak Attempting to see this work locally and running into issues. Not sure if there is a step missing from the code or if the class needs to be called with specific data. Attempting to just include hyperglass::server

@ghoneycutt
Copy link
Member Author

-- Logs begin at Sun 2020-09-20 18:53:28 UTC. --
Sep 20 18:59:12 hyperglass-server.example.com python3[7625]: [INFO] 20200920 18:59:12 | hyperglass.main:101 | on_starting → Python 3.6.8 detected (3.6 required)
Sep 20 18:59:12 hyperglass-server.example.com python3[7625]: [DEBUG] 20200920 18:59:12 | hyperglass.main:55 | check_redis_instance → Redis is running at: localhost:6379
Sep 20 18:59:12 hyperglass-server.example.com python3[7625]: [DEBUG] 20200920 18:59:12 | hyperglass.util:397 | read_package_json → package.json:
Sep 20 18:59:12 hyperglass-server.example.com python3[7625]: {'name': 'ui', 'version': '1.0.0', 'description': 'UI for hyperglass, the modern network looking glass', 'author': 'Matt Love', 'license': 'BSD-3-Clause-Clear', 'private': False, 'scripts': {'dev': 'node nextdev', 'build': 'next build && next export -o ../hyperglass/static/ui', 'start': 'next start', 'clean': 'rimraf --no-glob ./.next ./out', 'check:es:build': "es-check es5 './.next/static/**/*.js' -v", 'check:es:export': "es-check es5 './out/**/*.js' -v"}, 'browserslist': '> 0.25%, not dead', 'dependencies': {'@chakra-ui/core': '^0.8', '@emotion/core': '^10.0.28', '@emotion/styled': '^10.0.27', '@styled-system/should-forward-prop': '^5.1.5', 'axios': '^0.19.2', 'axios-hooks': '^1.9.0', 'chroma-js': '^2.1.0', 'dayjs': '^1.8.25', 'emotion-theming': '^10.0.27', 'framer-motion': '^1.10.0', 'lodash': '^4.17.15', 'next': '^9.4', 'react': '^16.13.1', 'react-countdown': '^2.2.1', 'react-dom': '^16.13.1', 'react-hook-form': '^5.7', 'react-icons': '^3.9.0', 'react-markdown': '^4.3.1', 'react-select': '^3.0.8', 'react-string-replace': '^0.4.4', 'react-table': '^7.0.4', 'string-format': '^2.0.0', 'styled-system': '^5.1.5', 'tempy': '^0.5.0', 'use-media': '^1.4.0', 'yup': '^0.28.3'}, 'devDependencies': {'@typescript-eslint/eslint-plugin': '^2.24.0', '@typescript-eslint/parser': '^2.24.0', 'babel-eslint': '^10.1.0', 'es-check': '^5.1.0', 'eslint': '^6.8.0', 'eslint-config-airbnb': '^18.1.0', 'eslint-config-prettier': '^6.10.0', 'eslint-config-react-app': '^5.2.0', 'eslint-import-resolver-webpack': '^0.12.1', 'eslint-plugin-flowtype': '^4.6.0', 'eslint-plugin-import': '^2.20.1', 'eslint-plugin-jsx-a11y': '^6.2.3', 'eslint-plugin-prettier': '^3.1.2', 'eslint-plugin-react': '^7.19.0', 'eslint-plugin-react-hooks': '^2.3.0', 'express': '^4.17.1', 'http-proxy-middleware': '0.20.0', 'prettier': '^1.19.1'}, 'eslintConfig': {'parser': 'babel-eslint', 'rules': {'max-len': ['error', 100], 'react/prop-types': 0, 'react/jsx-filename-extension': 0, 'react/jsx-props-no-spreading': 0, 'no-bitwise': 0, 'object-shorthand': 0, 'no-plusplus': 0, 'no-param-reassign': 0, 'no-unused-expressions': 0, 'no-nested-ternary': 0, 'no-underscore-dangle': 0, 'camelcase': 0}, 'extends': ['airbnb', 'prettier', 'prettier/react'], 'env': {'browser': True}, 'settings': {'import/core-modules': ['styled-jsx/css'], 'import/resolver': {'webpack': {'config': 'webpack.config.js'}}}}}
Sep 20 18:59:12 hyperglass-server.example.com python3[7625]: [DEBUG] 20200920 18:59:12 | hyperglass.util:608 | build_frontend → node_modules has not been initialized. Starting initialization...
Sep 20 19:00:12 hyperglass-server.example.com python3[7625]: Error:
Sep 20 19:00:12 hyperglass-server.example.com systemd[1]: hyperglass.service: main process exited, code=exited, status=1/FAILURE
Sep 20 19:00:13 hyperglass-server.example.com systemd[1]: Unit hyperglass.service entered failed state.
Sep 20 19:00:13 hyperglass-server.example.com systemd[1]: hyperglass.service failed.
Sep 20 19:00:22 hyperglass-server.example.com systemd[1]: [/etc/systemd/system/hyperglass.service:5] Failed to add dependency on rh-redis5-redis, ignoring: Invalid argument

@bastelfreak
Copy link
Member

I will have a look at this later. the beaker tests for the hyperglass::server class pass the tests currently, so I guesss something with vagrant is wrong.

@ghoneycutt
Copy link
Member Author

@bastelfreak The acceptance test just applies the class and checks that it can be applied and is idempotent. It does not check to see if the service is running.

@ghoneycutt ghoneycutt force-pushed the vagrant branch 2 times, most recently from 3c99c47 to 3b13f2f Compare September 23, 2020 02:44
@ghoneycutt ghoneycutt changed the title (WIP) Add Vagrant support Add Vagrant support Sep 23, 2020
@ghoneycutt
Copy link
Member Author

This is ready for merge

@bastelfreak
Copy link
Member

looks good at the moment. I think we should rebase it after #5 got merged because I did a lot of refactoring there.

@@ -0,0 +1,14 @@
# If you enable selinux, redis will not be able to write to its data directory
# and will not properly start without the following.
selinux::permissive { 'redis_t':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this? I think the redis module sets correct permissions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah :(

Once I fixed this, then redis worked properly.

@ghoneycutt
Copy link
Member Author

Ran into thatmattlove/hyperglass#85 and saw what you did in the agent acceptance tests. Need to add these here so it works in vagrant.

In the sensu module there is a similar server/agent setup that uses TLS and we just used the puppet certs, since Puppet gives us a working CA environment. We make it the default way so by using the puppet module you get better security by default. Perhaps hyperglass should do similar.

@ghoneycutt
Copy link
Member Author

@bastelfreak you know if there is a way to query the hyperglass server to see that the agent has connected? ideally the our acceptance tests for agent_and_server would include something that proves the communication is working.

@bastelfreak
Copy link
Member

Yes their current TLS implementation is very specifc. I highly prefer a setup where apps are bound to localhost only and an nginx does TLS termination, if possible with TLS client cert validation. This works perfectly fine with Puppet certificates. Howerver the hyperglass-server does currently not support it.

I created a patch for your branch that works on my local machine:

diff --git a/vagrant/hyperglass-server.pp b/vagrant/hyperglass-server.pp
index 80f16b8..7ef06b9 100644
--- a/vagrant/hyperglass-server.pp
+++ b/vagrant/hyperglass-server.pp
@@ -8,7 +8,16 @@ selinux::permissive { 'redis_t':
 class { 'hyperglass::server':
   # Without this, hyperglass binds to localhost and port forwarding with
   # vagrant will not work.
-  data => {
+  data    => {
     'listen_address' => '0.0.0.0',
   },
+  devices =>  {"routers"=>
+  [{"name"=>"hyperglassagent",
+    "address"=>"192.168.73.20",
+    "network"=>{"name"=>"secondary", "display_name"=>"That Other Network"},
+    "credential"=>{"username"=>"user2", "password"=>"bb8RS9cpMqNXM561rrUt"},
+    "display_name"=>"Atlanta, GA",
+    "port"=>8080,
+    "nos"=>"bird",
+    "vrfs"=>[{"name"=>"default", "display_name"=>"Global", "ipv4"=>{"source_address"=>"192.168.73.20"}}]}]}
 }

this connects the hyperglass agent to the server

@bastelfreak
Copy link
Member

on a quick look at the docs I couldn't spot any health checks in that we could use in our tests. I asked in their gitter channel.

@ghoneycutt
Copy link
Member Author

@bastelfreak Do you have to add the agent info to the server like that? If so that's odd because the agent is configured to speak to the server so they should know about each other.

If that's the normal process, maybe we need some kind of <| collector |> to make it easy for agent profiles to specify the data.

@ghoneycutt
Copy link
Member Author

Closing in favor of #15 which includes this work with minor modifications.

@ghoneycutt ghoneycutt closed this Sep 27, 2020
@ghoneycutt ghoneycutt deleted the vagrant branch September 27, 2020 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants