KNoT Cloud is a cloud computing solution that enables operating on IoT devices by providing a minimum messaging and management infrastructure. It includes device and authentication management services as well as APIs for sending commands to the things and collect data from their sensors. Please, check out the official documentation for more information.
Currently, the KNoT Cloud is built over Meshblu services which were demonstrated to have a low performance when running on some constrained environment such as the Fog Computing layer. For that reason, it is being rebuild with faster management services and messaging mechanisms that facilitate the evolution and its usage in several environments (some of these service are part of Mainflux platform). In this documentation, the actual version is still referred to as cloud
and the solution that is under development is referred to as core
.
Stacks for development and production environments are provided in order to assist the user's needs. The development stack must be used if one needs to modify any of the components of the stack. A command line tool will download the source for each component and plug it into the containers, which all have hot reload enabled. The production stack must be used in all other cases.
The provided stacks and CLI contained in this repository aren't yet published in any package manager, hence it is necessary that you clone the repository or download the .zip
containing all the files.
git clone https://github.com/CESARBR/knot-cloud.git
The following instructions always assume you are in the directory created after cloning the repository. If you downloaded the .zip
, navigate to the appropriate folder.
If you intend to use the development stack, a command line tool that downloads and configures the stack is required.
npm install -g @cesarbr/knot-cloud
The development stack must be created using the tool described in the previous section. Firstly, inform which stack
you want to create: cloud
or core
(defaults to cloud
). Lastly, Choose a <path>
where the stack should be created (defaults to the current directory) and then run:
NOTE: The following command assumes you don't have a workspace with the repositories and clone them. To disable this, run it with the
--no-clone
flag.
knot-cloud init [stack] [path]
The source code and stack template files will be created under <path>/stack
.
In the moment, the cloud
stack is the only with production support. It comes in two flavours: all-in-one and multinode. The former will deploy all the services on a single machine while the latter will deploy them in multiple nodes (at least two). The files for the two flavours are available at stacks/knot-cloud/prod
.
On the contrary, the core
stack is currently under development and can be deployed for test purposes. It is organized in a similar way of the cloud
stack but its definition is structured with multiple compose files, aiming to improve usability. The files are available at stacks/core
.
In your deployment machine, initialize Docker Swarm mode:
docker swarm init
In case you are deploying to multiple nodes, all the nodes must be connected to the same swarm. In this case, run the command above in the machine that must be the swarm manager and run docker swarm join
in all other nodes, as instructed by the execution of docker swarm init
in the manager machine. Check the Docker Swarm documentation for more on how to setup your cluster.
After this point, follow the specific instructions to configure and deploy the created stack:
If you want to stop your stack from running or even leave the Docker Swarm mode, execute the commands below:
docker stack rm <knot-cloud|knot-cloud-core>
and
docker swarm leave