Fuel-Availability

Fuel Availability / Fuel App / Fuel Check

Fuel App is an innovative solution inspired by the fuel crisis that occurred in Sri Lanka from late 2021 to mid 2022. Fuel App was developed to provide an effective solution that simplifies the management of fuel usage and availability of fuel in filling stations.

Fuel App is a web-based platform that enables fuel stations to manage their fuel availability in a simple and user-friendly way. Designed with the needs of fuel stations in mind, this app provides a seamless experience for station owners, allowing them to manage their fuel stock with ease and efficiency once the station has been approved by the Administrator.

Install and Setup MongoDB

  1. Install

    sudo apt update && sudo apt upgrade -y
    sudo apt install mongodb -y
    sudo systemctl enable mongodb --now
    
  2. Run this command and open the config file

    sudo nano /etc/mongodb.conf
    
  3. Change bind_ip from 127.0.0.1 to 0.0.0.0

    bind_ip = 0.0.0.0
    
  4. run this command to restart mongo

    sudo systemctl restart mongodb
    

MongoDB is now publicly accessible by the default Port and the Server IP. Now, create an account and enable authorization for security

  1. Start MongoDB CLI

    mongo
    
  2. Switch to the default pre-made admin database

    use admin
    
  3. Create a new user (in this example, the username is AdminUserName and the password is SuperSecretPassword)

    db.createUser(
    {
    user: "AdminUserName",
    pwd: "SuperSecretPassword",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
    }
    )
    

The new user is created, Now, You have to make logging-in required

  1. Open the config file

    sudo nano /etc/mongodb.conf
    
  2. Edit the file content Ctrl+W to search

    authorization: enabled
    
  3. Restart MongoDB Service

    sudo systemctl restart mongod
    

Install and Setup the Web App

  1. Install main dependencies

    sudo apt update && sudo apt upgrade -y
    sudo apt install python3 python3-pip git nano -y
    
  2. Create a seperate folder (Optional)

    mkdir FuelApp && cd ./FuelApp
    
  3. Clone the repo and cd into it

    git clone "https://github.com/hirusha-adi/Fuel-Availability.git" && cd ./Fuel-Availability
    
  4. Install requirements

    python3 -m pip instal -r requirements.txt
    
  5. Edit the main config file

    • rename the .env.example. to .env and edit the .env file. (This file will be renamed as .env.old once everything has been loaded to the settings.json file)
      mv .env.example .env
      nano .env
      
    • or, edit the database/settings.json directly
    nano database/settings.json
    
    • adminkey: Password to access admin panel
    • flaskSecret: Flask Secret Key. Learn more here
    • JawgToken: Token for the Map’s Dark Theme. You can get it from here
    • mongodb and Others: Your Mongo DB Server IP, Username and Password
    • The admin user settings are to be filled once you create your account visiting the /login route. Once its updated, the web server should be restarted


  1. Start the web server

    python3 app.py
    

Images

image

image

image

image

image

image

image

image

image

image

image

image

image

image

image