Giter Club home page Giter Club logo

debian-package-status's Introduction

Debian Package Status

This Python-based web server displays information in an HTML inteface about Debian/Ubuntu software packages. It pulls package information from /var/lib/dpkg/status and serves up a website where the package information can be browsed.

It contains no external dependencies and only relies on the Python 3.6 Standard Library.

An example is currently hosted on Heroku: https://debian-package-status.herokuapp.com/

Getting Started

Prerequisites

This project requires Python 3.6 or above. It only uses the Python Standard Library and therefore does not depend on any external modules.

You can check your installed Python version with:

$ python --version

Running the server (localhost)

You can run the server locally by executing server.py. By default, the server executes on localhost port 80 and serves the included status.real dpkg/status file.

$ python server.py
Initializing web server with the following parameters:
ip_address: localhost
port: 80
dpkg_status_filepath: status.real

Navigate to localhost:80 in your webbrowser to access the web server.

Runing the server (local network)

You can run the server on the local network by specifying 0.0.0.0 as the IP address and port 80. This will make the server available on port 80 for all IP addresses that your computer is assigned.

$ python server.py -i 0.0.0.0 -p 80

Hint: You can check your computer's IP address with $ ipconfig on Windows or $ ifconfig on Linux.

Getting Help

You can see the available command line options by providing the --help flag to the server.

$ python server.py --help
optional arguments:
  -h, --help            show this help message and exit
  -i IPADDRESS, --ipaddress IPADDRESS
                        IP address of the server (localhost by default).
  -p PORT, --port PORT  Port that server should serve (80 by default).
  -f FILE, --file FILE  Filepath to dpkg status file (usually
                        /var/lib/dpkg/status). By default status.real is used.

Deployment on Heroku

Heroku is a container-based cloud Platform as a Service (Paas). They provide a free tier that allows users 550 free 'dyno' hours per month (1000 if credit card verified). When the server does not receive traffic for 30 minutes, the process will go to 'sleep' which will save 'dyno' hours. It will then take 5-10 seconds to 'wake' the server when a new request is received.

To deploy the web server on Heroku, first create a Heroku account https://signup.heroku.com/.

Install Heroku command line interface (CLI).

Login to Heroku from command line

$ heroku login

Navigate to the root of the debian-package-status project and create a heroku app. A random name will be given to the app if one is not specified (you can always rename the app later).

$ heroku create
Creating app... done, ⬢ warm-earth-66720
https://warm-earth-66720.herokuapp.com/ | https://git.heroku.com/warm-earth-66720.git

You can make changes to the source code and push the changes to Heroku using git.

$ git push heroku master
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 402 bytes | 402.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Need to update SQLite3, clearing cache
remote: -----> Installing python-3.6.10
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: Sqlite3 successfully installed.
remote: -----> Installing requirements with pip
remote:
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 44M
remote: -----> Launching...
remote:        Released v5
remote:        https://warm-earth-66720.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/warm-earth-66720.git
   ef0edd2..a35d740  master -> master

Note: Heroku uses the Procfile to know which script to execute and what parameters to pass. The Heroku app environment has $PORT environment variable which should be passed into server.py. requirments.txt is empy because there are no dependencies for this project, but the file must still exist so that Heroku recognizes the app as a Python app.

TO-DO

  • Build Python web server
  • Parse debian control file (/var/lib/dpkg/status).
  • Display index page with list of packages alphabetically
  • When clicking on links, dynamically convert parsed data to new HTML page (Alternatively, generate pages upfront for every package)
    • Display Name
    • Display Description Parse description newlines
    • Display Package dependencies, ignoring versions
    • Reverse dependencies (requires building a graph)
    • Only link dependecies that exist in the list of packages (Don't allow broken links to non-installed pacakges)
  • Improve user experience with minimal but appealing CSS
  • Implement command line arguments
  • Make project easily deployable
  • Deploy on webserver
  • Clean up Unit Tests for each module

debian-package-status's People

Contributors

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