diff --git a/Docs/index.html b/Docs/index.html index 13fccc8..88d1493 100644 --- a/Docs/index.html +++ b/Docs/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -26,12 +26,12 @@

Table of Contents

-
  • 4. Nix Flake +
  • 4. Nix Flake +
  • +
  • 5. Using basic commands
  • -
  • 7. P2P Module Implementation +
  • 6. P2P Module Implementation
  • -
  • 8. Language Bindings +
  • 7. Language Bindings
  • -
  • 9. Config Implementation
  • -
  • 10. Abstractions +
  • 8. Config Implementation
  • +
  • 9. Abstractions
  • -
  • 11. NAT Traversal +
  • 10. NAT Traversal
  • -
  • 12. Client mode
  • -
  • 13. Simulation +
  • 11. Client mode
  • +
  • 12. Simulation
  • -
  • 14. Blog posts +
  • 13. Blog posts
  • -
  • 15. Ideas for future potencial features +
  • 14. Ideas for future potencial features @@ -163,26 +167,26 @@
  • -
    +

    Colored-On-Light-Image.png

    -
    -

    1. Guide through video

    +
    +

    1. Guide through video

    -
    -

    1.0.1. The video below shows the setup and usage of P2PRC.

    +
    +

    1.0.1. The video below shows the setup and usage of P2PRC.

    -
    +

    maxresdefault.jpg

    -
    @@ -271,7 +275,7 @@ Go API to create and interact with the containers. to install docker GPU

    -
    +
     // Do ensure that the docker command does not need sudo to run
     sudo chmod 666 /var/run/docker.sock
     
    @@ -285,7 +289,7 @@ To set up the internal dependencies and build the entire go code into a single binary

    -
    +
     make
     
    @@ -297,7 +301,7 @@ To set up P2PRC on Windows, simply run this batch file. Make sure you are not in admin mode when running this.

    -
    +
     .\install.bat
     
    @@ -307,7 +311,7 @@ are not in admin mode when running this.

    3.2.4. Add appropriate paths to .bashrc

    -
    +
     export P2PRC=/<PATH>/p2p-rendering-computation
     export PATH=/<PATH>/p2p-rendering-computation:${PATH}
     
    @@ -316,14 +320,14 @@ export PATH=/<PATH>/p2p-rendering-computation:${PATH}

    3.2.5. Test if binary works

    -
    +
     p2prc --help
     
    1. Output:
      -
      +
       NAME:
          p2p-rendering-computation - p2p cli application to create and access VMs in other servers
       
      @@ -378,8 +382,8 @@ GLOBAL OPTIONS:
       
    -
    -

    4. Nix Flake

    +
    +

    4. Nix Flake

    Nix is a growing ecosystem that allows flexibility on how you develop, build and package software and configurations. It brings all programming languages (and all other tooling) to an equal footing, despite deep design differences. More importantly, integrates all the "packaging" into the context of a "pure" function. @@ -395,8 +399,8 @@ P2PRC aims to become a utility that can be used in various flexible manners and Nix Flake is a format, within the Nix ecosystem, intentionally designed to encourage a standard in packaging distribution. The current packaging assumes that you have "nix flake" installed because it is currently an experimental feature of Nix.

    -
    -

    4.1. P2PRC core Go language repo

    +
    +

    4.1. P2PRC core Go language repo

    In case you want to develop, build or integrate using nix, you just need to run either "nix develop" or "nix run" from the command line locally in a cloned git repository or by running "nix run github:akilan1999/p2p-rendering-computation – –help" @@ -407,7 +411,7 @@ In case you want to develop, build or integrate using nix, you just need to run P2PRC library also is ready to be imported into other nix flakes. To accomplish that please make sure to override the target nixpkgs environment in the following manner;

    -
    +
     pkgs = import nixpkgs {
       inherit system;
       overlays = [
    @@ -422,15 +426,18 @@ This will make the p2prc executable available in the environment of any applicat
     

    +
    +

    4.2. P2PRC Haskell library

    +
    -
    -

    5. P2PRC Haskell library

    -
    +
    +

    4.2.1. Nix:

    +

    The project is structured to provide language bindings to any programming language. The first one being supported in this manner is the Haskell programming language. It provides a bootstrapping script for a new Cabal project with p2prc binary available in the environment and, more relevantly, the Haskell library bindings available in the virtual environment cabal environment.

    -
    +
     nix run git+https://github.com/akilan1999/p2p-rendering-computation#initHaskellProject -- <PROJECT_NAME>
     
    @@ -444,7 +451,7 @@ This will generate a new haskell project setup to automatically work with the p2 Once completed, you should go into the project directory and copy the nix flake template, necessary to define the project's environment.

    -
    +
     nix flake init -t github:akilan1999/p2p-rendering-computation#haskell
     
    @@ -452,7 +459,7 @@ nix flake init -t github:akilan1999/p2p-rendering-computation#haskell The previous command sets up the flake environment and its dependencies. It will look like the following

    -
    +
     {
       description = "Start of Haskell P2PRC flake";
     
    @@ -508,187 +515,189 @@ The template uses Cabal2Nix which manages the Haskell virtual environment automa
     

    +
    +
    -

    6. Using basic commands

    +

    5. Using basic commands

    -

    6.0.1. Start as a server

    +

    5.0.1. Start as a server

    -
    +
     p2prc -s
     
    -

    6.0.2. View server Specification

    +

    5.0.2. View server Specification

    -
    +
     p2prc --specs=<ip address>
     
    -

    6.0.3. Run container

    +

    5.0.3. Run container

    use the --gpu if you know the other machine has a gpu.

    -
    +
     p2prc --touch=<server ip address> -p <number of ports> --gpu
     
    -

    6.0.4. Remove container

    +

    5.0.4. Remove container

    The docker id is present in the output where you create a container

    -
    +
     p2prc --rm=<server ip address> --id=<docker container id>
     
    -

    6.0.5. Adding servers to ip table

    +

    5.0.5. Adding servers to ip table

    -
    +
     p2prc --as=<server ip address you want to add>
     
    -

    6.0.6. Update ip table

    +

    5.0.6. Update ip table

    -
    +
     p2prc --us
     
    -

    6.0.7. List Servers

    +

    5.0.7. List Servers

    -
    +
     p2prc --ls
     
    -

    6.0.8. View Network interfaces

    +

    5.0.8. View Network interfaces

    -
    +
     p2prc --ni
     
    -

    6.0.9. Viewing Containers created Client side

    +

    5.0.9. Viewing Containers created Client side

    -
    +
     p2prc --tc
     
    -

    6.0.10. Running plugin

    +

    5.0.10. Running plugin

    -
    +
     p2prc --plugin <plugin name> --id <container id or group id>
     
    -

    6.0.11. Create group

    +

    5.0.11. Create group

    -
    +
     p2prc --cgroup
     
    -

    6.0.12. Add container to group

    +

    5.0.12. Add container to group

    -
    +
     p2prc --group <group id> --id <container id>
     
    -

    6.0.13. View groups

    +

    5.0.13. View groups

    -
    +
     p2prc --groups
     
    -

    6.0.14. View specific group

    +

    5.0.14. View specific group

    -
    +
     p2prc --group <group id>
     
    -

    6.0.15. Delete container from group

    +

    5.0.15. Delete container from group

    -
    +
     p2prc --rmcgroup --group <group id> --id <container id>
     
    -

    6.0.16. Delete entire group

    +

    5.0.16. Delete entire group

    -
    +
     p2prc --rmgroup <group id>
     
    -

    6.0.17. Pulling plugin from a remote repo

    +

    5.0.17. Pulling plugin from a remote repo

    -
    +
     p2prc --pp <repo link>
     
    -

    6.0.18. Deleting plugin from the plugin directory

    +

    5.0.18. Deleting plugin from the plugin directory

    -
    +
     p2prc --rp <plugin name>
     
    -

    6.0.19. Added custom metadata about the current node

    +

    5.0.19. Added custom metadata about the current node

    -
    +
     p2prc --amd "custom metadata"
     
    -
    -

    6.0.20. MapPort and link to domain name

    -
    +
    +

    5.0.20. MapPort and link to domain name

    +

    Allows to expose remote ports from a machine in the P2P network.

    -
    +
     p2prc --mp <port no to map> --dn <domain name to link Mapped port against>
     
      -
    1. MapPort in remote machine
      -
      +
    2. MapPort in remote machine
      +

      This is to ensure ports on remote machines on the P2PRC can be easily opened.

      -
      +
       p2prc --mp <port no to map> --dn <domain name to link Mapped port against> --ra <remote server address>
       
      @@ -697,22 +706,22 @@ p2prc --mp <port no to map> --dn <domain name to link Mapped port again
    -
    -

    6.0.21. Add root node

    -
    +
    +

    5.0.21. Add root node

    +

    Adds a root node to P2RRC and overwrites all other nodes in the ip table. To be only added before the network is started and with the intention of a fresh instance.

    -
    +
     p2prc --arn --ip <root node ip address> -p <root node port no>
     
    -

    7. P2P Module Implementation

    +

    6. P2P Module Implementation

    The P2P module is for managing server information within the network. @@ -739,7 +748,7 @@ implementations of each functionality in depth.

    -

    7.1. IP Table

    +

    6.1. IP Table

    The ip table file is a json as the format with a list of servers ip @@ -778,7 +787,7 @@ configuration module.

    -

    7.1.1. Latency

    +

    6.1.1. Latency

    The latency is measured in milliseconds. The route /serverinfo is @@ -789,7 +798,7 @@ recorded.

    -

    7.2. NAT Traversal

    +

    6.2. NAT Traversal

    P2PRC currently supports TURN for NAT traversal. @@ -797,7 +806,7 @@ P2PRC currently supports TURN for NAT traversal.

    -

    7.3. TURN

    +

    6.3. TURN

    The current TURN implementation used is FRP. The TURN server is also @@ -810,13 +819,13 @@ from the TURN server. The flow below describes the workflow.

    -

    7.3.1. Client mode

    +

    6.3.1. Client mode

    • Call /FRPPort
    -
    +
     http://<turn server ip>:<server port no>/FRPport
     
    @@ -850,7 +859,7 @@ func main() {
    -

    8. Language Bindings

    +

    7. Language Bindings

    Language bindings @@ -861,7 +870,7 @@ compiler.

    -

    8.1. How to build shared object files

    +

    7.1. How to build shared object files

      @@ -899,13 +908,13 @@ p2prc.h p2prc.so
    -

    8.2. Workings under the hood

    +

    7.2. Workings under the hood

    Below are a sample set of commands to open the bindings implementation.

    -
    +
     # run
     cd Bindings/
     # list files
    @@ -915,7 +924,7 @@ Client.go
     
    -

    8.2.1. In Client go

    +

    7.2.1. In Client go

    There a few things to notice which are different from your standard Go @@ -993,7 +1002,7 @@ that convert a go object to JSON string initially and converts it to

  • A Pseudo code to refer to the common function implementation shape could be represented as:
    -
    +
     func <Function name> (output *C.char) {
           <response>,<error> := <P2PRC function name>(<parameters if needed>)
           if <error> != nil {
    @@ -1008,12 +1017,12 @@ func <Function name> (output *C.char) {
     
  • -

    8.3. Current languages supported

    +

    7.3. Current languages supported

    -
    -

    8.3.1. Python

    -
    +
    +

    7.3.1. Python

    +
    1. Build sample python program
      @@ -1049,23 +1058,52 @@ called from other programming languages.
    -
    -

    8.3.2. Haskell

    -
    +
    +

    7.3.2. Haskell

    +

    P2PRC officially supports Haskell bindings and will further support project using Haskell to build orchestrators on top of P2PRC.

    +
    +
      +
    1. Local machine without Nix
      +
      +

      +On the local machine we just create a folder as exports which copies the p2prc haskell bindings +and the latest build of the p2prc binary. After the binary is copied it runs the –dc in p2prc to setup the +basic p2prc configurations. To do the following just do: +

      +
      +make haskell
      +
      +
      +
    2. +
    3. Directory to enter into
      +
      +
      +cd Bindings/Haskell/exports
      +
      +
      +
    4. +
    5. Run
      +
      +
      +- cabal build
      +- cabal run
      +

      -Read more… +Read more…

      +
    6. +
    -

    9. Config Implementation

    +

    8. Config Implementation

    The configuration module is responsible to store basic information of @@ -1114,14 +1152,14 @@ configuration file was generated using JSON format.

    -

    10. Abstractions

    +

    9. Abstractions

    The Abstractions package consists of black-boxed functions for P2PRC.

    -

    10.1. Functions

    +

    9.1. Functions

    • Init(<Project name>): Initializes P2PRC with all the needed @@ -1144,14 +1182,14 @@ faster.
    -

    11. NAT Traversal

    +

    10. NAT Traversal

    P2PRC currently supports TURN for NAT traversal.

    -

    11.1. TURN

    +

    10.1. TURN

    The current TURN implementation used is FRP. The TURN server is also @@ -1166,13 +1204,13 @@ from the TURN server. The flow below describes the workflow.

    -

    12. Client mode

    +

    11. Client mode

    • Call /FRPPort
    -
    +
     http://<turn server ip>:<server port no>/FRPport
     
    @@ -1203,9 +1241,9 @@ func main() {
    -
    -

    13. Simulation

    -
    +
    +

    12. Simulation

    +

    The simulation library is a really simple library to locally run serveral instances of P2PRC to test the functionality @@ -1214,9 +1252,9 @@ the Node discovery mechanism. There are current 5 commands which can be used as shown below:

    -
    -

    13.1. Command

    -
    +
    +

    12.1. Command

    +
    • P2PRC instances "number of instances" : Starts p2prc processes based on the number of number instances provided. This includes @@ -1233,9 +1271,9 @@ testing the generated P2PRC instances.
    -
    -

    13.2. Sample bash instructions

    -
    +
    +

    12.2. Sample bash instructions

    +
    # Unset default P2PRC env path
     unset P2PRC
    @@ -1262,13 +1300,13 @@ Source code: 
    -

    14. Blog posts

    -
    +
    +

    13. Blog posts

    +
    -
    -

    14.1. Self host within 5 minutes any program

    -
    +
    +

    13.1. Self host within 5 minutes any program

    +
    -
    -

    14.1.1. 1. Find a program you want to run

    -
    +
    +

    13.1.1. 1. Find a program you want to run

    +

    Let's try to setup a really easy program (Let's do with Linkwarden with docker compose :) ). This is under the assumption you have docker @@ -1299,8 +1337,8 @@ compose installed on your local machine.

      -
    1. Let's run Linkwarden using docker compose and P2PRC
      -
      +
    2. Let's run Linkwarden using docker compose and P2PRC
      +
    -
    -

    15. Ideas for future potencial features

    -
    +
    +

    14. Ideas for future potencial features

    +

    Consists of personal loideas for the future of P2PRC. At moment only has main contributors writiing to this.

    -
    -

    15.1. To support hetrogenous set of Nodes that cannot run P2PRC

    -
    +
    +

    14.1. To support hetrogenous set of Nodes that cannot run P2PRC

    +

    This stems from a personal issue I have when doing research on CheriBSD kernel. For my research I am using the ARM morello @@ -1413,9 +1451,9 @@ and would introduce a new layer fault tolerance within a local network nodes.

    -
    -

    15.1.1. Assumptions:

    -
    +
    +

    14.1.1. Assumptions:

    +
    • I have a Morello board that cannot run P2PRC
    • The Morello has a local IP address (ex: 192.168.0.10)
    • @@ -1427,9 +1465,9 @@ as well look into custom tasks into the hetrogenous hardware.
    -
    -

    15.1.2. Set of interesting possible:

    -
    +
    +

    14.1.2. Set of interesting possible:

    +

    We build a cool set possibilities before and use this to build up the implementation plan. @@ -1445,9 +1483,9 @@ weight hypervisors.

    -
    -

    15.1.3. Implementation

    -
    +
    +

    14.1.3. Implementation

    +
    • To use implementations similar to socat to ensure we can bind address of local nodes to a node running P2PRC and the node running P2PRC can do a local map port.
    • @@ -1460,7 +1498,7 @@ other nodes can access the Morello board who have permission access.
    -
    +

    P2PRCRemoteNodes.png

    Figure 1: Implementation idea (To be improved upon)

    @@ -1472,7 +1510,7 @@ other nodes can access the Morello board who have permission access.

    Author: Akilan

    -

    Created: 2025-06-03 Tue 15:09

    +

    Created: 2025-06-06 Fri 15:58

    Validate

    diff --git a/Docs/index.org b/Docs/index.org index ac44b3a..2ed38c3 100644 --- a/Docs/index.org +++ b/Docs/index.org @@ -212,9 +212,9 @@ pkgs = import nixpkgs { This will make the p2prc executable available in the environment of any application you use. -* P2PRC Haskell library - +** P2PRC Haskell library +*** Nix: The project is structured to provide language bindings to any programming language. The first one being supported in this manner is the Haskell programming language. It provides a bootstrapping script for a new Cabal project with p2prc binary available in the environment and, more relevantly, the Haskell library bindings available in the virtual environment cabal environment. #+begin_example @@ -772,7 +772,24 @@ called from other programming languages. P2PRC officially supports Haskell bindings and will further support project using Haskell to build orchestrators on top of P2PRC. -[[https://p2prc.akilan.io/Docs/haskell][Read more...]] +**** Local machine without Nix +On the local machine we just create a folder as exports which copies the p2prc haskell bindings +and the latest build of the p2prc binary. After the binary is copied it runs the --dc in p2prc to setup the +basic p2prc configurations. To do the following just do: +#+begin_example +make haskell +#+end_example +**** Directory to enter into +#+begin_example +cd Bindings/Haskell/exports +#+end_example +**** Run +#+begin_example +- cabal build +- cabal run +#+end_example + +[[https://p2prc.akilan.io/haskell][Read more...]] * Config Implementation :PROPERTIES: