Skip to content

Commit

Permalink
Import existing code
Browse files Browse the repository at this point in the history
Fix #CE-1.

Change-Id: I974454bd68abba5fb3b90868fabd72e5c2bfcf9f
Signed-off-by: Baohua Yang <baohyang@cn.ibm.com>
  • Loading branch information
yeasy committed Jan 12, 2017
1 parent 7271a4e commit 6cd660e
Show file tree
Hide file tree
Showing 100 changed files with 8,115 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
@@ -0,0 +1,6 @@
.git
.tox
test*
Dockerfile*
*~
screenshots
39 changes: 39 additions & 0 deletions Makefile
@@ -0,0 +1,39 @@
.PHONY: \
all \
check \
clean \
log \
logs \
redeploy \
restart \
setup \

all: check

check:
tox

clean:
rm -rf .tox

# Use like "make log service=dashboard"
log:
docker-compose logs -f ${service} --tail=100

logs:
docker-compose logs -f --tail=100

# Use like "make redeploy service=dashboard"
redeploy:
bash scripts/redeploy.sh ${service}

start:
bash scripts/start.sh

stop:
bash scripts/stop.sh

restart: stop start

setup:
bash scripts/setup.sh
57 changes: 54 additions & 3 deletions README.md
@@ -1,4 +1,55 @@
Cello
===
![Cello](docs/imgs/logo.png)

TBD.
[![Build Status](https://travis-ci.org/yeasy/cello.svg?branch=dev)](https://travis-ci.org/yeasy/cello)

Platform to provide Blockchain as a Service!

Using Cello, we can

* Provision customizable Blockchains instantly, e.g., a 6-node chain using PBFT consensus.
* Maintain a pool of running blockchains healthy with no manual operations.
* Check the system status, scale the chain numbers, change resources... through a dashboard.

![Typical Scenario](docs/imgs/scenario.png)

You can also find more [scenarios](docs/scenario.md).

## Features

* Manage the lifecycle of blockchains, e.g., create/delete/keep health automatically.
* Response nearly instantly, even with hundreds of chains, or nodes.
* Support customized (e.g., size, consensus) blockchains request, currently we support [hyperledger fabric](https://github.com/hyperledger/fabric).
* Support native Docker host or swarm host as the compute nodes, more supports on the way.
* Support heterogeneous architecture, e.g., Z, Power and X86, from bare-metal servers to virtual machines.
* Extend with monitor/log/health features by employing additional components.

## Docs

### User Docs
* [Dashboard](docs/dashboard.md)

### Operator Docs
* [Installation & Deployment](docs/deployment.md)
* [Scenarios](docs/scenario.md)
* [Production Configuration](docs/production_config.md)

### Development Docs
* [Architecture Design](docs/arch.md)
* [Database Model](docs/db.md)
* [API](api/restserver_v2.md)

## TODO
* restserver: update api definitions yml files.
* dashboard: support auto state fresh based on websocket.
* dashboard: support return code checking in response.
* dashboard: support user page.
* engine: support advanced scheduling.
* engine: support more-efficient fill-up.
* engine: enhance the robustness for chain operations.
* engine: support membersrvc option.

## Why named Cello?
Can u find anyone better at playing chains? :)

## Author
Designed and maintained by [Baohua Yang](https://yeasy.github.com).
158 changes: 158 additions & 0 deletions api/dashboard.yaml
@@ -0,0 +1,158 @@
# this is an example of the Cello API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Cello API
description: Cello API to manage cluster
contact:
name: Baohua Yang
url: https://github.com/yeasy/cello
email: yangbaohua@gmail.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: "1.0.0"
# the domain of the service
host: 9.186.100.88:80
# array of all schemes that your API supports
schemes:
- http
# will be prefixed to all paths
basePath: /admin
produces:
- application/json
paths:
/clusters:
get:
summary: A list of all clusters
description: |
The Clusters endpoint returns information about all existing clusters.
The response includes the display name
and other details about each cluster, and lists the clusters in the
proper display order.
parameters:
- name: daemon_url
in: query
description: Filter clusters with specific daemon_url.
required: false
type: string
- name: user_id
in: query
description: Filter clusters with specific user_id.
required: false
type: string
tags:
- Clusters
responses:
200:
description: An array of clusters
schema:
type: array
items:
$ref: '#/definitions/Cluster'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
/cluster:
get:
summary: Retrieve a special cluster
description: |
The endpoint returns information about specific cluster.
The response includes necessary info.
parameters:
- name: cluster_id
in: query
description: Filter clusters with specific cluster_id.
required: true
type: string
tags:
- Cluster
responses:
200:
description: A cluster instance
schema:
$ref: '#/definitions/Cluster'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
post:
summary: Create a special cluster
description: |
The endpoint create a specific cluster
The response includes necessary info.
parameters:
- name: daemon_url
in: query
description: Given the daemon_url to create at
required: true
type: string
- name: cluster_name
in: query
description: Given the name
required: false
type: string
tags:
- Cluster
responses:
200:
description: A cluster instance created
schema:
$ref: '#/definitions/Cluster'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
delete:
summary: Delete a special cluster
description: |
The endpoint deletes a specific cluster
The response includes necessary info.
parameters:
- name: cluster_id
in: query
description: Filter clusters with specific cluster_id.
required: true
type: string
tags:
- Cluster
responses:
200:
description: A cluster instance delete info
type: string (TODO)
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
Cluster:
type: object
required: [id, user_id, api_url]
properties:
id:
type: string
description: Unique identifier representing a specific cluster.
user_id:
type: string
description: User id who owns this cluster, empty by default
api_url:
type: string
description: Cluster REST URL representing the cluster.
daemon_url:
type: string
description: Docker host daemon url
name:
type: string
description: Display name of cluster.
Error:
type: object
required: [code]
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string
42 changes: 42 additions & 0 deletions api/restserver_v1.md
@@ -0,0 +1,42 @@
# API V1

**Deprecated.**

## Front
These APIs will be called by front web services.

Latest version please see [restserver.yaml](restserver.yaml).

### cluster_apply

Find an available cluster in the pool for a user.

```
GET /v1/cluster_apply?user_id=xxx&consensus_plugin=pbft&consensus_mode
=classic&size=4&new=0
```

if add `new=1`, then ignore matched clusters that user already occupy.

When `cluster_apply` request arrives, the server will try checking available cluster in the pool.

Accordingly, the server will return a json response (succeed or fail).

### cluster_release

Declare the id to release a cluster.

```
GET /v1/cluster_release?cluster_id=xxxxxxxx
```

Rlease all clusters under a user account.
```
GET /v1/cluster_release?user_id=xxxxxxxx
```
The server will drop the corresponding cluster, recreate it and put into available pool for future requests.


## Admin
Those APIs should not be called by outside applications. Just for
information, please see [api-admin.yaml](api-admin.yaml)

0 comments on commit 6cd660e

Please sign in to comment.