occiware / OCCInterface

OCCI API developer online playground
MIT License
3 stars 1 forks source link

Build Status

OCCInterface

OCCInterface is a generic application which let you explore and modify the resources of an OCCI server. Its aims are multiple:

A demo is avalaible here : http://occinterface.herokuapp.com/

./assets/screenOccinterface.png

How to use it

Through a docker image

If you have Docker installed (if not, you can find how to do so here), and don't want to mess with your pre-existing dev environment, you may prefer this to the next section ("How to build and run it locally").

git clone https://github.com/occiware/occiware-ozwillo.git
cd occiware-ozwillo/docker/occinterface
sudo docker build -t occinterface .
sudo docker run -p 3000:3000 occinterface

Or build and run it locally

Requirement : (some versions bellow should work too but have not been tested)

NB. an easy way to install both, whatever the version of node you already have, is to install nvm :

sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
nvm install v6.2.0

Build and run :

git clone https://github.com/occiware/OCCInterface.git
npm install
npm run dev

You can go to http://localhost:3000/.

Then, you need to enter the URL of the OCCI server on the input at the top of the page (without "/" at the end)

How to integrate it in your own OCCI implementation

TODO

FAQ

text before %{
  "text": "sampleLink",
  "post": {
    "address": "/compute",
    "datas": {
      "kind":"http://schemas.ogf.org/occi/infrastructure#compute",
      "attributes": {
        "occi.compute.hostname" : "test",
        "occi.compute.state" : "inactive"
      },
      "id": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
    }
  }
}% text after

It will result into a clickable link, which will post or put datas on click:

<p>text before <a>sampleLink</a> text after</p>

You can post an array instead of an object (in the "datas" attribute). It can be put instead of posted, by using the "put" key instead of the "post" one.

If you want your sample link to post to different categories, just put an array instead of an object inside the "post" attribute. Example :

%{
  "text": "sampleLink",
  "post": [
    {
        "address": "/compute",
        "kind":"http://schemas.ogf.org/occi/infrastructure#compute",
        "datas": {
          "attributes": {
            "occi.compute.hostname" : "test",
            "occi.compute.state" : "inactive"
          },
          "id": "6df690d2-3158-40c4-88fb-d1c41584d6e5"
        }
    },
    {
        "address": "/storage",
        "datas": [
            {
              "kind":"http://schemas.ogf.org/occi/infrastructure#storage",
              "attributes": {
                "occi.storage.size" : 1000
              },
              "id": "6df690d2-3158-40c4-88fb-d1c41584d6e6"
            },
            {
              "kind":"http://schemas.ogf.org/occi/infrastructure#storage",
              "attributes": {
                "occi.storage.size" : 500
              },
              "id": "6df690d2-3158-40c4-88fb-d1c41584d689"
            }
        ]
    }
  ]
}%
%{
  "text": "my sample link",
  "del": "/6df690d2-3158-40c4-88fb-d1c41584d6e7"
}%
text before %{
  "text": "my sample action link",
  "post": {
    "address": "/compute/6df690d2-3158-40c4-88fb-d1c41584d6e5?action=stop",
    "datas": {
      "action":"http://schemas.ogf.org/occi/infrastructure/compute/action#stop",
      "attributes": {
        "method": "graceful"
      }
    }
  }
}% text after
#need to be done once
heroku git:remote -a herokiRepo
npm run build
git commit -am "deployment message"
git push heroku master

OCCInterface with the MART server

Follow the instructions of the MART server : check it out, then do

mvn initialize
mvn clean install
mvn exec:java

Beware, there are several differences between MART and erocci, though OCCInterface does its best to work with both.

OCCInterface with the erocci server

How to configure your Erocci Server :

Follow the instructions of erocci

Then, you need to edit the config/sys.config file. Find the "backend" section, and modify it that way :

{backends,
    [
     {root, erocci_backend_mnesia,
      [{schema, "/path/to/config.xml"}],
      <<"/">>}
    ]
   }

Copy locally and use this file as the config.xml file.

Then, you can start the server with

./start.sh