Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
/ cruton Public archive

Environmental device management system built for hundreds of entities, thousands environments, and millions of devices.

Notifications You must be signed in to change notification settings

cloudnull/cruton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cruton

This is a POC and not currently production ready. Your mileage may vary.


Rebaked environmental device management system

Environmental inventory(device) management system built for hundreds of entities, thousands environments, and millions of devices.


Quick getting started development guide

The following guide will result in a running cruton application.

Requirements:

  • docker
  • docker-compose

Build a cruton container

docker-compose build

Start cruton and cassandra

docker-compose up

Create keyspace where the tables will be created.

This setup creates a basic cassandra container with no authentication needed. So we don't need to create a user with a password. We do howerver need to createa keyspace.

docker exec -ti cassandra_cruton cqlsh localhost -e "CREATE KEYSPACE IF NOT EXISTS "cruton" WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'datacenter1': 1};"

Sync the tables

docker exec -ti  cruton_cruton_1 cruton-manage --config-file /etc/cruton/cruton.ini sync_tables

Working with the API.

To start the API it's recommended that you run the service behind a webserver like NGINX, Apache, using uWSGI, etc. The typical API process can be envoked by running the cruton-api-wsgi --config-file /etc/cruton/cruton.ini command. If you need or want to run the API in debug mode you can do so by invoking the cruton-api-debug --config-file /etc/cruton/cruton.ini command.

Discovery

curl 'http://127.0.0.1:5150/dicovery'

The API endpoints and all available actions are discoverable. The dicovery endpoint allows the a user or an application to discover all available actions for all available versions.

Entities

HEAD all entities
curl --head 'http://127.0.0.1:5150/v1/entities'
PUT an entity
curl -H 'Content-Type: application/json' -D - -XPUT 'http://127.0.0.1:5150/v1/entities/Solo1' -d '{"name": "TestEntitySolo"}'
HEAD an entities
curl --head 'http://127.0.0.1:5150/v1/entities/Solo1'
POST one or many entities (bulk import)
curl -H 'Content-Type: application/json'  -D - -XPOST 'http://127.0.0.1:5150/v1/entities' -d '[{"ent_id": "Ent1", "tags": ["TestEntityTagOne"], "contacts": {"person1": "4155551212", "person2": "email@person2.example.com"}, "name": "TestEntityOne"}, {"ent_id": "Ent2", "tags": ["TestEntityTagOne", "TestEntityTagTwo"], "contacts": {"person2": "email@person2.example.com"}, "name": "TestEntityTwo"}]'
GET entities
curl 'http://127.0.0.1:5150/v1/entities'
GET entities and search
curl -D - 'http://127.0.0.1:5150/v1/entities?contact=person1'
GET entities and search doing a partial match using provided criteria
curl -D - 'http://127.0.0.1:5150/v1/entities?name=EntityTag&fuzzy=true'

You should be aware that ANY field in the data module can be part of the search criteria.

Environments

HEAD all environments
# HEAD environments root
curl --head 'http://127.0.0.1:5150/v1/entities/Ent1/environments'
PUT an environment
curl -H 'Content-Type: application/json' -D - -XPUT 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1' -d '{"name": "SoloEnvironmentOne"}'
HEAD an environment
# HEAD environments root
curl --head 'http://127.0.0.1:5150/v1/entities/Ent1/environments/SoloEnv1'
POST one or many environments (bulk import)
curl -H 'Content-Type: application/json' -D - -XPOST 'http://127.0.0.1:5150/v1/entities/Ent1/environments' -d '[{"env_id": "Env1", "tags": ["TestEnvironmentTagOne"], "contacts": {"person1": "4155551212", "person2": "email@person2.example.com"}, "name": "TestEnvironmentOne"}, {"env_id": "Env2", "tags": ["TestEnvironmentTagOne", "TestEnvironmentTagTwo"], "contacts": {"person1": "4155551212"}, "name": "TestEnvironmentTwo"}]'
GET environments
curl -D - 'http://127.0.0.1:5150/v1/entities/x/environments/Env2'
GET environments and search
curl -D - 'http://127.0.0.1:5150/v1/entities/x/environments?contact=person1'
GET environments and search doing a partial match using provided criteria
curl -D - 'http://127.0.0.1:5150/v1/entities/x/environments?tag=EnvironmentTag&fuzzy=true'

You should be aware that ANY field in the data module can be part of the search criteria.

Devices

HEAD all devices
curl --head http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices
PUT a device
curl -H 'Content-Type: application/json' -D - -XPUT 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices/SoloDev1' -d '{"name": "SoloDeviceOne"}'
HEAD a device
curl --head http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices/SoloDev1
POST one or many devices (bulk import)
curl -H 'Content-Type: application/json' -D - -XPOST 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices' -d '[{"dev_id": "Dev1", "tags": ["TestEnvironmentTagOne"], "access_ip": {"drac": "172.16.24.1", "mgmt": "fe80::6656:fc1d:cd1:ddba"}, "rack_id": "TestRack1", "row_id": "TestRow1", "name": "TestDeviceOne"}, {"dev_id": "Dev2", "tags": ["TestDeviceTagOne", "TestDeviceTagTwo"], "access_ip": {"drac": "172.16.24.2", "mgmt": "fe80::6656:fc1d:cd1:ddbb"}, "rack_id": "TestRack2", "row_id": "TestRow1", "name": "TestDeviceTwo"}]'
GET devices
curl 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices'
GET devices and search
curl 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices?row_id=TestRow1'
GET devices and search doing a partial matching using provided criteria
curl 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices?name=Test&fuzzy=true'

You should be aware that ANY field in the data module can be part of the search criteria.

GET an IPXE return for a specific device
curl 'http://127.0.0.1:5150/v1/entities/TestEntity1/environments/TestEnvironment1A/devices/TestDevice1A/ipxe"

If a device has an has variable with "ipxe_" as the prefix the ipxe endpoint will return an ipxe config using those variables.


Utilities

Automated data population can be simply done using an Ansible playbook. More on helpful playbooks can be found here

Synchronizing the table space with the backend store.

cruton-manage --config-file /etc/cruton/cruton.ini sync_tables

Additional documentation:

About

Environmental device management system built for hundreds of entities, thousands environments, and millions of devices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages