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
- Java VM Version 11
- Docker Version 1.2+
- Swagger CLI 4+ (Installed via NPM or separately)
- Node 16+
- 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 2.1.0-SNAPSHOT.
- Clone Eclipse Kapuaâ„¢ into a local directory
- Open an OS shell and move to Kapua project root directory
- Start Docker runtime
The Kapua repository mentioned above hosts only images of released versions. It is possible to test different versions of Kapua doing a checkout into
the release branches (for example, "release-1.6.x") and to the tagged commits to select the specific version (for example, the commit tagged as "1.6.7"). Doing so, it is assured
that the following step will pull proper images from the Docker Hub. If, on the other hand, your target is a SNAPSHOT version (for example, the 2.1.0-SNAPSHOT), a local build is required
in order to create the docker images and proceed to the next step. Instructions for building can be found in the building.md file under the path docs/developer-guide.
Assuming that your interest is to deploy a release before 2.0.0 and that you want to pull images from the Docker Hub, it is important to set now the
IMAGE_VERSION
environment variable with a value equal to the target version. For example, in the case of the 1.6.7
export IMAGE_VERSION=1.6.7
- 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.
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.