Eclipse Kapua™ is a modular platform providing the services required to manage IoT gateways and smart edge devices. Kapua provides a core integration framework and an initial set of core IoT services including a device registry, device management services, messaging services, data management, and application enablement.
Running an Eclipse Kapua™ demo instance on your local machine is a simple task.
Eclipse Kapua™ runs as distributed application that exposes three basic services:
- The Messaging Service
- The RESTful API
- The Web Administration Console
Two more backend services are required that implement the data tier:
- The Event Bus Service
- The SQL database
- The NoSQL datastore
Eclipse Kapua™ can be deployed in a variety of modes. A practical way for running a local demo is through Docker containers.
Before starting, check that your environment has the following prerequisites:
- 64 bit architecture
- Java VM Version 8
- Docker Version 1.2+
- Internet Access (needed to download the artifacts)
The team maintains some docker images in a Docker Hub repository at Kapua Repository. Check the repo to view the list of available images, if you haven't found one fitting your needs you may create your own. Please refer to the paragraph More deployment info to find more about creating your own images and/or alternative demo deployment scenarios.
Note: the Docker Hub repository mentioned above is not the official project repository from Eclipse Foundation.
Suppose the target is the current snapshot 1.6.0-SNAPSHOT.
- Clone Eclipse Kapua™ into a local directory
- Open an OS shell and move to Kapua project root directory
- Start Docker runtime
- Start Kapua:
On Linux/MacOS:
./deployment/docker/unix/docker-deploy.sh
On Windows (PowerShell):
./deployment/docker/win/docker-deploy.ps1
The command starts all the Kapua containers using Docker Compose.
By default, the latest
version of images will be used. If you want to run some other version of Kapua, set the IMAGE_VERSION
environment variable, for example:
export IMAGE_VERSION=0.2.0
You can check if the containers are running by typing the following command:
docker ps -as
Docker will list the containers currently running.
To stop Kapua, run
On Linux/MacOS:
./deployment/docker/unix/docker-undeploy.sh
On Windows (PowerShell):
./deployment/docker/win/docker-undeploy.ps1
Once the containers are running, the Kapua services can be accessed. Eclipse Kapua™ is a multi tenant system. The demo installation comes with one default tenant, called kapua-sys, which is also the root tenant. In Eclipse Kapua™ a tenant is commonly referred to as an account.
The administration console is available at http://localhost:8080/. Copy paste the URL above to a Web browser, as the login screen appears, type the following credentials:
- Username:
kapua-sys
- Password:
kapua-password
Press Login button and start working with the console.
Note: If you are using Docker on Windows the hostname will most likely not be localhost
but
the IP address of your docker instance.
The documentation of RESTful API is available at http://localhost:8081/doc/ while the mount points are available at http://localhost:8081/v1/.
The documentation is available through Swagger UI which greatly helps testing and exploring the exposed services.
In order to get access a REST resource through an API, an authentication token is needed. Fortunately the token can be easily obtained by executing the authentication API. There are several ways to invoke the API, an easy one is by using the Swagger UI:
- Open the URL http://localhost:8081/doc/
- Select item Authentication
- Select item /authentication/user
- Using the test feature run 'POST /authentication/user' by specifying the following body:
{
"password" : [ "kapua-password" ],
"username": "kapua-sys"
}
Note: as an alternative to the previous, if curl is available on your machine, execute the following from the shell:
curl -X POST 'http://localhost:8081/v1/authentication/user' --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"password": [
"kapua-password"
],
"username": "kapua-sys"
}'
The system will return a JSON object.
- Copy the value of the field tokenId
- Paste the value in the box labelled api_key at the top of the web page
Swagger will automatically add the authentication token to each subsequent request done using the Swagger UI. You're ready to try executing the documented APIs.
Note: If you are using Docker on Windows the hostname will most likely not be localhost
but
the IP address of your docker instance.
The broker container exposes an Mqtt end point at tcp://localhost:1883/. The broker can be accessed through either Eclipse Kura™ or a plain Mqtt client like, for example, Eclipse Paho™.
In order for a client to establish a Mqtt connection with the broker, a client must provide a valid identity. The kapua-sys account provides the user named kapua-broker which has been pre-seeded and profiled for the purpose.
The credentials for the user kapua-broker are the following:
- Username:
kapua-broker
- Password:
kapua-password
Note: do not use the user kapua-sys
to establish Mqtt connections.
Note: If you are using Docker on Windows the hostname will most likely not be localhost
but
the IP address of your docker instance.
Kapua comes with a framework that you can use to simulate Kura gateways. It can be used to test your Kapua deployments easily. See Simulator documentation for more info.
Installing and running a demo using Docker is easy, but it's not the only way. There are other scenarios that the users may be interested in. We provide advanced setup scenarios in the following guides:
They will provide more advanced deployment scenarios.
If you're interested to get involved in IoT and Eclipse Kapua™ project, join the community and give your contribution to the project, please read how to contribute to Eclipse Kapua™.
Thanks to YourKit for providing us an open source license of YourKit Java Profiler!
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor.