Apollo is a home security management system, consisting of:
- Main components:
- Mobile application -
safr-mobile/safr - Backend - Java microservices -
microservices - Infrastructure - databases, MQTT, MinIO -
microservices/docker-infra
- Mobile application -
- Auxiliary components:
- Hardware device simulator -
utils/device-simulator/apollo-sim - Testing tools -
utils/apollo-loadtest - Monitoring -
microservices/apollo-k8s/
- Hardware device simulator -
The mobile app is located in the safr-mobile/safr directory.
To install the required dependencies, make sure you have Node.js and npm installed on your system. Then, run the following commands in your terminal:
cd safr-mobile/safr
npm installThe app can be run on an Android emulator, an iOS simulator, a physical device using Expo Go, or directly in the browser. To run the app, use the command:
npx expo startThis opens a terminal menu where you can choose where to run the app.
The microservices are configured via environment variables (included at the end of this file).
These can be set in the terminal (using source .env) before running the microservices or included in a .env file and loaded in each service using the EnvFile plugin for IntelliJ.
The backend is located in the microservices directory and can be built and run either using Java or Docker.
For the database, MQTT, and MinIO, make sure you have Docker and Docker Compose installed. To start them, run:
cd microservices/docker-infra
docker-compose up -dEnsure you have Java JDK and Maven installed, then run:
cd microservices
# Download dependencies and build each microservice
mvn clean installIf the project is opened in IntelliJ IDEA, you can run each microservice directly from the IDE, using the "Services" section on the left side of the screen.
To run without IntelliJ, use the following commands:
# first place the .env file in the microservices directory
source .env
# run each microservice in a detached terminal
java -jar api-gateway/target/api-gateway-*.jar &
java -jar user-service/target/user-service-*.jar &
java -jar device-service/target/device-service-*.jar &
java -jar media-analysis-service/target/media-analysis-service-*.jar &
java -jar home-service/target/home-service-*.jar &
java -jar notification-service/target/notification-service-*.jar &
java -jar file-storage-service/target/file-storage-service-*.jar &To stop all microservices, you can use the kill command in the terminal to terminate the Java processes:
kill $(ps aux | grep '[j]ava' | awk '{print $2}')To run the microservices using Docker, make sure you have Docker and Docker Compose installed. Then, run the following commands:
cd microservices
# This command will build all microservices, package them into images, and store them in the local Docker registry.
docker compose build
# This command will start all microservices in the background, along with the infrastructure.
docker compose up -dTo stop all microservices, use:
# In the microservices directory
docker compose downSwagger UI is available for all microservices through the API Gateway at http://localhost:8080/swagger-ui.html. It provides an interface to explore and test all microservice APIs.
To simulate hardware devices, you can use the simulator available in the utils/device-simulator/apollo-sim directory. It allows the simulation of IoT devices and testing interactions with the backend.
This is a React project that can be run with:
cd utils/device-simulator/apollo-sim
npm install
npm startTo run load tests, execute the following commands:
cd utils/apollo-loadtest
locust -f locustfile.py --host=http://localhost:8080Then, from the web interface, configure the number of users and spawn rate, and start the test.
The monitoring stack is available only in Kubernetes/K3s.
Grafana can be accessed publicly at https://grafana.faur.sh with user admin and password apollo123.
Data can be explored in the DrillDown section or in Dashboards. Note that the deployment resources are limited, so response times may be high, especially during load testing.
If you have k3d installed, you can run the following commands to start a local K3s cluster with monitoring:
cd microservices/apollo-k8s
sudo ./scripts/deploy.shThe evaluation committee in the submitted README has access to a .env file with the environment variables required to run the microservices and test the complete functionality.
Another user can create a .env file in the microservices directory using the following template:
cd microservices
cp env.template .env
# fill in the variables in the .env file after copying
# then set the environment variables in the terminal
./scripts/setup-local-env.sh
# or use IntelliJ with the EnvFile plugin to load the variables
# or
source .env