Unified PaaS Library
Maintainer: Román SG
The Unified PaaS Library provides a uniform API to manage applications on PaaS providers.
Depending on the supported provider, it accepts deploying applications by:
- uploading a binary or source code artifact (e.g., a zip containing the code of a NodeJS app or a WAR);
- specifying the GIT URL of the code to deploy;
- specifying the name of a Docker image.
To run agile-paas-deployer as an AGILE container, include the following in your agile-stack Dockerfile: https://github.com/Agile-IoT/agile-stack/commit/bdf106750e32e4135ed1b6b7f380d688a35f2201
-
Compile project
$ mvn install
-
Start server
$ cd service; bin/runserver.sh
-
Deploy an application
$ curl http://localhost:8002/api/heroku/applications -X POST
-F file=@""
-F model='{"name":"samplewar"}'
-H"Content-Type: multipart/form-data"
-H'X-PaaS-Credentials:{"api-key":""}'
Each supported PaaS is a resource on /api. For example, Heroku is on /api/heroku.
Each invocation to the API must contain the credentials in the X-PaaS-Credentials header, in json format. See below for specific instructions per provider.
These are the supported operations:
Return a list of the supported subpaths.
$ curl localhost:8002/api
{
"openshift.com":{
"name":"OpenShift Online",
"url":"https://openshift.redhat.com",
"versions":["v2","v3"],
"defaultVersion":"v2"
},
"pivotal":{
...
}
...
}
Return a description of the provider.
$ curl localhost:8002/api/heroku
{"name":"Heroku","url":"https://api.heroku.com/","versions":["v3"],"defaultVersion":"v3"}
Creates an application and deploy its artifact. The request is a multipart request with two fields:
- model: contains information about the application, modelled by the ApplicationToCreate class (see below). The name of the application is here, and is used to refer to the application in the rest of operations.
- file: the bytes of the artifact, in case we are uploading an artifact.
Examples:
$ curl http://localhost:8080/api/heroku/applications -X POST -F file=@"<FILE>" \
-F model='{"name":"<APP_NAME>"}' \
-H"Content-Type: multipart/form-data"
$ curl http://localhost:8080/api/pivotal/applications -X POST -F file=@"<FILE>" \
-F model='{"name":"<APP_NAME>", "properties": { "buildpack_url": "https://github.com/cloudfoundry/nodejs-buildpack.git#v1.3.4" }'} \
-H"Content-Type: multipart/form-data"
Currently, only single-file nodeJS deployments are supported.
$ curl http://localhost:8080/api/openwhisk/applications -X POST \
-F file=@"library/src/test/resources/demo-function.js" \
-F model='{"name":"function", "programmingLanguage":"Node.JS"}' \
-H"Content-Type: multipart/form-data"
Returns the status of an application. See Application class.
TODO: example
Removes an application
TODO: example
Starts an application
TODO: example
Stops an application
TODO: example
Scales up/down an application adding or removing an instance. Updown have value up
or down
TODO: example
Scales the resource 'type' an application by setting 'value' units.
Supported types:
- instances
- memory
- disk
(TO BE COMPLETED)
TODO: example
Each invocation to the API must contain the credentials in the X-PaaS-Credentials header in the request. The credentials are serialized in json format, optionally encoded in base64. The fields to be filled in the json for each provider are shown below.
api-key
api
user
password
org
space
user
password
org
space
user
password
api
user
password
Integration tests are run in integration-test
profile. Each integration test
have a group according to the PaaS provider being tested. By default, the
profile only run tests in dummy group (the dummy provider is a fake provider).
The provider to test can be changed passing an integration.groups parameter
to the mvn command.
Ex:
mvn verify -P integration-test -Dintegration.groups=openshift2,cloudfoundry
- Set values in /library/src/test/resources/tests.config.properties
- Start instance of service:
cd service && bin/runserver.sh
- Execute tests:
mvn clean verify -P integration-test [-Dintegration.groups=...]
Java client libraries used in the project:
- Cloud Foundry: Cloud Foundry Java Client
- Description
- The cf-java-client project is a Java language binding for interacting with a Cloud Foundry instance (including PaaS providers like Pivotal, Bluemix etc.).
- Features
Feature | Supported? | Comments |
---|---|---|
Application deployment | ✅ | Tested with Java and PHP apps |
Start / Stop / Remove | ✅ | ➖ |
Scaling capabilities | ✅ | Can scale number of instances, disk and RAM |
Services management | ✅ | Tested with ClearDB from Pivotal |
Environment variables management | ✅ | Read & Write |
| Limitations / Comments | | ------------- || | ➖ |
- 🆕 Cloud Foundry (new version) : Cloud Foundry Java Client
- Description
- The new version of the cf-java-client project is based on Java 8 and [Project Reactor](https://projectreactor.io/) (a second-generation Reactive library for building non-blocking applications on the JVM based on the Reactive Streams Specification).
- Features
- -Not implemented-
- Heroku: Heroku JAR & heroku-maven-plugin
- Description
- [Heroku JAR](https://github.com/heroku/heroku.jar): The Heroku JAR is a java artifact that provides a simple wrapper for the Heroku REST API. The Heroku REST API allows Heroku users to manage their accounts, applications, addons, and other aspects related to Heroku.
- [heroku-maven-plugin](https://github.com/heroku/heroku-maven-plugin): This plugin is used to deploy Java applications directly to Heroku without pushing to a Git repository. This is can be useful when deploying from a CI server, deploying pre-built Jar or War files.
- Features
Feature | Supported? | Comments |
---|---|---|
Application deployment | ✅ | Tested with Java |
Start / Stop / Remove | ✅ | ➖ |
Scaling capabilities | ✅ | Can scale number of instances |
Services management | ✅ | Tested with ClearDB from Pivotal |
Environment variables management | ✅ | Read & Write |
- OpenShift v2: OpenShift Java Client (used by Openshift Online / only for Version 2)
- Description
- Java client for the OpenShift REST API. This client is used by JBoss Tools for OpenShift 2.x.
- Features
Feature | Supported? | Comments |
---|---|---|
Application deployment | ✅ | ❗ Only from GIT |
Start / Stop / Remove | ✅ | ➖ |
Scaling capabilities | ✅ | Can scale number of instances |
Services management | ✅ | Tested with MySQL from Openshift Online |
Environment variables management | ❌ | ➖ |
- 🆕 Openshift v3 (new version for the version 3 architecture of OpenShift based on Kubernetes: OpenShift Enterprise, local Openshift installations ...)
- Description
- -Not implemented-
- Features
- ➖
Client | Version used | License | Comments |
---|---|---|---|
Cloud Foundry | 1.1.3 | Apache License v2 | ➖ |
🆕 Cloud Foundry | ➖ | Apache License v2 | ➖ |
Heroku | 0.16 / 0.5.7** | ➖ / MIT License** | ➖ |
Openshift v2 | 2.7.0.Final | Eclipse Public License v1.0 | ➖ |
🆕 Openshift v3 | ➖ | ➖ | ➖ |