Skip to content

polinchw/monitorserver

Repository files navigation

monitorserver

An application that will collect data from sensor information coming from a Raspberry Pi.

Network Diagram

alt text

Build

run mvn clean install

Run

java -jar -Dspring.profiles.active=dev monitor-server.jar

Swagger

Navigate to http://localhost:8080/swagger-ui.html# to view rest APIs.

Docker Machine/Swarm Deployment on AWS

  1. Create a Docker Machine (hopefully you an reuse one in your infrastructure).
  2. Git clone this repo on your Docker Machine: https://github.com/polinchw/docker-tools
  3. chmod u+x docker-tools/docker-machine/docker-swarm/aws/bash-scripts/create-swarm-instances.sh
  4. Create a Docker Swarm under the control of the Docker Machine to run the monitor-frontend on. This will install the Docker Swarm on your selected AWS VPC and subnet.

./docker-tools/docker-machine/docker-swarm/aws/bash-scripts/create-swarm-instances.sh AKIAJB7DZD4I6QA2XBRA xxx vpc-9dc174e4 subnet-8102b5ad polinchw monitorserver 1 ami-8887be9e AppSecurityGroup

  1. Create a Docker Service. Run the monitor-frontend app in the Docker Swarm as a Docker Service by running this command on the Docker Machine.

docker-machine ssh monitorserver-swarm-master 'docker service create -e "SPRING_PROFILES_ACTIVE=aws-dev" -e "JASYPT_ENCRYPTOR_PASSWORD=xxx" --replicas 2 --name monitor-server -p 8080:8080 polinchw/monitor-server'

  1. You probably want to add a AWS load balancer to load balance the monitor-frontend at this point.

Docker Compose

  1. To run the app with docker compose with a targeted environment run:

    docker-compose build

    docker-compose -f docker-compose.yml -f dev-local.yml up