Table of Contents
This is a school assignment that was created in three blocks, each of which was three weeks long, The scenario from the first block was to write a script that calculates the travel costs for a scooter rental. It was up to us if we wanted to keep it a pure terminal application or if we wanted to add a UI to it. In the next block, live data should be read out with the help of an Arduino and a Raspberry Pi, and a business plan should be created. In the last block we should cover the topic of DevOps, where we use pipline, monitoring, testing and build processes. For us it was possible to connect this with the first block where the sensor package represents a scooter.
We have developed a web application for the immagine company "ScooTec GmbH".
This is intended for the end user UI
Every user can register on the web page as well.
After registration the customer will receive an email and 20.00 starting credit will be added to his account.
For better security, the registration is done with an Authenticator, which is secure.
After registration, the position on the map is displayed, as well as the scooters in the vicinity.
When you click on a scooter, you can see the battery level as well as the scooter ID.
After clicking on Choose Scoter
the ride can be started.
When the ride is finished the timer resets to zero and it is calculated how much the ride cost, 0,89€ activation fee and 0,18€ per minute.
The outstanding amount is automatically deducted from the credits and the user receives a personalized email with the important information.
Payment methods such as PayPal, MasterCard, Klarna, etc. can be integrated.
You can also add cards and save them.
With the Scooters is often not as desired handled, whereby it comes to damage. In general, the data transmission does not run as desired and needed. Therefore, we need to develop a device that collects important data and sends it to a central location. With an admin account should be logged on their site and to each scooter a dashboard can be retrieved.
Function | Group or User |
---|---|
Problem Owner | ScooTec GmbH |
Developer | Noah Danyael Zeumer |
Designer | Noah Danyael Zeumer, Ben Luca Eibel, Vincent Wolff |
Network Engineer | Noah Danyael Zeumer |
Business Expert | Ben Luca Eibel |
Time & Note Keeper | Vincent Wolff |
It is a ReactJS frontend with a Node Express backend. To test the app you need:
- a MariaDB database
- NodeJS
- PayPal development account
- An email account
- Microsoft Authenticator App / or similar
As well as a .env
file in backend
path that looks like this:
# DB
DB_HOST=0.0.0.0
DB_PORT3306
DB_USER=root
DB_PASSWORD=*************
DB_DATABASE=scooter-gmbh
# Mail
MAIL_USER=*******@****.**
MAIL_PASSWORD=*******
MAIL_HOST=imap.****.**
MAIL_PORT=***
MAIL_TLS=***
MAIL_SECURE=true
MAIL_SERVICE=*****
MAIL_NAME= <****@****.**>
# Minio
MINIO_ROOT_USER=****
MINIO_ROOT_PASSWORD=********
# Client
MINIO_CLIENT_ENDPOINT=*******
MINIO_CLIENT_USESSL=*****
MINIO_CLIENT_ACCESSKEY=****
MINIO_CLIENT_SECRETKEY=********
# PayPal
PAYPAL_CLIENTID=***************************
# Sentry
SENTRY_DNS=https://****************@sentry.********/**
For insterlation the git responsitory must be clonetted and installed with npm install
.
With npx express-generator
you can create an express application.
With npx create-react-app PROJECT_NAME
you create a React App.
ScooTec GmbH, to whom we have already sold a scooter app, complained about a lack of data analysis of the scooters. We fulfill their request by providing a scooter with a
- temperature and humidity sensor,
- GPS,
- Gyroskop.
This can show more accurate details about the scooters.
- Temp(0-55) and Humidity
- Digital Temperature(-55 bis 125)
- GPS Mouse
- GY-521(Gyroskop)
For | medocino | School |
---|---|---|
UI/UX | Gitlab Autonubil | Gitlab School |
Backend | Gitlab Autonubil | Gitlab School |
Rasperry & Arduino | Gitlab Autonubil | Gitlab School |
With the help of the driving data, the areas can be adjusted. Thanks to the user data, the target group analysis is easier and it is possible to target new groups.
Also the condition of the scooters can be seen faster, does a user drop the scooter or did it happen after the customer left.
The temperature can also show useful disadvantage for the customer, such as "It might be slippery, so please drive carefully." F
The plan area can be divided into the following two areas.
Technical
Business Canvas
- Custom user
- Sign-Up
- Sign-In
- Store Passwort Safe in a Database
- Rent a scooter
- Calculate duration and cost from the ride
- Server Monitoring
- Prometheus
- Grafana
- Error Monitoring
- Sentry
- Automate Docker Build
- Automate Deployment
- You have developed a product vision for your software.
- You have defined stories/tasks for your software that are to be implemented
- You collect data from at least one data source
- The data is processed and interpreted
- The data is stored in log files or a database
- You have designed the program to be readable and understandable, especially by using meaningful names of variables and functions and meaningful comments
- You have tested the program for the implemented requirements
- You have created a class diagram or distribution diagram of your software
- You have implemented at least one automated test
- Slated and Hashed
- Two-factor authentication
- Store data in Local Web Storage
- A world map that searches for the current position
- View live location on the map, with the profile picture
- View scooters on the map
- Invoice in the app
- Add credit with a PayPal account
- Dependecy Check
- Renovate Bot
- Mobile Client Version
- Automate Rollout use Terraform
- You capture data from more than one data source
- The data is processed and linked in a meaningful way
- The data is made available via a medium
- You have structured your program well by meaningful modules / classes
- The program is readable, understandable and easily extendable by:
- A good program structure,
- self-explanatory program code, meaningful names of variables and functions as well as meaningful comments
- You have implemented at least three automated tests
- Automated and personalized emails
- By creating a Account
- New Billing arrives
- Add Stripe as a payment method
- Diffrent Providers with Keycloak
- Check Code Qualtity
- SonarQube
- EsLint
- Secret Managment
- Vault
- Remove unused CSS for the build
- PurgeCss
- You have applied basics of object-oriented programming.
- Selected data is stored in a database or other useful storage medium
- Data is delivered via heterogeneous media
- You have implemented at least five automated tests
- No NPM Packaging
- Just using Docker
In our case, monitoring consists of four parts:
All important information is monitored, such as:
- Error messages
- Server load
- Data from Scooter
- Quality of the software
Sentry is an error and performance monitoring tool. With us all data is sent and captured by the NodeJs server.
Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud.
We currently have three endpoints inside,
- Scooter App
- Prometheus Self
- Scooter for every additional Scooter a new endpoint would be created.
Grafana is an open source interactive data-visualization platform, developed by Grafana Labs, which allows users to see their data via charts and graphs that are unified into one dashboard (or multiple dashboards!) for easier interpretation and understanding.
In our case, two dashboards are created automatically.
The first dashboard is meant to collect all the essential data about the NodeJs server and the other one to display the custom metrics created with Prometheus by the Scooter.
In the config
folder the settings can be viewed.
Dashboard One:
We currently use four pipelines, which cover the complete flow from quality testing to roll-out. These would be:
Renovate checks for new software packages on each run, it creates an issue based on this. Renovate also checks if the newer version is compatible with the software and creates a merge request.
SonarQube is a self-managed, automatic code review tool that systematically helps you deliver clean code It automatically runs once a day, one pass, if successful a Docker image is built and published. The piepline can also be triggered manually.
What? | Short description |
---|---|
Bugs | A coding mistake that can lead to an error or unexpected behavior at runtime. |
Vulnerability | A point in your code that's open to attack. |
Code Smell | A maintainability issue that makes your code confusing and difficult to maintain. |
Security hotspots | A security hotspot highlights a security-sensitive piece of code that the developer needs to review. Upon review, you'll either find there is no threat or you need to apply a fix to secure the code. |
New Code | Displays only things that were added during the last pass |
Quality gates | Quality gates enforce a quality policy in your organization by answering one question: is my project ready for release? |
All testing is fully automated using Jest and Selenium.
- Create new user
- Welcome email
Sign-Up.mp4
- Log in with the created user
Sign-In.mp4
- Log in with the created user
- Add credits via PayPal
paypal.mp4
- Log in with the created user
- Rent a Scooter
rent-scooter.mp4
- Log in with the created user
- Delete the created user
delete-user.mp4
Our business partners are the Raspberry Pi Foundation, Arduino as well as Elegoo. With the help of our partners we were able to create a prototype and thanks to the e-scooter manufacturer Xiaomi Mi we were able to test our prototype under real conditions.
It is primarily aimed at industrial customers. With the help of the product, the most diverse data of an e-scooter can be read out. How:
- Humidity
- speed
- position
- Inclination The whole thing can also be included in Betshende software.
The main components for our product comes from Elegoo, the sensors and the wiring is supplied by them. The microcontroller is supplied by Arduino. The one platinum computer is supplied by the Raspberry PI foundation.
The product is aimed at an already known business partner. The ScooTec GmbH has asked us for a device to better evaluate the scooter data. Of course, this device could also be installed on other devices.
Our target group consists mainly of e-scooter scooter startups .
We would like to recruit our potential customers via modern forms of advertising, such as social media. Of course, we also introduce our product to existing business partners.
All the hardware can be minimized to an extremely small size, which allows it to be used for a wide variety of sharing services, such as scooters, bicycles, etc..
The JSON format also allows the sensors to be quickly integrated into existing systems.
For each customer we also offer a basic software package with:
- Login
- OTP
- Payment
- Email notifications
- Data analysis
Our team is constantly working on adding new features and enhancing existing ones.
The storage costs are currently still extremely low, it can be integrated with an office purely whereby no separate warehouse is needed. It takes very little time to produce a device, usually 5 minutes for the hardware. Thanks to Terraform we are able to roll out the software on several devices at the same time and customize it for individual customers. In total it takes about 15 minutes until devices are ready for use. We expect a wear and tear of about 5 devices per month. And the wage is 25€ per hour In addition, there is the development department, which tries new innovative ideas. The team currently consists of 3 people. Our advertising costs per month are about 1.000 €. The working hours consists of a 35 hour week.
Cost Point per Device | Brutto Cost |
---|---|
DHT11 Sensor | 0.16 € |
GY-521 | 0.22 € |
Custemize Arduino | 3.70 € |
Custimze Raspberry Pi | 80.39 € |
Total | 84,47 € |
Cost Point | Brutto Cost |
---|---|
Office-Rent | 2.800 € per Month |
Worker-Cost | 10.500 € per Month |
Wear | 423,50 € per Month |
Advertising costs | 1.000 € per Month |
Total Cost | |
Cost Total | 14.723,50 € per Month |
Cost Per Device | |
Cost per Hour | 105.17 € |
12 Devices per Hour | 1.013,64 € |
Total | 1.118,81 € |
Finall Cost | |
Device Cost | 93,23 € |
7% Win | 6,53 |
Cost Point | Brutto Cost |
---|
paypal.mp4
----- | | Software Rent | 30 € per Month | | Software Hosting | 50 € for 100 devices | | Support | 100 € per Hour | | Complettly Outsource | from 9000 € per Month | | Sensor Paket | 100 € per Sensor | | Cost per Device | 99,75 € |
The project was financed by individual sponsors plus the company's own capital. In the future it will be financed by the above offer list.
- Custom SignIn/SignUp
- With OTP
- A 2 factor token is automatically generated, the user has to scan this token at the first login, as well as enter the token.
- Password is sallted and hashed and stored in the database.
- With OTP
- Log in with a specific user.
- Store data in Local Web Storage
- Automated and personalized emails
- By creating a Account
- New Billing arrives
- A world map that searches for the current position
- View live location on the map, with the profile picture
- View scooters on the map
- Rent a scooter
- Calculate duration and cost from the ride
- Invoice in the app, as well as in by email
- Add credit, e.g. with a PayPal account
The next version should fix bugs and add the following features:
Meaning of the colors:
- Blue = Frontend
- Green = Backend
Test case number | Test case description | Input values | Expected behavior | Observed behavior | Successful? |
---|---|---|---|---|---|
1 | reason algorithm, without user input (time*price per min) + entry fee | 5 | result becomes 1.84 | true | |
10 | the user can start a stopwatch and the time will be given in mil sec | 5 | result will be 1,84 | result will be 54000,84. Mil sec were not converted | false |
20 | the user can start a stopwatch and the time will be given in mil sec and converted to min | 5 | result will be 1,84 | result will be NaN.the timer value will be given too late | wrong |
30 | With input (time*price per min) + start fee | 5 | Result becomes 1,84 | True |
Since this repo is relatively large due to videos and photos, it is recommended to do everything with Docker Compose. However, the individual images are also available:
What? | Image |
---|---|
Backend | docker.autonubil.net/schule/scootec-gmbh/backend |
Frontend | docker.autonubil.net/schule/scootec-gmbh/frontend |
Scooter | docker.autonubil.net/schule/scootec-gmbh/scooter-hardware/node-server |
If you want to do the whole thing with a single docker-compsoe file, where also Prometheus, Grafana etc. are located, you need to create a simple directory.
mkdri scooter
cd scooter
mkdri sql
cd sql
Inside this file insert the script from sql scooter-gmbh.sql
Script.
vi scooter-gmbh.sql
cd ..
mkdri backend
cd backend
vi .env
In the env file you would have to fill in the `* with your own dates
# Server
DB_HOST=scooter_db_1 # Name from Docker-Compose file
DB_PORT=3306 # Default
DB_USER=root # Default You can change it
DB_PASSWORD=************ # Need a Passwort
DB_DATABASE=scooter-gmbh # The table is automatically generated
MAIL_USER=****@*****.***** # Your Email adress
MAIL_PASSWORD=************ # Your Email Password
MAIL_HOST=***.****.** # SMTP / Imap Server
MAIL_PORT=*** # SMTP / Imap Port
MAIL_TLS=false # Needed for this script
MAIL_SECURE=true # Needed for this script
MAIL_SERVICE=**** # Mail service
MAIL_NAME=<****@****.****> # Your Email adress
# DB
MARIADB_ROOT_PASSWORD=******* # Same as DB_PASSWORD
# Minio
MINIO_ROOT_USER=root # Default u can change it
MINIO_ROOT_PASSWORD=minioadmin # Default u can change it
# Client
MINIO_CLIENT_ENDPOINT=scooter_minioserver_1 # Name from Docker-Compose file can change it if wanted
MINIO_CLIENT_USESSL=false # Needed for this script
MINIO_CLIENT_ACCESSKEY=root # Default u can change it
MINIO_CLIENT_SECRETKEY=minioadmin # Default u can change it
#Grafana
GF_AUTH_DISABLE_LOGIN_FORM=true # Default u can change it
GF_AUTH_ANONYMOUS_ENABLED=true # Default u can change it
GF_AUTH_ANONYMOUS_ORG_ROLE=Admin # Default u can change it
# PayPal
PAYPAL_CLIENTID=********* # Your PayPal Client Id
# Scooter One
SERVER=scooter_fullstack_1 # Name from Docker-Compose file can change it if wanted
ID=1 # Default u can change it
Use full Links: | Docker | https://docs.docker.com/get-started/ | | List of SMTP and IMAP server | https://www.arclab.com/en/kb/email/list-of-smtp-and-imap-servers-mailserver-list.html | | PayPal Dev | https://developer.paypal.com/home | | Minio | https://min.io/ |
After all settings have been made, everything can now be started.
cd ..
docker-compose up # With open Log file
docker-compose up -d # With cloesed Log file
You can install Arduino on the Raspberry Pi with sudo apt-get install arduino
.
Plug the device to the Raspberry PI.
With ls /dev/tty*
you cann see a list with devices.
By runing sudo cat /dev/ttyACM0
you will see the data from the USB GPS device.
After this you have to install the gpsd module with sudo apt install gpsd
To auto start the USB Device, after a boot go into vi
or nano
/etc/default/gpsd
.
To check if everything runs wright install sudo apt install gpsd-clients
.
Then type xgps.
cgps
If you like this project and it helped you I would appreciate a little support!
The demo version is available to all free. All passwords are hashed and salted, so they are not visible in the database, but we recommend not to use passwords that you use somewhere. The server is automatically restarted in the evening and all data is deleted.