The project is a suite for managing restaurant reservations, it is composed of two systems:
- A Telegram Bot for the user, which allows you to make and remove reservations, view information about the restaurant and the menu (Italian - English - Spanish), search the menu using image or text, order dishes;
- A Web App that shows restaurant information and instructions for using the Telegram Bot, and the admin (restaurant owner) can access and delete reservations through a special section;
- BotService: Service used for the creation and management of the Telegram bot used by our users.
- Computer Vision: Service used for the recognition of dishes in our Restaurant Menu, using through the bot by uploading an image.
- Azure Database for MySQL Server: An Azure resource representing an instance of a MySQL database, used by the Telegram Bot and the WebApp for storing information.
- App Services: An hosting service used by either Telegram Bot & WebApp.
- Translator: Translation service used by Telegram Bot for the Restaurant Menu Translation.
- Serverless Function: Triggered by the database to confirm the reservation to the user.
- Serverless Function: Triggered 30 minutes before booking time as a reminder to the user.
The Telegram Bot implemented through "BotService", and the WebApp implemented through the "App service" access the data stored in a Database through the "Azure Database for MySQL Server" service.
The Telegram Bot uses the "Computer Vision" service to recognize a photo of dishes, to determine their presence in the menu.
Use the "Translator" service to translate the menu.
Furthermore, thanks to two Serverless functions, the notification of the booking and a booking reminder are implemented.
The user will then use the system through the Telegram Bot or through the WebApp and the admin will use the system through the WebApp, specifically it will have a dedicated section for managing reservations.
First of all it is necessary an Azure Subscription and you need to clone our repository.
git clone https://github.com/EDesimone12/Restaurant-Suite.git
Create the resources used on the azure portal through the Azure CLI or the online platform.
Run this command on the Azure CLI to log into
az login
Start the creation of the resources,
choose the names that suit your needs for every < param > :
First the resource group
az group create --name <myresourcegroup> --location <westus>
Then the Azure MySQL Server
az mysql server create --resource-group <myresourcegroup> --name <mydemoserver> --location westus --admin-user <myadmin> --admin-password <server_admin_password> --sku-name GP_Gen5_2
The creation of the database on the Azure MySQL Server created
az mysql db create --resource-group <myresourcegroup> --name <demo> --server-name <mydemoserver>
If you want to set Firewall rules
az mysql server firewall-rule create --resource-group <myresourcegroup> --server <mydemoserver> --name <AllowMyIP> --start-ip-address <192.168.0.1> --end-ip-address <192.168.0.1>
Other information on the Azure MySQL Server at the official link here!
Follow these simple steps for the WebApp creation!
- Go to the home
- Press "Create a resource"
- Choose App Service WebApp
- Insert all the information about the WebApp configuration:
Your subscription
Resource Group Name (the previous one)
Publish: Code
Runtime stack: Java 11
Java webserver stack: Tomcat 9.0
Operating system: Windows
Region: West Europe
SKU: Free
ASP Name: < your-asp-name >
GitHub Account: < your-account-name >
Organization: < your-organization-name >
Repository: < your-repository >
Branch: < your-branch-name > - Have fun with your best IDE and its Azure plugin as at the link here, our configuration was IntelliJ IDEA with the Azure toolkit plugin.
In order to start the (creation - working - deploying) process, you have to:
- Download Node.js 16.x
- Download Visual Studio Code
- Install Visual Studio Code Azure plugin
- Instal Azure Function Core Tools 4.x based on your system.
Let's start!
- Login into Azure using the Azure plugin
- Create a New Project using the Azure plugin(Function Area)
- You can now edit and run your function locally
- Use the deploy button of the Azure plugin for an easily deploy
Official Microsoft Azure Guide about Serverless function here
In order to start the (creation - working - deploying) process, you have to:
-
Download Node.js 16.x
-
Download Bot Framework Emulator
-
Installare Yeoman e il generatore Yeoman per Bot Framework v4:
- Open terminal with administrator privileges
- Install Yeoman
npm install -g yo
- Install Yeoman generator
npm install -g generator-botbuilder
Bot Creation
Use the generator for the creation of a core bot
yo botbuilder
Output after the entire command execution
? What's the name of your bot? < my-chat-bot > ? What will your bot do? < Description of bot > ? What programming language do you want to use? JavaScript ? Which template would you like to start with? Core Bot - https://aka.ms/bot-template-core ? Looking good. Shall I go ahead and create your new bot? Yes
Run the Bot
Open terminal, find your project directory and run this command
npm start
Now the bot is running on 3978 port
Run the emulator and connect it to the bot -
Open Bot Framework Emulator
-
Click "Open Bot"
-
Type the Bot url usually is an url like, http://localhost:3978/api/messages
-
Select "Connect"
Deploy Azure Bot
You must have a Javascript Bot locally developed
Create the App Service for the Bot hosting
az ad app create --display-name <displayName> --password <AtLeastSixteenCharacters_0> --available-to-other-tenants
Save appId & appSecret for the next step
Execute the deploy through arm model with a new resource group
az deployment sub create --template-file <path-to-template-with-new-rg.json> --location <region-location-name> --parameters appId=<app-id-from-previous-step> appSecret=<password-from-previous-step>botId=<id or bot-app-service-name> botSku=F0 newAppServicePlanName=<new-service-plan-name> newWebAppName=<bot-app-service-name> groupName=<new-group-name> groupLocation=<region-location-name> newAppServicePlanLocation=<region-location-name> --name=<bot-app-service-name>
Prepare your project for the deploy
- Set MicrosoftAppId & MicrosoftAppPassword in a file .env from the previous appId & appSecret
- Move to project directory in a terminal window
az bot prepare-deploy --code-dir "." --lang Javascript
- Make a .zip file containing all the project files and then
az webapp deployment source config-zip --resource-group <resource-group-name> --name <name-of-web-app> --src <project-zip-path>
Creation of the resource using Azure Web Portal
- Go to the home
- Press "Create a resource"
- Choose "Computer Vision"
- Insert informations about the resource
Subscription: < your subscription >
Resource group name: < your-resource-group >
Region: < West Europe >
Resource Name: < Name >
SKU: < Free F0 >
Creation of the resource using Azure Web Portal
- Go to the home
- Press "Create a resource"
- Choose "Translator"
- Insert informations about the resource
Subscription: < your subscription >
Resource group name: < your-resource-group >
Region: < West Europe >
Resource Name: < Name >
SKU: < Free F0 >