This Dropwizard application is a RESTful service to control the Tartan SmartHome platform. It also contains the IoTController code in it.
(NOTE: if using Windows, all instances of ./gradlew should be replaced with gradlew.bat).
- The Java JDK 1.8 needs to be installed on your system before compiling the application.
- If not running the Dockerized startup, MySQL 5.7 should be installed on the system (for the Historian DB).
- If not running the Dockerzied startup, Python 3.6+ should be installed on the system (for the House Simulator).
To build the Platform code:
- Go inside the "/Platform" folder.
- Execute
./gradlew buildto build your code. - To create a standalone JAR of the Platform, execute
./gradlew shadowJar- This will create a "tartan-1.0-SNAPSHOT.jar" file inside the "/Platform/build/libs" subfolder with the Platform and all its dependencies.
If the Dockerized statup is not being used, the database has to be manually set up. MySQL is installed differently depending on the system. If using Ubuntu, MySQL 5.7 can usually be installed executing the following:
sudo apt updatesudo apt install mysql-serversudo mysql_secure_installation
The "/Database/init.sql" script can then be executed to create the DB and user.
The following instructions are used when starting each component separately.
To start a House Simulator:
- Go inside the "/HouseSimulator" folder.
- Execute
python3 simple_server.py localhost <port>, replacing with one of the ports configured in the Platform's config.yml file.
Multiple House Simulators can be executed at the same time, as long as each one is listening on a different port. The default config.yml file in the "/Platform" project expects two House Simulators to be running, one on port 5050 and one on port 5051. In order to make the Platform with the default configuration start successfully, you should start two instances of the House Simulator, one on each port.
In order for the Platform to run properly, MySQL and the House Simulators configured in the config.yml file have to be already running on the system.
- Go inside the "/Platform" folder.
- To start the Platform from Gradle, simply run
./gradlew run - Alternatively, to start the platform from the standalone JAR, follow these steps:
- Go inside the "/Platform/build/libs" folder.
- Execute
java -jar tartan-1.0-SNAPSHOT.jar server ../../config.yml
Instead of starting each component manually as described in the previous section, all components can be started together inside Docker containers with docker-compose.
NOTE: In order for this to work, you first need to set up Docker and Docker-compose on your system.
NOTE: When running the Dockerized version of the Platform, the configuration file used is "/Platform/config.docker.yml", so any changes should be made there.
- Execute
sudo docker-compose up --build
To check that the Platform is running properly, open a browser and enter either http://localhost:8080/smarthome/state/mse or http://localhost:8080/smarthome/state/cmu and log in.
Log in information for each house is stored in the config.yml file.