Giter VIP home page Giter VIP logo

lisa's Introduction

LISA

LISA, the lovely interface for sysadmins, is an opinionated UI for Foreman. While the Foreman UI was made for infrastructure teams, LISA was made for users who want to create hosts without needing to know how that is done in detail. This README outlines the details of collaborating on this React.js application.

Compatibility

Foreman Version
>= 1.24

LISA is known to work with Node version >= 14 and <= 18.

Installation

Make sure you use the latest version of npm:

$ npm install -g npm@latest

Download and install packages:

$ npm install

Configuration

Environment variables

$ cp .env.example .env.local

Settings file

To start using LISA you have to define:

You can also define preset resources that can be used to easily set predefined attributes for a new host.

You can use example.json to build the settings file, copy the file and replace the settings with your own.

$ cp src/settings/example.json src/settings/development.json

Use global IDs as a reference to Foreman resources. To get the global ID, start rails console and use the following command:

irb(main):001:0> Foreman::GlobalId.for(Location.find_by(name: 'My-Location'))
=> "MDE6TG9jYXRpb24tMg=="

Run the following command to validate your settings:

$ npx ajv -d src/settings/development.json -s src/settings/settings.schema.json

Please also update the app tiers locales file. (src/locales/appTiers.en.json)

Run tests

$ npm test

Running / Development

$ npm start

Production preview

$ npm run build
$ npm run preview

Running in Docker / Production

Create src/settings/production.json file. (See above) Then build the docker image.

$ docker build -t my-lisa-image .

This multi-stage docker build will install all dependencies, build the production bundle and copy it to a ngninx container.

Then you can run it.

$ docker run -p 8080:8080 my-lisa-image

LISA will be accessible on localhost:8080.

Copyright

Copyright (c) 2018-present dmTECH GmbH, dmtech.de

This project is licensed under the MIT License - see the LICENSE file for details

lisa's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lisa's Issues

After building the application the process object is no longer available

After building the package with npm run build and running it with serve -s build, the application returns a white page and the Browser console shows the following error:

index.js:5 Uncaught ReferenceError: process is not defined
    at Module.6 (index.js:5)
    at f ((index):1)
    at Module.1099 (ActionsDropdown.js:9)
    at f ((index):1)
    at Object.425 (lisa-notification-gfx.svg:1)
    at f ((index):1)
    at a ((index):1)
    at Array.e [as push] ((index):1)
    at main.63117b3d.chunk.js:1

image

`computeResourceId` does not get set correctly in the final host creation call

computeResourceId gets initialised to the compute resource for the default location in settings/index.js, however it never gets changed when the location is changed, even though the computeResource itself is.
This results in foreman trying to create a host on a computeResource that might not be available in the alternate location.

My current solution is to simply add

  set(data, 'computeResourceId', computeResource.id)

to hostCreatParams.js, but as I'm not that great with JavaScript this looks like a big hack.

Creation of VM fails due to "undefined method `resourcePool'"

The creation of a new VM fails with the following error in the Foreman log:

2020-01-20T16:37:50 [I|app|99294351] Started POST "/api/graphql" for 192.168.182.10 at 2020-01-20 16:37:50 +0100
2020-01-20T16:37:50 [I|app|99294351] Processing by Api::GraphqlController#execute as JSON
2020-01-20T16:37:50 [I|app|99294351]   Parameters: {"_json"=>"[FILTERED]", "graphql"=>{"_json"=>"[FILTERED]"}}
2020-01-20T16:37:50 [I|app|99294351] Authorized user <User>(Manuel Laug)
2020-01-20T16:37:50 [I|app|99294351] Completed 200 OK in 108ms (Views: 3.3ms | ActiveRecord: 19.5ms)
2020-01-20T16:37:50 [I|app|5beede11] Started POST "/api/graphql" for 192.168.182.10 at 2020-01-20 16:37:50 +0100
2020-01-20T16:37:50 [I|app|5beede11] Processing by Api::GraphqlController#execute as JSON
2020-01-20T16:37:50 [I|app|5beede11]   Parameters: {"_json"=>"[FILTERED]", "graphql"=>{"_json"=>"[FILTERED]"}}
2020-01-20T16:37:50 [I|app|5beede11] Authorized user <User>(Manuel Laug)
2020-01-20T16:37:53 [I|app|5beede11] Adding Compute instance for tst-manuel-06
2020-01-20T16:37:53 [W|app|5beede11] Failed to create a compute ESX-LX-LAN (VMware) instance tst-manuel-06: undefined method `resourcePool' for nil:NilClass

Default puppetclass_ids do not work

Expected behaviour:
When default_values.puppetclass_ids is defined and the user selects a Puppetserver and environment, the defined Puppet classes get automatically assigned to the new host.

Actual behaviour:
The classes are not selected and the user needs to select them manually.

Hosts pagination

it seems that pagination does not work and only the first page is visible

VM gets created with wrong interface type

After successfully creating a VM using LISA, the system does not want to boot and install.
Foreman reports an error when viewing the "NICs" tab on the host:

Failure: undefined method `mtu' for #<Nic::Base:0x00007f6cb1768958>

Comparing the network_interfaces using the Rails console, there seems to be a difference in the interface "type" - see managed vs. base

# created using Foreman GUI (and working)
[
  {
    "managed": {
      "id": 48903,
      "mac": "<MAC>",
      "ip": "<IP>",
      "name": "tst-host-01.apptier.domain.local",
      [...]
      "attrs": {},
      "provider": null,
      "username": null,
      "password": null,
      "virtual": false,
      "link": true,
      [...]
      "managed": true,
      "mode": "balance-rr",
      "attached_devices": "",
      "bond_options": "",
      "primary": true,
      "provision": true,
      "compute_attributes": {
        "type": "VirtualVmxnet3",
        "network": "dvportgroup-1288716"
      },
      "execution": true,
     [...]
    }
  }
]
# created using LISA (not working)
[
  {
    "base": {
      "id": 48871,
      "mac": "<MAC>",
      "ip": "<IP>",
      "name": "tst-host-02.apptier.domain.local",
      [...]
      "attrs": {},
      "provider": null,
      "username": null,
      "password": null,
      "virtual": false,
      "link": true,
      [...]
      "managed": true,
      "mode": "balance-rr",
      "attached_devices": "",
      "bond_options": "",
      "primary": true,
      "provision": true,
      "compute_attributes": {
        "network": "dvportgroup-1288716",
        "type": "VirtualVmxnet3"
      },
      "execution": true,
      [...]
    }
  }
]

Build fails with missing config options

As suggested in schema.json there should be some required options, like:

  • app_tiers
  • form_settings
  • default_configs
    (and maybe more)

The build of the application fails because it looks for the options in a different naming scheme (like appTiers).

�[32;1m$ npm run build�[0;m

> [email protected] build /builds/aws/lisa-deployment/lisa
> NODE_PATH=src/ react-scripts build

Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
Creating an optimized production build...
Failed to compile.

./src/helpers/hostsCreateParams.js
Attempted import error: 'appTiers' is not exported from '../settings'.


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `NODE_PATH=src/ react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The validation of the used settings.json against the schema is successful.

Build of LISA with plugins breaks with "Cannot find module: '@apollo/react-hooks'"

I just noticed that the build of LISA with a plugins fails due to:

$ npm run build
> [email protected] build /builds/lisa
> react-scripts build
Creating an optimized production build...
Failed to compile.
/builds/lisa-plugin/dist/index.js
Cannot find module: '@apollo/react-hooks'. Make sure this package is installed.
You can install this package by running: npm install @apollo/react-hooks.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-04-20T14_32_43_821Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.