Documentation:
Rules |
Email |
Gate & Authentication |
Hashing |
PlantService |
Sessions |
SQL Sanitization |
TimeService |
Model Collection
The PlantIQ backend provides the core functionality to both the frontend and smart home hubs and sensors, it serves as the central glue point that brings the experiance together. This application is written using Java 17 and utlizes Spring Boot to provide its core functionality for interacting with web requests. This app is designed to run on Microsoft Azure web services and should be used only as a backend for clients to connect to.
This Application should be run on Java version 17 or higher.
To access the backend for testing or development purposes we recomend the use the HTTP client Insomnia https://insomnia.rest/
Microsoft's azure platform provides a number of streamlined ways to upload and run your Java Spring Boot application, for this example i will show you how to upload it via sFTP and set the jar.
Login to Microsoft Azure and select create a new resource.
![step 1](https://private-user-images.githubusercontent.com/79836947/243071205-c116201e-71a5-4954-83b7-828dc8f29137.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEyMDUtYzExNjIwMWUtNzFhNS00OTU0LTgzYjctODI4ZGM4ZjI5MTM3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE2MDhjZGQ0ODYxOTAzNmFmYzQ0NTE2ODAzMTJiNmFhOWY1ZDEwY2E5NzAxMzEzODFkYzFlNjQ5NTQ0MzJhNTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.stt1dC9cIggecykVb4-MLwG3q7Y67WLQua3o39cTGhE)
Select "Web App"
![step 2](https://private-user-images.githubusercontent.com/79836947/243071226-61936ebd-fe40-41ba-965e-1ab65596c540.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEyMjYtNjE5MzZlYmQtZmU0MC00MWJhLTk2NWUtMWFiNjU1OTZjNTQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThkMzM4OWM0ODlkOTNmOGZlMzlhN2U3NDY2NTJlZWRiNDc3Njg0YzRjYmVhYzA0YzdiNWMwOTU5ZWZlMzA3ZjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ww7YE6ANuu9dHlDvuvMNAidFpk2YXiy_cv6Wbp1URC0)
Name your new web app, in the case of this project we would use PlantIQ REST API but in the example screenshot I use MySpringApp.
Now it's important to select the most appropriate Java version, our project is compatible with Java 17 and that is the most recent provided so select that from the drop-down list.
Lastly select the region that is most appropriate for you.
![Step 3](https://private-user-images.githubusercontent.com/79836947/243071237-d0c5c656-3c9b-48bf-9872-dae67e39ab8a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEyMzctZDBjNWM2NTYtM2M5Yi00OGJmLTk4NzItZGFlNjdlMzlhYjhhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUzNThiODEzYTVhZDE4OTFkZDBhNmViNWJiNTY0ZGJiY2U0YjkyMGI0MTIyMDVlMjNmN2ZhMTNjNjU5YmQyZDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.6-wE7hioISakenhtufVSgDuDMNU_rEqIlF2vhjvRn20)
Review the setting you have selected and click create.
![step 4](https://private-user-images.githubusercontent.com/79836947/243071275-296c6e13-d1b5-44ba-a876-a7f555993826.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEyNzUtMjk2YzZlMTMtZDFiNS00NGJhLWE4NzYtYTdmNTU1OTkzODI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY2Yjc2ODJlOTJmNjY3ZTM3ZjI1YmM3MWUzMWYxMzE3ODk4YThiODRjYWE1MjQ5MjNmNTU4ODNhMzM0YWY0NGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.fWzjhd2qJGat1wDdLAPbrNV2_o-XOvl4Asqwcsu1tZU)
Microsoft Azure may take a few minutes to deploy your application, wait untill it confirms its completed.
![step 5](https://private-user-images.githubusercontent.com/79836947/243071307-09e0e54a-46bf-4ba7-909b-3796dbc03af6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEzMDctMDllMGU1NGEtNDZiZi00YmE3LTkwOWItMzc5NmRiYzAzYWY2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUxMGE5OTY5MDRiZTczNTNiZDIyNGQ2ZDdiMjY5MDY4YWQ1NDMzNTA5YTFlZWVkMTgwMWEyY2EyYTQzNDgyMzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MVr2g-X3F_bCiR1-HgMrrMeVycF3OlvFBZyojEDNfaI)
Once deployed click into the Application, you will see an overview from this screen.
We can now connect via FTP, on the left hand side menu select "Deployment Center"
![step 6](https://private-user-images.githubusercontent.com/79836947/243071349-99cfc4d2-f505-4b3a-b4d6-b68abe1d5a0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEzNDktOTljZmM0ZDItZjUwNS00YjNhLWI0ZDYtYjY4YWJlMWQ1YTBiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYwYzQ3Y2Y4NmQ0NDljZjJkMDM3YTMwMDNhMDRiZWU5Y2FjYWUzYjI4MDkyMzM2OWFhYTZhZDdjMWNkNzk2ZTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XW628hYW9ppgb83ew32dYSpATEaPY9t4apSL24T_VRc)
Once the deployment center opens select FTP details from its menu, copy these details into your FTP client of choice, Our recommendation is File Zilla https://filezilla-project.org/.
![step 7](https://private-user-images.githubusercontent.com/79836947/243071361-006c534f-a219-4853-adbf-bdf50f9b6a8f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEzNjEtMDA2YzUzNGYtYTIxOS00ODUzLWFkYmYtYmRmNTBmOWI2YThmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY1MWNlODBmYjVmYTdhNmJjZmU5YmEzNThhYTJlNjRmODYxMzlkNTVkMTVlYzZmNzUyNzMzNTZjNWQ0N2U0YTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WjBpGKBjdnMjvUVu9yBo8mYIpt3z_N3uSOrABbgnCds)
Once connected you will see the current folder is called wwwroot and the hostingstart.html file present. This folder is where we upload our runnable builds to, to perform an upload drag the file in and File Zilla will upload it.
![step 8](https://private-user-images.githubusercontent.com/79836947/243071373-74347b68-d029-4aa3-bd5b-0ff6afeb4e94.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzEzNzMtNzQzNDdiNjgtZDAyOS00YWEzLWJkNWItMGZmNmFmZWI0ZTk0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFhOGY4ODExNmJjMGQ2ZmJlNTM4ZTBjZTI2OTU0MmVlNDM1OWFkMjU1YTRkYmU3OWMxMWE1YmNhYzM1NzdkY2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-4zBxthUZwZwJ_AucmpjzWcNsdxSgv9oXg2H2KDa21c)
Once the file is uploaded close File Zilla and from the left and menu select "Configuration" then from its menu select "General Settings".
This will now provide you with the java startup command, here we need to java the following,
replacing MyJar.jar with the jar name including the extension,
java -jar /home/site/wwwroot/MyJar.jar
![step 9](https://private-user-images.githubusercontent.com/79836947/243071402-57111cfe-c76a-4dbe-9956-4f9e8d41f3b7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMTUzNTAsIm5iZiI6MTcyNDExNTA1MCwicGF0aCI6Ii83OTgzNjk0Ny8yNDMwNzE0MDItNTcxMTFjZmUtYzc2YS00ZGJlLTk5NTYtNGY5ZThkNDFmM2I3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAwNTA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVkOWM5NTAxNTJmYzY5ZWEzODIxNTU3MTM2MjVhZTRlZGU5ZGJiOWE1ODRiOWQ5NjhhZjg2OTViMGIzNzliYWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mDeHhPDrhNexdQzun_DFvHl0_WkOUvzrhw09FH4k6WY)
Now we have uploaded our jar and set it as the start-up command, navigate back to the overview screen and click the restart button Azure will now use the jar and serve your spring boot application.
If at any point you wish to track the restart and troubleshoot errors simply use the live log provided the "Log Stream" option on the left hand side menu.
Sucess! the application is now deployed to Microsoft Azure!