Giter VIP home page Giter VIP logo

bommer's Introduction

Installation

From a fresh installation (Ubuntu 18.04), you'll need to install a few things:

git clone https://github.com/durkie/bommer.git
cd bommer
apt-get update
apt install ruby ruby-bundler ruby-dev gcc zlib1g-dev libxml2-dev postgresql libpq-dev
bundle install

Set up postgres, with your username in place of <USERNAME>:

echo "create role <USERNAME> with login createdb" | sudo -u postgres psql

Set up the database, seed with data:

rake db:create
rake db:migrate
rake db:seed

Operation

Run the server via rails s, which will start it listening on localhost:3000. Alternatively, you can supply a source IP to bind to with "rails s -b www.xxx.yyy.zzz"

API

  • Listing all parts: GET http://localhost:3000/api/v1/parts

  • Listing all orphaned parts (those not belonging to any assembly): GET http://localhost:3000/api/v1/parts/orphaned

  • Listing all parts in use (those belonging to at least one assembly): GET http://localhost:3000/api/v1/parts/in_use

  • Listing a specific part: GET http://localhost:3000/api/v1/parts/1

A typical response to this might be:

{
	"data": {
		"id": "3",
		"type": "part",
		"attributes": {
			"name": "Barrel Top",
			"part_id": "BT",
			"dependent_assemblies": [{
				"id": 2,
				"name": "Barrel Top With Clip",
				"variant": null,
				"needs_maintenance": false,
				"created_at": "2019-04-12T18:42:48.245Z",
				"updated_at": "2019-04-12T18:42:48.245Z"
			}, {
				"id": 7,
				"name": "Inkless, Bottomless Pen",
				"variant": null,
				"needs_maintenance": false,
				"created_at": "2019-04-12T18:42:48.345Z",
				"updated_at": "2019-04-12T18:42:48.345Z"
			}, {
				"id": 9,
				"name": "Inkless Pen (Metal)",
				"variant": null,
				"needs_maintenance": true,
				"created_at": "2019-04-12T18:42:48.381Z",
				"updated_at": "2019-04-12T19:03:04.667Z"
			}, {
				"id": 8,
				"name": "Inkless Pen (Plastic)",
				"variant": null,
				"needs_maintenance": true,
				"created_at": "2019-04-12T18:42:48.364Z",
				"updated_at": "2019-04-12T19:05:29.238Z"
			},
      ...]
		},
		"relationships": {
			"assemblies": {
				"data": [{
					"id": "2",
					"type": "assembly"
				}]
			}
		}
	}
}

You can see the part name, part id, all assemblies that depend on this part (directly or indirectly), and any assemblies this part directly belongs to (in relationships).

  • Deleting a specific part: DELETE http://localhost:3000/api/v1/parts/1 This will also remove it from any assemblies it was a member of and mark those assemblies as needing maintenance

  • Creating a new part: POST /api/v1/parts?part[part_id]=NIB&part[name]=Tungsten%20nib

  • Creating an assembly from two parts (returns an Assembly object): POST /api/v1/parts/create_assembly?first_part_id=4&second_part_id=3

  • Listing a specific assembly, including its component parts, subassemblies and whether it needs maintenance: GET http://localhost:3000/api/v1/assemblies/1

  • Deleting a part from an assembly: DELETE http://localhost:3000/api/v1/assemblies/23?part_id=3

  • Listing all subassemblies: GET http://localhost:3000/api/v1/assemblies/subassemblies

  • Listing all top-level assemblies: GET http://localhost:3000/api/v1/assemblies/top_level

Monitoring

Sidekiq is installed and should be mostly configured, but is not enabled by default. If you wish to enable it, provision a redis server for it to use, uncomment the sidekiq sections from the Gemfile, routes.rb and config/initializers/sidekiq.rb and run bundle install. It has a daily cron job that runs at 16:45 each day and emails you a list which Assemblies had Parts deleted from them and are in need of maintenance.

bommer's People

Contributors

durkie avatar

Watchers

 avatar

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.