Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Web App as a multi large network manager

Web App as a multi large network manager

Presented at Web-5 Conference 2013:

Story about the construction of a web application for monitoring, support, improve and control of a large network of POS. Very large network in Linux, multi-servers, multi-POS in every server, all communications being over ssh.

Avatar for Filipe Moura

Filipe Moura

June 14, 2013
Tweet

More Decks by Filipe Moura

Other Decks in Programming

Transcript

  1. Who am I... • Name: Filipe Moura • AKA: supermoura

    • From: Porto - Portugal 2 Segunda-feira, 17 de Junho de 13
  2. Once upon a time... • Hired by International Retail Company:

    • Automate Support Processes • Effectively solve Ad Hoc requests • Integrated application • Respond to many departments 4 Segunda-feira, 17 de Junho de 13
  3. Analysis • Large Network of Servers and Point Of Sales

    (POS) • Support Team is responsible for: • maintaining the FrontOffice Application • Solve the everyday problems • Performing repetitive tasks • Response to Ad Hoc Requests 5 Segunda-feira, 17 de Junho de 13
  4. Network • OS: Linux • Database: • PostgreSQL • Access

    on localhost • IP: fixed - known Server 7 Segunda-feira, 17 de Junho de 13
  5. Network • OS: Linux • Database: • PostgreSQL • Access

    on localhost • IP: DHCP - unknown Point Of Sale - POS 8 Segunda-feira, 17 de Junho de 13
  6. Introducing the Supporter Knowledge & Skills: Knowledge & Skills: Knowledge

    & Skills: Programming Low Database Basic POS & Sever High Business Model High Patience Very High 9 Segunda-feira, 17 de Junho de 13
  7. Before WebApp... • Every Supporter has it own Excel, but:

    • not standardized • might not be up to date • is not shared with others • Every Supporter has it own manuals 12 Segunda-feira, 17 de Junho de 13
  8. Before WebApp... • There was no historical or centralized documentation

    • Each action was performed manually on all Servers and all POS • All connections is over Secure Shell (SSH) 13 Segunda-feira, 17 de Junho de 13
  9. Before WebApp... • Consult other applications manually • Was not

    possible to interact with other areas in an integrated way • All tasks took too long to perform 14 Segunda-feira, 17 de Junho de 13
  10. The WebApp • The application should be: • Fast •

    Intuitive • Practical • Avoid the need for training 16 Segunda-feira, 17 de Junho de 13
  11. The WebApp • The application should be: • Scalable and

    Flexible • Contain Access Control • Configurable and customizable • Available anywhere over VPN 17 Segunda-feira, 17 de Junho de 13
  12. The WebApp • I decided to create a Web Application

    with: • PHP • MySQL • Linux & Apache • ... jQuery, Ajax, System Calls 18 Segunda-feira, 17 de Junho de 13
  13. Server Database • All information loaded on page load •

    jQuery Plugin DataTables • http://www.sprymedia.co.uk/article/DataTables • Search very fast with javascript filter • Firefox Plugin for fast connections 21 Segunda-feira, 17 de Junho de 13
  14. WebApp Firefox Plugin • Selecting an IP • Mouse right

    button menu • Hot Keys • Reduce time on connections 23 Segunda-feira, 17 de Junho de 13
  15. Restrictions • Server • Application with proprietary code • Installation

    and rollout of new versions • Access to the database only on localhost 26 Segunda-feira, 17 de Junho de 13
  16. Restrictions • POS • Application with proprietary code • Installation

    and rollout of new versions • Access to the database only on localhost • IP by DHCP, only known by the Server 27 Segunda-feira, 17 de Junho de 13
  17. Database Connection Model • Web App make a System call:

    • Shell Script: • connect to server over ssh • execute query on server • Shell script get results • WebApp get and show results 29 Segunda-feira, 17 de Junho de 13
  18. Database Connection Shell Script #!/bin/bash SERVERIP=$1; SQL="select * from pos;";

    RESULTS=`ssh $SERVERIP -qn "echo \"$SQL\" | psql - U user storedb "`; echo $RESULTS; 31 Segunda-feira, 17 de Junho de 13
  19. Complex Execution Shell Script #!/bin/bash SERVERIP=$1; DAY=$2 FINALDAY=$3 SQL="select pos,posip

    from pos;"; RESULTS=` ssh $SERVERIP -qn " while [ \"\$DAY\" != \"$FINALDAY\" ]; do echo \"$SQL\" | psql -U user storedb -t -A -F ' ' | while read POS POSIP; do wget -T 1 -t 1 -q ftp://root:xxx@\$POSIP//datafiles/\$DAY/file.data; ssh $POSIP ... done DAY=\$(date -d \"\$DAY 1 days\" +%Y-%m-%d); done “ `; echo $RESULTS; 32 Segunda-feira, 17 de Junho de 13
  20. Reports • Allow Custom Reports • Responds to Ad Hoc

    requests • Configurable and customizable 38 Segunda-feira, 17 de Junho de 13
  21. POS Images Allows to send new images for POS 41

    Segunda-feira, 17 de Junho de 13
  22. POS Images The images are sent to the POS according

    to their maximum resolution: 640x480 or 800x600 43 Segunda-feira, 17 de Junho de 13
  23. Search across Applications To verify the integrity of information: •

    Prices • Promotions • Items • Vouchers • Clients ... 44 Segunda-feira, 17 de Junho de 13
  24. 96% 4% Recover POS* Before: 2h After: 5min * Recover

    1 day in 1 Server, all POS 48 Segunda-feira, 17 de Junho de 13
  25. 83% 17% Ad Hoc Reports Before: 1h After: 10min 99,9%

    0,1% Before: 12d After: 10min 50 Segunda-feira, 17 de Junho de 13