diff --git a/.DS_Store b/.DS_Store index 97c51a2..e938861 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Bindings/Haskell/dist-mcabal/autogen/Paths_p2prc.hs b/Bindings/Haskell/dist-mcabal/autogen/Paths_p2prc.hs deleted file mode 100644 index 4304a93..0000000 --- a/Bindings/Haskell/dist-mcabal/autogen/Paths_p2prc.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Paths_p2prc where -import Data.Version -version :: Version; version = makeVersion [0,1,0,0] -getDataDir :: IO FilePath; getDataDir = return "/Users/akilan/.mcabal/mhs-0.12.3.0/packages/p2prc-0.1.0.0/data" diff --git a/Bindings/Haskell/lib/API.hs b/Bindings/Haskell/lib/API.hs index d82fbb1..0cc616e 100644 --- a/Bindings/Haskell/lib/API.hs +++ b/Bindings/Haskell/lib/API.hs @@ -20,19 +20,21 @@ import Error import JSON ( IPAddressTable(..) , MapPortResponse(..) - , P2prcConfig + , P2PRCConfig ) import CLI ( StdInput(..) , CLIOpt(..) , eitherErrDecode - , p2PrcCmdName + , p2prcCmdName , eitherExecProcess , eitherExecProcessParser - , spawnProcP2Prc + , spawnProcP2PRC ) +-- import System.Environment (lookupEnv) + -- | Lower level P2PRC Haskell api that exposes basic functionality necessary to joint the network. @@ -41,7 +43,7 @@ data P2PRCapi = MkP2PRCapi { startServer :: IOEitherError ProcessHandle -- ^ Start server - , execInitConfig :: IOEitherError P2prcConfig + -- , execInitConfig :: IOEitherError P2PRCConfig -- ^ Instantiate server configuration , execListServers :: IOEitherError IPAddressTable -- ^ List servers in network @@ -94,14 +96,14 @@ main = p2prcAPI :: P2PRCapi p2prcAPI = MkP2PRCapi - { startServer = spawnProcP2Prc p2PrcCmdName [ MkOptAtomic "--s" ] + { startServer = spawnProcP2PRC p2prcCmdName [ MkOptAtomic "--s" ] , execListServers = - execProcP2PrcParser [ MkOptAtomic "--ls" ] MkEmptyStdInput + execProcP2PRCParser [ MkOptAtomic "--ls" ] MkEmptyStdInput , execMapPort = \ (MkMapPortRequest portNumber domainName) -> - execProcP2PrcParser + execProcP2PRCParser [ MkOptTuple ( "--mp" , show portNumber @@ -113,39 +115,41 @@ p2prcAPI = ] MkEmptyStdInput - , execInitConfig = do + -- , execInitConfig = do - confInitRes <- execProcP2Prc [ MkOptAtomic "--dc" ] MkEmptyStdInput + -- confInitRes <- execProcP2PRC [ MkOptAtomic "--dc" ] MkEmptyStdInput - case confInitRes of - (Right _) -> do + -- case confInitRes of + -- (Right _) -> do - -- TODO: get config file name dynamically - -- - currDirectory <- getCurrentDirectory + -- maybeValue <- lookupEnv "P2PRC" - -- TODO: change values before loading file - let fname = currDirectory ++ "/config.json" :: FilePath + -- -- TODO: get config file name dynamically + -- -- + -- currDirectory <- getCurrentDirectory + + -- -- TODO: change values before loading file + -- let fname = currDirectory ++ "/config.json" :: FilePath - -- TODO: read config check if file exists - configContent <- readFile fname + -- -- TODO: read config check if file exists + -- configContent <- readFile fname - pure $ eitherErrDecode configContent + -- pure $ eitherErrDecode configContent - (Left err) -> pure $ Left err + -- (Left err) -> pure $ Left err } where - execProcP2PrcParser :: + execProcP2PRCParser :: FromJSON a => [CLIOpt] -> StdInput -> IOEitherError a - execProcP2PrcParser = eitherExecProcessParser p2PrcCmdName + execProcP2PRCParser = eitherExecProcessParser p2prcCmdName -- TODO: GHC question, why does it scope down instead staying generic - execProcP2Prc = eitherExecProcess p2PrcCmdName + -- execProcP2PRC = eitherExecProcess p2prcCmdName diff --git a/Bindings/Haskell/lib/CLI.hs b/Bindings/Haskell/lib/CLI.hs index ff0b69e..43fb4d8 100644 --- a/Bindings/Haskell/lib/CLI.hs +++ b/Bindings/Haskell/lib/CLI.hs @@ -87,8 +87,8 @@ optsToCLI = concatMap _optToCLI _optToCLI (MkOptTuple (o, v)) = [o, v] -spawnProcP2Prc :: CLICmd -> [CLIOpt] -> IOEitherError ProcessHandle -spawnProcP2Prc cmd opts = +spawnProcP2PRC :: CLICmd -> [CLIOpt] -> IOEitherError ProcessHandle +spawnProcP2PRC cmd opts = do let prc = proc cmd $ optsToCLI opts @@ -115,6 +115,6 @@ eitherErrorDecode esa = -- assumes the program is ran inside the haskell module in p2prc's repo -- assumes that last path segment is "haskell" and that p2prc binary's name is "p2p-rendering-computation" -p2PrcCmdName :: String -p2PrcCmdName = "p2p-rendering-computation" +p2prcCmdName :: String +p2prcCmdName = "p2prc" diff --git a/Bindings/Haskell/lib/Engine.hs b/Bindings/Haskell/lib/Engine.hs index 4a78e77..de13bf9 100644 --- a/Bindings/Haskell/lib/Engine.hs +++ b/Bindings/Haskell/lib/Engine.hs @@ -95,7 +95,7 @@ runP2PRC ( MkP2PRCapi { startServer = startServer - , execInitConfig = execInitConfig + -- , execInitConfig = execInitConfig , execListServers = execListServers , execMapPort = execMapPort } @@ -105,12 +105,12 @@ runP2PRC let - configValue <- execInitConfig + -- configValue <- execInitConfig -- TODO: get name of host server from config json - print configValue - putStrLn "\n\n\n" + -- print configValue + -- putStrLn "\n\n\n" eitherStartProcessHandle <- startServer diff --git a/Bindings/Haskell/lib/JSON.hs b/Bindings/Haskell/lib/JSON.hs index 9affc8c..af34f77 100644 --- a/Bindings/Haskell/lib/JSON.hs +++ b/Bindings/Haskell/lib/JSON.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} module JSON - ( P2prcConfig(..) + ( P2PRCConfig(..) , IPAddressTable(..) , IPAddress(..) , ServerInfo(..) @@ -38,11 +38,11 @@ instance FromJSON MapPortResponse where -{-# WARNING P2prcConfig "This type is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-} +{-# WARNING P2PRCConfig "This type is unstable at the moment due to the P2PRC's library error handling bug. For more information visit: https://github.com/Akilan1999/p2p-rendering-computation/issues/114#issuecomment-2474737015" #-} -- | This represents the server configuration that defines its attributes and behaviours in the network, as well as, the location of the runtime persistence artifacts. -newtype P2prcConfig - = MkP2prConfig +newtype P2PRCConfig + = MkP2PRCConfig { machineName :: String -- ^ Machine Name } deriving Show @@ -96,13 +96,13 @@ newtype P2prcConfig -- to have a dedicated port field -instance FromJSON P2prcConfig where +instance FromJSON P2PRCConfig where parseJSON (Object o) = do machineName <- o .: "MachineName" pure - $ MkP2prConfig + $ MkP2PRCConfig { machineName=machineName } diff --git a/Bindings/Haskell/lib/P2PRC.hs b/Bindings/Haskell/lib/P2PRC.hs index 1fb78c0..c948ced 100644 --- a/Bindings/Haskell/lib/P2PRC.hs +++ b/Bindings/Haskell/lib/P2PRC.hs @@ -49,7 +49,7 @@ module P2PRC -- ** Interface data types -- | This section gives an overview on the runtime and host machine interfaces. , P2PRCapi(..) - , P2prcConfig(..) + , P2PRCConfig(..) , MapPortRequest(..) , MapPortResponse(..) @@ -76,7 +76,7 @@ import JSON , ServerInfo(..) , IPAddress(..) , MapPortResponse(..) - , P2prcConfig(..) + , P2PRCConfig(..) ) import API diff --git a/Bindings/Haskell/out.comb b/Bindings/Haskell/out.comb deleted file mode 100644 index fa7af8b..0000000 --- a/Bindings/Haskell/out.comb +++ /dev/null @@ -1 +0,0 @@ -z \ No newline at end of file diff --git a/Docs/index.html b/Docs/index.html index 27889d0..56c1702 100644 --- a/Docs/index.html +++ b/Docs/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +
+
+// Do ensure that the docker command does not need sudo to run sudo chmod 666 /var/run/docker.sock
+make
.bashrc
+
export P2PRC=/<PATH>/p2p-rendering-computation
export PATH=/<PATH>/p2p-rendering-computation:${PATH}
+p2prc -s
+p2prc --specs=<ip address>
--gpu if you know the other machine has a gpu.
-+p2prc --touch=<server ip address> -p <number of ports> --gpu
+p2prc --rm=<server ip address> --id=<docker container id>
+p2prc --as=<server ip address you want to add>
+p2prc --us
+p2prc --ls
+p2prc --ni
+p2prc --tc
+p2prc --plugin <plugin name> --id <container id or group id>
+p2prc --cgroup
+p2prc --group <group id> --id <container id>
+p2prc --groups
+p2prc --group <group id>
+p2prc --rmcgroup --group <group id> --id <container id>
+p2prc --rmgroup <group id>
+p2prc --pp <repo link>
+p2prc --rp <plugin name>
+p2prc --amd "custom metadata"
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>
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>@@ -561,7 +533,6 @@ p2prc --mp <port no to map> --dn <domain name to link Mapped port again
Figure 1: UML diagram of P2P module
@@ -592,7 +563,6 @@ functions and structs. The sub topics below will mention the implementations of each functionality in depth./FRPPort+http://<turn server ip>:<server port no>/FRPport@@ -708,7 +674,6 @@ func main() {
.so and .h from t
compiler.
+# run cd Bindings/ # list files @@ -778,7 +739,6 @@ ls Client.go
+
func <Function name> (output *C.char) {
<response>,<error> := <P2PRC function name>(<parameters if needed>)
if <error> != nil {
@@ -877,13 +832,12 @@ func <Function name> (output *C.char) {
P2PRC officially supports Haskell bindings and will further support @@ -936,7 +889,6 @@ project using Haskell to build orchestrators on top of P2PRC.
/FRPPort+http://<turn server ip>:<server port no>/FRPport@@ -1071,16 +1018,12 @@ func main() {
Let's try to setup a really easy program (Let's do with Linkwarden @@ -1112,36 +1054,38 @@ with docker compose :) ). This is under the assumption you have docker compose installed on your local machine.
-mkdir linkwarden && cd linkwarden ++mkdir linkwarden && cd linkwarden curl -O https://raw.githubusercontent.com/linkwarden/linkwarden/refs/heads/main/docker-compose.yml curl -L https://raw.githubusercontent.com/linkwarden/linkwarden/refs/heads/main/.env.sample -o ".env"+Environment configuration
--vim .env ++vim .env # Change values NEXTAUTH_URL=https://<DOMAIN NAME>/api/v1/auth NEXTAUTH_SECRET=VERY_SENSITIVE_SECRET POSTGRES_PASSWORD=CUSTOM_POSTGRES_PASSWORD+Run linkwarden!
--docker compose up ++docker compose up+If setup correctly linkwarden should @@ -1157,34 +1101,38 @@ Time to setup P2PRC
Run p2prc as a background
--p2prc -s & ++p2prc -s &+Run map port and domain mapping
--p2prc --mp 3000 --dn <DOMAIN NAME> ++p2prc --mp 3000 --dn <DOMAIN NAME>+Sample response
-- { ++{ "IPAddress": "217.76.63.222", "PortNo": "61582", "EntireAddress": "217.76.63.222:61582" }+Add DNS entry
--A entry 217.76.63.222 ++A entry 217.76.63.222+Your done now just head to the DOMAIN NAME you added. @@ -1196,27 +1144,16 @@ ex: https://linkwarden.akilan.io
Consists of personal loideas for the future of P2PRC. At moment only has main contributors writiing to this.
This stems from a personal issue I have when doing research @@ -1232,9 +1169,8 @@ and would introduce a new layer fault tolerance within a local network nodes.
We build a cool set possibilities before and use this to build up the implementation @@ -1265,8 +1201,8 @@ weight hypervisors.
Figure 2: Implementation idea (To be improved upon)
@@ -1292,8 +1228,8 @@ other nodes can access the Morello board who have permission access.