Skip to content

Configuration files needed for the rapid implementation of the OCARIoT platform using docker-compose.

License

Notifications You must be signed in to change notification settings

MarcioMateus/docker-compose

 
 

Repository files navigation

Docker Compose - OCARIoT Deployment

Repository with configuration files needed for the rapid implementation of the OCARIoT platform using docker-compose.

We strongly recommend that you use this deployment option only in development and testing environment.

Prerequisites

Set the environment variables

To ensure flexibility and increase the security of the platform, the OCARIoT services receive some parameters through environment variables, e.g. IPs, credentials (username and password), etc.

The file .env.example contains all the environment variables required by the services being deployed.

Copy and paste with the file .env.example with the name .env to make the Docker Compose use the environment variables defined in this file:

cp .env.example .env

Just to begin, an environment variable configuration example is provided below, where the value of the HTTP and HTTPS port of the Api Gateway is set (in this case, 8080 and 8081):

AG_PORT_HTTP=8080
AG_PORT_HTTPS=8081

Before the first execution, the variable RABBITMQ_PASSWORD must have a valid value associated with it (initially it is equals to YOUR_PASSWORD), ask the project administrator about this password before starting. Otherwise, the microservices will not be able to authenticate themselves in the Message Bus.

After that, setup the variables according to specific requirements of each deployment.

Set certificates

If you already have valid HTTPS certificates to use on the platform, you need to point the path of each of them in the appropriate environment variables, they are:

SSL_KEY_PATH, SSL_CERT_PATH, JWT_PRIVATE_KEY_PATH, JWT_PUBLIC_KEY_PATH and MONGO_PEM_KEY_PATH

These certificates will be used by all microservices of the platform and must be valid for everything to function normally. But if you are in a development/testing environment, you can generate self-signed certificates. To do this, run the create-self-signed-certs.sh script:

chmod +x create-self-signed-certs.sh 
./create-self-signed-certs.sh

A subdirectory named .certs will be created. Now just point the paths of such files to the environment variables mentioned above in .env.

Note: Do not use self-signed certificates in the production environment. It is highly recommended for the production environment that certificates are obtained by a valid certificate authority (CA)

Building and Deploying the containers

docker-compose up --build

It will build the containers and run the platform as specified in the file docker-compose.yml, opening a log screen with the logs of all the services started.

Stopping the execution

If you are still in the log screen press Ctrl + C just one time for graceful stop, two times to force stop

To stop all containers created by docker-compose, you need to go to the folder where docker-compose.yml is and run:

docker-compose down

To stop just one container:

docker stop my_container

Other useful commands

Restarts Docker. Useful in critical situations:

sudo service docker restart

Check all containers and its status:

docker container ls

Enter in the shell or bash of a particular container:

docker exec -it container_id /bin/bash

Stop all containers:

docker stop $(docker ps -a -q)

Delete all containers:

docker rm -f $(docker ps -a -q)

Delete all volumes:

docker volume rm $(docker volume ls -q)

Delete all container images:

docker rmi -f $(sudo docker images -q)

About

Configuration files needed for the rapid implementation of the OCARIoT platform using docker-compose.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%