Skip to content

Restaurant-Suite is a project work for the Cloud Computing course at University of Salerno

License

Notifications You must be signed in to change notification settings

EDesimone12/Restaurant-Suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍴 Restaurant-Suite 🍷 Build and deploy - RestaurantSuite

Restaurant-Suite logo

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;

☁️ Azure Services ⚡

  • 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.

🔧 Project architecture 🔩

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.

Project architecture


🚀 Installation 💻

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

Azure Database for MySQL Server

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!

AppServices(WebApp)

Follow these simple steps for the WebApp creation!

  1. Go to the home
  2. Press "Create a resource"
  3. Choose App Service WebApp
  4. 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 >

  5. 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.

Serverless Function

In order to start the (creation - working - deploying) process, you have to:

Let's start!

  1. Login into Azure using the Azure plugin
  2. Create a New Project using the Azure plugin(Function Area)
  3. You can now edit and run your function locally
  4. Use the deploy button of the Azure plugin for an easily deploy

Official Microsoft Azure Guide about Serverless function here

Azure Bot

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:

    1. Open terminal with administrator privileges
    2. Install Yeoman
    npm install -g yo
    1. 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>

Computer Vision

Creation of the resource using Azure Web Portal

  1. Go to the home
  2. Press "Create a resource"
  3. Choose "Computer Vision"
  4. Insert informations about the resource

    Subscription: < your subscription >
    Resource group name: < your-resource-group >
    Region: < West Europe >
    Resource Name: < Name >
    SKU: < Free F0 >

Translator

Creation of the resource using Azure Web Portal

  1. Go to the home
  2. Press "Create a resource"
  3. Choose "Translator"
  4. Insert informations about the resource

    Subscription: < your subscription >
    Resource group name: < your-resource-group >
    Region: < West Europe >
    Resource Name: < Name >
    SKU: < Free F0 >