Skip to main content

Tool for managing resources on a remove machine using openapi

Project description

Netport

Licence Python Versions Pypi Version Code Quality Status

Netport is a tool for managing single-access resources on the target Unix machine. Netport manages the access to different types of resources on the operating system by not allowing multiple requests to the same resource. For example ports, files, processes, network interfaces, and more...

How it works

flowchart TD
    client([Client])
    server[/Netport Server\]
    database[(Database)]
    resources{{Resources}}
    ports(Ports)
    interfaces(Interfaces)
    fs(File System)
    proc(System Processes)
    info(System Info)
    
    client <--REST API requests--> server
    server <--stores server state---> database
    server <----> resources
    resources --- ports
    resources --- interfaces
    resources --- fs
    resources --- proc
    resources --- info

Framework

Netport runs in a single python process on the target machine. It uses the FastAPI framework to make a high performance and easy to use REST api server. By using this api, users can easily perform a variety of requests to various resources.

There are many types of requests that can be made:

  • Acquire a free port.
  • Check if file exists
  • Declare that a file is being used
  • Start a process
  • Get a list of already acquired resources

And many more...

Backend Storage

In order to maintain an active memory of the used resources, Netport communicates with a database. There are 2 types of supported databases that netport uses:

  • Redis database
  • Local pythonic database.

Both databases serve the same purpose for netport, but their inner functionality still a bit different, with one draw back for the local database. The local database doesn't save netport's state after a shutdown or a reboot.

The decision whether to use redis DB or a local one, depends by the user. In case of an unexpected shutdown, with redis the state of netport will be stored and on reboot it will continue from where it stopped. On the other hand, for much simpler systems this feature might be unnecessary complicated.

Installation

Make sure that python is installed on your machine (3.7 and above). Open your terminal and run the following command:

pip install netport

It is advised to use a dedicated python virtual environment for netport.

Developer Installation

Install poetry by following the instructions here.

  1. Clone this repository:
git clone https://github.com/IgalKolihman/netport.git
  1. Install the development environment:
poetry install --with dev

Usage

Please follow the installation procedure to be able to run Netport. After that netport will be available to you as long as you are using it's virtual environment.

To run netport with basic configurations, run:

netport

After executing this command, a link will appear in the terminal to the server's url. The API documentation will be available at: "http://host_ip:port/docs"

For more advanced information regarding netport execution, run the following command:

netport -h

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netport-0.4.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

netport-0.4.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file netport-0.4.0.tar.gz.

File metadata

  • Download URL: netport-0.4.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.4 Windows/10

File hashes

Hashes for netport-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c9651dc6c4f78d156d68ee9cb6eb5aadbda8f3b9f356a7750d8b673e193e6a35
MD5 c43d2f797f1295a20c0a0355fdbfb6b8
BLAKE2b-256 07cacb4915a8470db97780a80c1b668045ecbb63d92fee787c63f9be78a59a34

See more details on using hashes here.

File details

Details for the file netport-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: netport-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.4 Windows/10

File hashes

Hashes for netport-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bd336ef127364c6835da89e80cebae3300f7f2ae543f03196e26011e243ed52
MD5 56bed64623b1e4e151a961fc1f3b2778
BLAKE2b-256 70281e2b366ac995f2cbea66d4407616dac9b97159ac45f10090713447e3e23f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page