GithubHelp home page GithubHelp logo

amineaml / docker-compose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ocariot/docker-compose

0.0 0.0 0.0 116 KB

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

License: Apache License 2.0

Shell 100.00%

docker-compose's Introduction

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.