• Stars
    star
    237
  • Rank 165,237 (Top 4 %)
  • Language
    Erlang
  • License
    MIT License
  • Created almost 15 years ago
  • Updated about 14 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Monitoring and REST interface to rabbitmq

Alice

Official release post: http://willcodeforfoo.com/2009/07/13/announcing-alice/

http://alicetheapp.com.

As a queue server, RabbitMQ is super cool, but my company is hesitant to use it without a nice front-end or access to statistics about the server. So we set out to develop the latest RabbitMQ REST interface, Alice.

Alice is a RESTful interface to the RabbitMQ server that talks directly through erlang's native interface, epmd. The purely RESTful server responds to the same interface as the RabbitMQ's command-line interface and presents a native HTTP interface to the data. Alice is written with Mochiweb.

Quickstart

How to get started.


git clone git://github.com/auser/alice.git
cd alice
./start.sh

You can pass a rabbithost where your rabbitmq-server sits by passing the options rabbithost in the command-line, like so:


  ./start.sh -alice rabbithost "other.node.come"

Note, you may have to set your cookie when starting Alice with a remote node by the -setcookie flag:


  ./start.sh -alice rabbithost "other.node.com" -setcookie "mysecretcookie"

## Currently exposed RESTful routes
  /conn - Current connection information
  /exchanges - Current exchanges information
  /queues - Current queues
  /users - Current users
  /bindings - Current bindings
  /control - Access to the RabbitMQ control
  /permissions - Current permissions
  /vhosts - Current vhosts

These endpoints all are exposed with the four verbs (get, post, put, delete) and respond in the JSON format, (except the root / endpoint which responds with text/html).

Usage

Users


# List users
curl -i http://localhost:9999/users 
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:08:20 GMT
Content-Type: text/json
Content-Length: 19

{"users":["guest"]}

# Viewing a specific user
curl -i http://localhost:9999/users/guest
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:01:01 GMT
Content-Type: text/json
Content-Length: 17

{"users":"guest"}

# If the user is not a user:
curl -i http://localhost:9999/users/bob  
HTTP/1.1 400 Bad Request
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:01:20 GMT
Content-Type: text/json
Content-Length: 20

{"bob":"not a user"}

# Add a user
curl -i -XPOST \
        -d'{"username":"ari", "password":"weak password"}' \
        http://localhost:9999/users
        
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 16 Jul 2009 00:10:35 GMT
Content-Type: text/json
Content-Length: 25

{"users":["ari","guest"]}

# Deleting a user
curl -i -XDELETE  http://localhost:9999/users/ari
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:19:24 GMT
Content-Type: text/json
Content-Length: 19

{"users":["guest"]}

Notice that when we list the user that doesn't exist, bob from the second example above, the return is a 400. This is especially useful when you want to access the data programmatically. More on extending Alice below and how to get access to the return value of the requested route.

The same basic usage is applied to all the routes listed, as you can see:

Connections


# List connections
curl -i http://localhost:9999/conn
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:30:52 GMT
Content-Type: text/json
Content-Length: 287

{"conn":[{"pid":"...","ip":"127.0.0.1","port":"5672","peer_address":"127.0.0.1" ...}]}

Exchanges


# List the current exchanges
curl -i http://localhost:9999/exchanges
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:34:14 GMT
Content-Type: text/json
Content-Length: 654

{"exchanges":[{"name":"amq.rabbitmq.log","type":"topic","durable":"true","auto_delete":...}

Queues


# List the current queues
curl -i http://localhost:9999/queues   
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:35:42 GMT
Content-Type: text/json
Content-Length: 60

{"queues":[{"memory":"212988","name":"noises","vhost":"/"}]}

Bindings


# List the current bindings
curl -i http://localhost:9999/bindings
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:36:13 GMT
Content-Type: text/json
Content-Length: 69

{"bindings":[{"queue":"noises","exchange":"","from_queue":"noises"}]}

Permissions


# List permissions
curl -i http://localhost:9999/permissions
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:37:32 GMT
Content-Type: text/json
Content-Length: 42

{"permissions":{"vhosts":[{"name":"/", "users":[{"name":"guest","configure":".*","read":".*","write":".*"}]}]}}

# You can list permissions for a user
curl -i http://localhost:9999/permissions/amr
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:50:33 GMT
Content-Type: text/json
Content-Length: 42

{"permissions":{"name":"guest","vhosts":[{"name":"/","configure":".*","write":".*","read":".*"}]}}

# You can list permissions on a vhost too
curl -i http://localhost:9999/permissions/vhost/root
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:50:33 GMT
Content-Type: text/json
Content-Length: 42

{"permissions":{"name":"/","users":[{"name":"guest","configure":".*","write":".*","read":".*"}]}}

# Setting permissions
curl -i -XPOST -d '{"vhost":"/", "configure":".*", "read":".*", "write":".*"}' \
  http://localhost:9999/permissions/guest
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:55:33 GMT
Content-Type: text/json
Content-Length: 38

{"permissions":{"name":"guest","vhosts":[{"name":"/","configure":".*","write":".*","read":".*"}]}}

# Deleting permissions
curl -i -XDELETE -d '{"vhost":"/"}' http://localhost:9999/permissions/guest
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:55:33 GMT
Content-Type: text/json
Content-Length: 38

{"permissions":{"name":"guest","vhosts":[]}}

Vhosts


# List vhosts
curl -i http://localhost:9999/vhosts
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:57:10 GMT
Content-Type: text/json
Content-Length: 16

{"vhosts":["/"]}

# Viewing a specific vhost
curl -i http://localhost:9999/vhosts/barneys%20list
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:59:29 GMT
Content-Type: text/json
Content-Length: 25

{"vhosts":"barneys list"}

# If it doesn't exist:
curl -i http://localhost:9999/vhosts/barneys%20listings
HTTP/1.1 400 Bad Request
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:59:59 GMT
Content-Type: text/json
Content-Length: 34

{"barneys listings":"not a vhost"}

# Add a vhost
curl -i http://localhost:9999/vhosts -XPOST -d'{"name":"barneys list"}'
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 07:58:09 GMT
Content-Type: text/json
Content-Length: 31

{"vhosts":["/","barneys list"]}

# Delete a vhost
curl -XDELETE -i http://localhost:9999/vhosts/barneys%20list
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:02:44 GMT
Content-Type: text/json
Content-Length: 16

{"vhosts":["/"]}

Now, there is a module in the Alice called control. There are a lot of routes and a lot of functionality built-in here, so let's dig in.

Control


# Getting the status of the server
curl -i http://localhost:9999/control 
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:05:19 GMT
Content-Type: text/json
Content-Length: 151

{"status":[{"applications":["rabbit","mnesia","os_mon","sasl","stdlib","kernel"], \
"nodes":["rabbit@YPCMC05591"],"running_nodes":["rabbit@YPCMC05591"]}]}

# Stopping the rabbitmq-server
curl -XPOST -i http://localhost:9999/control/stop  
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:06:02 GMT
Content-Type: text/json
Content-Length: 20

{"status":"stopped"}

# Starting the rabbitmq-server application
curl -XPOST -i http://localhost:9999/control/start_app
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:06:50 GMT
Content-Type: text/json
Content-Length: 20

{"status":"started"}

# Stopping the rabbitmq-server application
curl -XDELETE -i http://localhost:9999/control/stop_app
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:15:56 GMT
Content-Type: text/json
Content-Length: 20

{"status":"stopped"}

# Reset the rabbitmq-server application
curl -XPOST -i http://localhost:9999/control/reset    
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:07:15 GMT
Content-Type: text/json
Content-Length: 18

{"status":"reset"}

# Or force-resetting the server
curl -XPOST -i http://localhost:9999/control/force_reset
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:07:27 GMT
Content-Type: text/json
Content-Length: 18

{"status":"reset"}

# Clustering a set of nodes
curl -XPOST -i http://localhost:9999/control/cluster -d'{"nodes":["bob@otherhost"]}'
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:14:10 GMT
Content-Type: text/json
Content-Length: 20

{"status":"cluster"}

# Rotating rabbit logs
curl -XPOST -i http://localhost:9999/control/rotate_logs -d'{"prefix":"mn_"}'
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:15:12 GMT
Content-Type: text/json
Content-Length: 25

{"status":"rotated_logs"}

Extending

Alice is written with the intention of being highly extensible and makes it easy to do so. The controllers respond only to the four verbs with pattern-matching on the routes.

For instance, a very basic controller looks like this:


-module (say).
-export ([get/1, post/2, put/2, delete/2]).

get([]) -> {"hello", <<"world">>};
get(_Path) -> {"error", <<"unhandled">>}.

post(_Path, _Data) -> {"error", <<"unhandled">>}.
put(_Path, _Data) -> {"error", <<"unhandled">>}.
delete(_Path, _Data) -> {"error", <<"unhandled">>}.

There are the 4 RESTful verbs that the controller responds. Now, if you were to compile this in Alice (in src/rest_server/controllers), then the route http://localhost:9999/say would now be accessible. Cool!


curl -i http://localhost:9999/say
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:20:57 GMT
Content-Type: text/json
Content-Length: 17

{"hello":"world"}

Now let's add a route to say hello to someone:


-module (say).
-export ([get/1, post/2, put/2, delete/2]).

get([Name]) -> {"hello", erlang:list_to_binary(Name)};
get([]) -> {"hello", <<"world">>};
% ....

curl -i http://localhost:9999/say/ari
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:21:54 GMT
Content-Type: text/json
Content-Length: 15

{"hello":"ari"}

Finally, with every other verb than get, we are given data to extract. Let's see how to pull some data in a post. The data is given as a proplist with binary keys, we it's pretty easy to pull them out:


% ...
post([], Data) ->
  Name = erlang:binary_to_list(proplists:get_value(<<"name">>, Data)),
  {"hello back", erlang:list_to_binary(Name)};
post([]) -> 
% ...

Let's check it:


curl -i http://localhost:9999/say -XPOST -d'{"name":"ari"}'
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Tue, 04 Aug 2009 08:23:54 GMT
Content-Type: text/json
Content-Length: 20

{"hello back":"ari"}

It's as easy as pie to extend Alice.

Wonderland

Wonderland is the webUI to Alice. It is driven by the javascript framework Sammy and Alice in the backend. Because the framework is client-side and accesses the data through ajax, Wonderland can be deployed nearly anywhere.

Quickstart


cd alice
make wonderland

Community

Or feel free to ping me on email (arilerner dot mac dot com) if you have any questions.

More Repositories

1

poolparty

Run a self-healing, auto-scaled and monitored cloud simply, in the clouds, on nearly any hardware, such as EC2, eucalyptus and vmware
Ruby
358
star
2

ng-newsletter-beginner-series

The official repository of the beginner series tutorial on ng-newsletter.com
149
star
3

beehive

Honeycombs of applications
Erlang
131
star
4

wonderland

The front-end to alice
91
star
5

cloudfoundry-quickstart

Quickstart with cloudfoundry
Ruby
33
star
6

erlfs

A distributed storage system which uses distributed Erlang strongly influenced by http://dawsdesign.com/drupal/erlfs
Erlang
26
star
7

ffmpegger

Why should high quality video encoding be hard?
Ruby
20
star
8

exauthly

Elixir authentication, member management, subscription app
Elixir
19
star
9

dslify

Easily add DSL accessors to any class without bothering to mess with the gory details of their implementation
Ruby
14
star
10

erlproject_template

Erlang template for projects
Erlang
10
star
11

backcall

Super lightweight, memory-efficient callback methods
Ruby
10
star
12

skelerl

Erlang skeleton application
Ruby
9
star
13

girls

Girls
9
star
14

converse

Custom distributed erlang
Erlang
9
star
15

cloudfoundry-cookbook

cloudfoundry-cookbook
Ruby
9
star
16

suitcase

Easy-peasy transfer of bulk files with the Suitcase!
Ruby
8
star
17

docker-tensorflow-ipython-celery-rest-server

The name of the repo pretty much sums it up. Buzzwords included
Python
7
star
18

glitter

Glitter on top of gitolite
Erlang
7
star
19

babysitter

Babysit thin processes
C
7
star
20

poolparty-plugins

Extensions on PoolParty
Ruby
7
star
21

rosen

The git repos of rosen: http://sourceforge.net/projects/rosen/
Erlang
6
star
22

saltcli

Salt cli in python
Python
6
star
23

states

My collection of salt states
Python
6
star
24

testing-example

JavaScript
6
star
25

tailor

A log tail-er, written in erlang
Erlang
6
star
26

layers

A convenience layer to layer erlang apps
Erlang
6
star
27

token-swap-dapp

A simple dapp for handling token swaps
JavaScript
5
star
28

configerl

Easy configuration parsing
Erlang
5
star
29

parenting

Parenting is a tough task, this lil gem makes it pretty easy
Ruby
5
star
30

codemirror-interactive-numbers

Drag and update literal numbers inside codemirror
JavaScript
5
star
31

torquebox-cookbook

Torquebox cookbook
Ruby
5
star
32

birthday

Add your birthday to the list! (experiment)
5
star
33

30-days-of-react-demo

30 days of react demo site
JavaScript
5
star
34

hermes

The messenger of the gods
Erlang
5
star
35

temporarily-linkable

Temporary link plugin. Easily create temporary links that expire after use or a time frame
Ruby
5
star
36

ruberl

A quick and easy way you can easily talk to your gen_tcp/gen_server erlang server
Ruby
5
star
37

poolparty-website

The poolparty website
JavaScript
4
star
38

auser.github.com

Webpage
4
star
39

whisper

A security layer to provide some basic encryption
Erlang
4
star
40

butterfly

An HTTP mini server to query against modular adaptors
Ruby
4
star
41

local132

A generic worker pool implementation in erlang
Erlang
4
star
42

squirrel

A super lightweight queuing library in erlang.
Erlang
4
star
43

crater

A quick and dirty crater of files that can take a directory of files and concatenate them together for dirty packaging. It even minimizes them too!
JavaScript
4
star
44

eoshuffle

A nicer interface for working with EOS
JavaScript
4
star
45

pocket_watch

An amqp hashtable implementation with object persistence
Ruby
4
star
46

erlosis

An erlangy tool to manage gitosis
Erlang
4
star
47

babel-plugin-replace-config-vars

Use config variables with babel to handle different environments
JavaScript
4
star
48

salt-cli

A ruby gem to interact with salt on different providers from a local machine
Ruby
4
star
49

incredibly_simple_rack_app

Just a super simple rack app
Ruby
4
star
50

rabbithole

A library for dealing with queues in erlang
Erlang
4
star
51

columbus

Service discovery awesomeness
Ruby
3
star
52

troph

A simple amqp daemonizer dsl. Build your own nanite
Ruby
3
star
53

aska

Rule-based parser
Ruby
3
star
54

where

Chord-layer
Erlang
3
star
55

cpputest

CppUTest source
C++
3
star
56

sample-rails-app

Sample rails app to show off PoolParty goodness
Ruby
3
star
57

layers-test-app

Layers test app
Erlang
3
star
58

getbeehive.com

beehive website
JavaScript
3
star
59

neotoma_template

A generic template with some rules in it for starting and running with neotoma
Erlang
3
star
60

processor

The process manager in babysitter
C++
3
star
61

mkerl

The very basic erlang template, with tests
Erlang
3
star
62

letsparty

Distributed event system in clojure
Clojure
3
star
63

macmap

A single method to provide a map of network interfaces to their corresponding ip addresses from ifconfig
Ruby
2
star
64

metavirt

Ruby
2
star
65

EditingBay

The cocoa front-end for LIMP
2
star
66

lil-snap

Demo sinatra app for presentation
2
star
67

paparazzi

Demo rails app for presentation
Ruby
2
star
68

colors

Add colors to your terminal output
Ruby
2
star
69

bootstrapper

A simple, extendable bootstrapper
Ruby
2
star
70

who

An authentication layer for the layers framework
2
star
71

searchable_paths

TODO: one-line summary of your gem
Ruby
2
star
72

rackapp

rackapp demo
2
star
73

baker

Chef cookbook compiler (extracted from PoolParty)
Ruby
2
star
74

reloadable

Reloader because it's easier to reload then restart
2
star
75

fast-react-starter

Fast react starter
JavaScript
2
star
76

isolate

Utility for isolating Unix processes, minimizing their privilege [git clone from the google page]
C++
2
star
77

xsearch

stripe hackathon fun
JavaScript
2
star
78

confucious

Configuration helper module
Ruby
2
star
79

Vancam

An opencv project for fun
C++
2
star
80

catalyst

Build your own middleware run stack
Ruby
2
star
81

v8erl

Clone of http://bitbucket.org/jlatt/v8erl/
C++
2
star
82

docpad-plugin-permalinks

Add permalinks to your posts
JavaScript
2
star
83

xnot.org

Repos for xnot.org
Ruby
2
star
84

UnitTest-cpp

UnitTest++ mirror
2
star
85

seti-home

I wanted seti@home in git, so this is a clone of the svn repos: http://setiathome.berkeley.edu/sah_porting.php
2
star
86

beehivetalk-at-lonestar-ruby-conference-10

Beehive talk at Lonestar Ruby Conference 2010
JavaScript
2
star
87

react-16-app

Talk for react next 2017
JavaScript
2
star
88

qwik-demo

Demo qwik
TypeScript
1
star
89

pgmem

In-memory database (rust + js)
Rust
1
star
90

erlrrd

A mirror of erlrrd that provides bindings for the rrdtool
1
star
91

sample-svgr-bug

JavaScript
1
star
92

translate-backend

node backend for translation demo
JavaScript
1
star
93

pydock

A docker thing
Jupyter Notebook
1
star
94

rigdata

Ruby meetup 03/27/13 demo
CoffeeScript
1
star
95

hackbright-react-intro

Hackbright react intro presentation
JavaScript
1
star
96

payload-plugin-markdown-field

Markdown field for PayloadCMS
TypeScript
1
star
97

aws-dev-machine

A bootstrapping set of scripts to get your windows or mac machine set-up with developer tooling and a bunch of other goodies
PowerShell
1
star