Usizo

YEBO virtual assistant backend repo

Table of content

Description

Usizo is a mobile virtual assistant that mediates communication between the labor force and management layer to allow both parties to exchange key information regarding work orders and exceptions reported. The crucial part of the application is the integration with the Oracle ERP system to fetch all requested data.

Installation

$ npm install

Running the app

# development
$ npm run start
# watch mode
$ npm run start:dev
# run on windows
$ npm run start:dev-windows
# run migration on server
$ npm run start:prod-migration
# production mode
$ npm run start:prod

Running the documentation

$ npm run documentation
path to documentation: http://127.0.0.1:8080

Swagger documentation
http://localhost:${PORT}/api-docs

Launch new server instance

  1. Launch new instance from AWS EC2 dashboard

    1.1 Application and OS Images (Amazon Machine Image)

    You will probably want to build Ubuntu 22.04 or later. You can also experiment with other distributions, or even with Windows, but the original idea is to use Ubuntu.

    1.2 Instance type

    It is chosen based on your tasks and capabilities, at the moment it is decided to use t3.meduim.

    1.3 Network settings

    You can create new network settings to configure according to your needs, or you can choose launch-wizard-2, which configures access to the server via HTTP, HTTPS and SSH.

    Also, you need to select ec2-rds-1, because the connection to the database is configured only from EC2 instances located on this network.

  2. Connect to your EC2 instance and launch it

  • Connect via ssh

    $ ssh -i <path_to_key> <username>@<host>
  • Feel some good vibe

    $ curl parrot.live
  • Update system modules

    $ sudo apt update
    $ sudo apt upgrade
    $ sudo reboot
  • Install node with nvm

    • install nvm

      $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

      If you faced with some issues - check this paragraph.

    • install NodeJS

      $ nvm install 18.13.0 && nvm alias default 18.13.0

      The project started with node version 18.13.0 lts/hydrogen, but you can try with a newer version.

  • Install pm2

    $ npm install pm2 -g
    $ pm2 startup

    Second command using to auto load pm2 after server restart.

  • Install nginx

    $ sudo apt install nginx

    You can check this article to learn more!

    After this you can go to your server address (only HTTP for now) and you should be able to see Welcome to nginx! message.

  • Add server ssh key to bitbucket

    To create SSH keys on server you can use

    $ ssh-keygen

    To get your key

    $ cat ~/.ssh/id_rsa.pub | pbcopy

    As an admin you can add read-only keys to your repo here.

  • Clone project to server

    $ git clone git@bitbucket.org:usizovirtual/usizo-be.git

    Run npm install && npm run start:dev to check does the backend run without dependency issues.

  • Configure nginx as proxy server for backend

    Default backend address is http://127.0.0.1:3000

    You can check this article to find some information.

    Do not forget to increase max file size, as we need to upload images and voices

    $ vim /etc/nginx/nginx.conf
    
    # Add next line to `http` config
    client_max_body_size 50M;
  • Optional Install self signed certificates for your server

    You can check this article to find some information.

    Current config /etc/nginx/sites-available/ec2-server example:

      server {
        listen 443 ssl;
        listen [::]:443 ssl;
        include snippets/self-signed.conf;
        include snippets/ssl-params.conf;
    
        server_name ec2-44-209-73-56.compute-1.amazonaws.com www.ec2-44-209-73-56.compute-1.amazonaws.com;
    
        location / {
            proxy_pass http://127.0.0.1:3000;
        }
    }
    
    
    server {
        listen 80;
        listen [::]:80;
    
        server_name ec2-44-209-73-56.compute-1.amazonaws.com www.ec2-44-209-73-56.compute-1.amazonaws.com;
    
        location / {
            return 301 https://$server_name$request_uri;
        }
    }

License

Nest is MIT licensed.

results matching ""

    No results matching ""