GithubHelp home page GithubHelp logo

catalog-update-automation's Introduction

catalog-update-automation

Part 1: Working with Supplier Images

  1. Grant executable permission to download_drive_file.sh

    sudo chmod +x ~/download_drive_file.sh
  2. Command to download supplier data

    ./download_drive_file.sh 1LePo57dJcgzoK4uiI_48S01Etck7w_5f supplier-data.tar.gz
  3. Extract the downloaded data

    tar xf ~/supplier-data.tar.gz
  4. Create a new Python script named changeImage.py to convert raw image data to jpeg

  5. Grant executable permission to changeImage.py

    sudo chmod +x ~/changeImage.py
  6. Confirm whether the properties of new image has been properly converted

    file ~/supplier-data/images/003.jpeg

Part 2: Uploading Images to Web Server

  1. Grant executable permission to example_upload.py

    sudo chmod +x ~/example_upload.py
  2. The command below will upload the sample image to web server

    ./example_upload.py
  3. Create a Python script named supplier_image_upload.py to upload converted images to web server

  4. Grant executable permission to supplier_image_upload.py

    sudo chmod +x ~/supplier_image_upload.py

Part 3: Upload Item Description to Web Server

  1. At this point, the Django server has been running. The Django REST framework can be accessed on URL below.

    {PUBLIC_IP}/fruits
  2. Try POST method with the following json data

    {
      "name": "Test Fruit",
      "weight": 100,
      "description": "This is the description of my test fruit",
      "image_name": "icon.sheet.png"
    }
  3. Create a Python script named run.py to read item description from directory and upload all description to web server

  4. Grant executable permission to run.py

    sudo chmod +x ~/run.py
  5. Run the script

    ./run.py
  6. Validate the process and ensure all images are shown on the web

    http://{public_ip}/
    

Part 4: Generate PDF Report and Send It through Email

  1. There are 3 scripts that have to be created, reports.py, emails.py, and report_email.py

  2. The reports.py will create a pdf report based on name and weight of items supplied by suppliers.

  3. The emails.py will create a message object and send message to receiver. The content of the email includes the pdf file generated by reports.py

  4. Finally report_email.py is the main script that will call both reports.py and emails.py to perform these tasks.

  5. Grant executable permissions to report_email.py

    sudo chmod +x ~/report_email.py
  6. Run the script

    ./report_email.py
  7. Confirm that the email is actually sent to the receiver by logging in to webmail

    {public_ip}/webmail
    

Part 5: System Health Check

  1. The final part is about creating an automatic alerting system in case abnormal behavior in the system is detected

  2. Create a Python script named health_check.py to monitor CPU usage, disk space, available memory, and localhost connection

  3. The check should be performed every 1 minute. If abnormal behavior occurs, the script will send an email to receiver.

  4. While the script is running, install stress toll to test the script

    sudo apt install stress
  5. Run the stress tool and check whether alert message is received on receiver side.

    stress --cpu 8

catalog-update-automation's People

Contributors

dvsu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.