The STH component provides 3 alternatives for its installation:
- Cloning the GitHub repository
- Automatic deployment using Docker
To install the STH component cloning the GitHub repository, please follow the next steps:
- Clone the repository.
- Get into the directory where the STH repository has been cloned.
- Install the Node.js modules and dependencies.
This is:
git clone https://github.com/telefonicaid/fiware-sth-comet.git
cd fiware-sth-comet/
npm install
The STH component server is ready to be started as a Node application.
To ease the testing and deployment of the STH component, there also exists Docker images hosted at the FIWARE Docker Hub, including all the information needed to deploy and to try the STH component via the execution of a simple Docker command.
On the other hand a Dockerfile
and a
docker-compose.yml
files have also
been included in the component repository in GitHub to quickly and easily start your own instance of the STH component,
even including the needed associated MongoDB instance where all the data will be stored.
To do it, follow the next steps once you have installed Docker in your machine:
- Navigate to the path where the component repository was cloned.
- Compose and run the STH component image
- In foreground mode:
sudo docker-compose -f docker-compose.yml up
- Or in detached mode:
sudo docker-compose -f docker-compose.yml up -d
There is also the possibility to build your own local Docker image of the STH component.
To do it, follow the next steps once you have installed Docker in your machine:
- Navigate to the path where the component repository was cloned.
- Launch a Docker build
- Using the default NodeJS version of the operating system used defined in FROM keyword of Dockerfile:
sudo docker build -f Dockerfile .
- Using an alternative NodeJS version:
sudo docker build --build-arg NODEJS_VERSION=0.10.46 -f Dockerfile .
The STH within the Docker image can be run encapsulated within the pm2 Process Manager by
adding the PM2_ENABLED
environment variable.
docker run --name sth -e PM2_ENABLED=true -d fiware/fiware-sth-comet
Use of pm2 is disabled by default. It is unnecessary and counterproductive to add an additional process manager if your dockerized environment is already configured to restart Node.js processes whenever they exit (e.g. when using Kubernetes)