This is the setup repository for the Home Controller project. It contains a docker-compose.yml
file with the container orchestration of this system.
- Install Docker
- Run
./setup.sh
- This will setup graphql-api, eeg-brainwave-api and web-client. In addition to that, it will also setup databases for both APIs, Kafka, Zookeeper and any other services needed.
http://localhost:8001
: Kafka Web UIhttp://localhost:3001
: App Web UI - web-clienthttp://localhost:3000/graphql
: GraphQL API - graphql-apihttp://localhost:8085/
: EEG API - eeg-brainwave-api
./up.sh
: Build images and turn on containers./down.sh
: Turn down containers./build.sh
: This will build all the images for all apps (needed specially because of theeeg-brainwave-app
that usesmaven
to build)./logs-apps.sh
: Logs graphql-api, eeg-brainwave-api and web-client./logs-infrastructure.sh
: Logsgraphql-db
,eeg-db
,kafka-broker
(broker),kafka-topics-ui
(web-interface) andkafka-zookeeper
- To check realtime logs of the applications, run
./logs-apps.sh
. - To check realtime logs of the infrastructure, run
./logs-infrastructure.sh
. - To
ssh
any container:docker ps
docker exec -ti 3912bba70e66 bash
- To stop services, either:
- Run
./down.sh
to stop all services. - Run
docker-compose stop service_name
to stop a specific service.
- Run
-
To create a docker swarm locally, first create 2 VMs (master and node)
docker-machine create --driver virtualbox --virtualbox-cpu-count "1" --virtualbox-disk-size "40000" --virtualbox-memory "4096" --virtualbox-boot2docker-url "https://github.com/boot2docker/boot2docker/releases/download/v18.06.1-ce/boot2docker.iso" master
- We are setting up this VM with 40GB or hard drive, 1 CPU and 4GB os RAM memory
- The image being used it
v18.06.1-ce
, and the reason for that can be found here
docker-machine create --driver virtualbox --virtualbox-cpu-count "1" --virtualbox-disk-size "40000" --virtualbox-memory "4096" --virtualbox-boot2docker-url "https://github.com/boot2docker/boot2docker/releases/download/v18.06.1-ce/boot2docker.iso" node
-
After that, we will setup the swarm
docker-machine ls
- This will give us both
master
andnode
VM IPs
docker-machine ssh master
docker swarm init --advertise-addr {MasterVM-IP}
- In the place of
{MasterVM-IP}
put the actual IP outputted by thedocker-machine ls
command - This command will generate a token, you must copy it
exit
docker-machine ssh node
docker swarm join --token {Token-Value}
- In the place of
{Token-Value}
put the actual token outputted bydocker swarm init
in step5
exit
eval $(docker-machine env master)
- We will setup the
master
vm as our current docker daemon instance
./stack_deploy.sh
-
docker stack ls
- That should show a single stack with
home_controller
and10
services
- That should show a single stack with
-
docker service ls
- That will list all services in execution
-
docker service logs {Service_Name}
- Logs the output of a service
- Example:
docker service logs home_controller_eeg-db
python3 scaler.py