moved to documentation
This commit is contained in:
168
docs/P2PRC-Tracking-home-server.drawio
Normal file
168
docs/P2PRC-Tracking-home-server.drawio
Normal file
@@ -0,0 +1,168 @@
|
||||
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" version="25.0.3">
|
||||
<diagram name="Page-1" id="JOx7t4lFG-NYTySbJPrr">
|
||||
<mxGraphModel dx="-6" dy="871" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-2" value="<div title="Page 1" class="page"><div title="Page 1" class="page"><div class="layoutArea">P2RRC tracking home server</div></div>		</div>" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="960" y="160" width="230" height="70" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-3" value="Haskell bindings" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="960" y="230" width="230" height="70" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-4" value="P2PRC" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="960" y="300" width="230" height="70" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-5" value="Operating system" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="900" y="370" width="350" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-7" value="<h1 style="margin-top: 0px;">Software stack</h1>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1010" y="60" width="140" height="70" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-8" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="3UlPJ8b2X4PRXgGVdmXH-3" edge="1" target="3UlPJ8b2X4PRXgGVdmXH-9">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1210" y="250" as="sourcePoint" />
|
||||
<mxPoint x="1410" y="260" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-9" value="P2PRC node running a wrapper. We represent this as PNRW" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1400" y="250" width="130" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-10" value="PNRW Tracker" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="970" y="640" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-11" value="....... N processes" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1310" y="590" width="230" height="210" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-12" value="Server with P2PRC process" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1380" y="540" width="90" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-14" value="" style="endArrow=classic;html=1;rounded=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0.005;exitY=0.373;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="3UlPJ8b2X4PRXgGVdmXH-11" target="3UlPJ8b2X4PRXgGVdmXH-10" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1250" y="580" as="sourcePoint" />
|
||||
<mxPoint x="1420" y="440" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-15" value="P2PRC process 1" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1320" y="600" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-16" value="P2PRC process information<div>- performance&nbsp;</div><div>- steps to restart</div><div>- custom meta-data passthrough</div>" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1160" y="670" width="100" height="120" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-20" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1020" y="710" as="sourcePoint" />
|
||||
<mxPoint x="1430" y="810" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1020" y="960" />
|
||||
<mxPoint x="1230" y="960" />
|
||||
<mxPoint x="1430" y="960" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-21" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1240" y="960" as="sourcePoint" />
|
||||
<mxPoint x="1240" y="1070" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3UlPJ8b2X4PRXgGVdmXH-22" value="<h1 style="margin-top: 0px;">Both sides are P2PRC nodes</h1>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1160" y="1080" width="180" height="70" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-3" value="PNRW 1" style="rounded=0;whiteSpace=wrap;html=1;rotation=0;strokeColor=#7DFF8E;" vertex="1" parent="1">
|
||||
<mxGeometry x="1760" y="380" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-5" value="PNRW 2 (Root node)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="1950" y="260" width="140" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-6" value="PNRW 3" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#FF7A38;" vertex="1" parent="1">
|
||||
<mxGeometry x="2110" y="380" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-7" value="PNRW 3" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#8FFF9A;" vertex="1" parent="1">
|
||||
<mxGeometry x="1940" y="500" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-11" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;entryX=0.43;entryY=0.987;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.569;exitY=-0.013;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="RwC59P_Fbuibf-wKuxvG-7" target="RwC59P_Fbuibf-wKuxvG-5">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1700" y="570" as="sourcePoint" />
|
||||
<mxPoint x="1750" y="520" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-12" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="RwC59P_Fbuibf-wKuxvG-3" target="RwC59P_Fbuibf-wKuxvG-5">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1700" y="570" as="sourcePoint" />
|
||||
<mxPoint x="1750" y="520" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-13" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="RwC59P_Fbuibf-wKuxvG-6" target="RwC59P_Fbuibf-wKuxvG-5">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1700" y="570" as="sourcePoint" />
|
||||
<mxPoint x="1750" y="520" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-14" value="" style="swimlane;startSize=0;" vertex="1" parent="1">
|
||||
<mxGeometry x="1740" y="220" width="510" height="360" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-20" value="<h1 style="margin-top: 0px;">Lenient mode</h1>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="RwC59P_Fbuibf-wKuxvG-14">
|
||||
<mxGeometry x="10" width="180" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-21" value="" style="swimlane;startSize=0;fillColor=#50FF24;strokeColor=#38FF60;" vertex="1" parent="RwC59P_Fbuibf-wKuxvG-14">
|
||||
<mxGeometry x="10" y="140" width="330" height="210" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-26" value="Potential node to run replica" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="RwC59P_Fbuibf-wKuxvG-14">
|
||||
<mxGeometry x="380" y="240" width="110" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-16" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="3UlPJ8b2X4PRXgGVdmXH-9" target="RwC59P_Fbuibf-wKuxvG-5">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1191" y="260" as="sourcePoint" />
|
||||
<mxPoint x="2050" y="140" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1600" y="265" />
|
||||
<mxPoint x="1600" y="140" />
|
||||
<mxPoint x="2020" y="130" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-17" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="3UlPJ8b2X4PRXgGVdmXH-9" target="RwC59P_Fbuibf-wKuxvG-3">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1700" y="570" as="sourcePoint" />
|
||||
<mxPoint x="1750" y="520" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1600" y="265" />
|
||||
<mxPoint x="1600" y="410" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-18" value="" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" target="RwC59P_Fbuibf-wKuxvG-7">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1600" y="410" as="sourcePoint" />
|
||||
<mxPoint x="1640" y="700" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1600" y="540" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-19" value="" style="endArrow=classic;html=1;rounded=0;" edge="1" parent="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2020" y="128" as="sourcePoint" />
|
||||
<mxPoint x="2200" y="380" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2210" y="128" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-22" value="" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.029;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;strokeColor=#8AFF78;" edge="1" parent="1" source="3UlPJ8b2X4PRXgGVdmXH-11" target="RwC59P_Fbuibf-wKuxvG-21">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1630" y="680" as="sourcePoint" />
|
||||
<mxPoint x="1680" y="630" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="RwC59P_Fbuibf-wKuxvG-25" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.318;entryY=0.989;entryDx=0;entryDy=0;entryPerimeter=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#FF8E42;" edge="1" parent="1" source="RwC59P_Fbuibf-wKuxvG-7" target="RwC59P_Fbuibf-wKuxvG-6">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1880" y="370" as="sourcePoint" />
|
||||
<mxPoint x="1930" y="320" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
BIN
docs/P2PRC-Tracking-home-server.png
Normal file
BIN
docs/P2PRC-Tracking-home-server.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
12
docs/README.md
Normal file
12
docs/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# P2PRC haskell porting plan
|
||||
This repo consists of the plans to Port P2PRC
|
||||
to haskell.
|
||||
|
||||
## Compile Org mode file to PDF:
|
||||
```
|
||||
C-c C-e l p
|
||||
```
|
||||
source: https://orgmode.org/manual/LaTeX_002fPDF-export-commands.html
|
||||
|
||||
|
||||
|
||||
119
docs/p2prc-home-server.org
Normal file
119
docs/p2prc-home-server.org
Normal file
@@ -0,0 +1,119 @@
|
||||
* P2PRC tracking home server
|
||||
** Abstract
|
||||
This is a libary on top of P2PRC to create easier abstractions
|
||||
to setup servers on spare laptops at home and run applications
|
||||
which can exibit a monolithic behavoir (Ex: Self hosted
|
||||
jitsi, Indvidious). The motivation is to ensure users can
|
||||
share self hosted infrastructure with friends and can design
|
||||
a really simple replicatable instances of servers.
|
||||
|
||||
** Problems being addressed
|
||||
1. Remembering ports mapped and stateful restart. Rather than the OS remember
|
||||
information of the processes. The P2P network should also track it and
|
||||
propogate it to other nodes in the network. This is to ensure when a process
|
||||
fails there is a formally representable reason which can appropirate corrective
|
||||
actions.
|
||||
2. Arbitary instructions used to start a process and should be remembered to reproduce a
|
||||
process if a node is down.
|
||||
|
||||
|
||||
** What are attempting to do
|
||||
The section below describes in detail the ideal startegy of addressing the problems stated
|
||||
above.
|
||||
|
||||
*** Building Abstraction
|
||||
We are proposting to build a library of the Haskell bindings which do the following:
|
||||
- Creating a P2PRC process and allowing users to modify it's behavoir in functional manner with for instance
|
||||
immutable datatypes.
|
||||
- Allowing users to run this abstraction in a reproducable manner or constrainting it to run on precise
|
||||
sets of machines.
|
||||
- Should be able to represent the deployment strategy used (ex: Nix, Ansible etc...). This keeps the
|
||||
deployment agnostic and not vendor specific.
|
||||
- The intended idea of this is to only work with monolithic applications.
|
||||
|
||||
*** Building it for only home server users
|
||||
- The use case is to ensure it's easier to setup a set of servers and shuffle P2PRC processes around
|
||||
when needed. We intend to do this by ensuring a process is represented as type.
|
||||
- Targets initially with the assumption that there is only 1 reliable root node to relay traffic to the make the setup
|
||||
easier. Future plans will create a DNS layer which can make root nodes and P2PRC processes reproducable.
|
||||
|
||||
*** Linient rules
|
||||
- This library is built for home users, therefore the library will be setup for P2PRC using the [[https://github.com/Akilan1999/p2p-rendering-computation/pull/115][unsafe mode]] which will ensure that all public
|
||||
keys will be added to the [[https://www.ssh.com/academy/ssh/authorized-keys-file#:~:text=The%20authorized_keys%20file%20in%20SSH,keys%20and%20needs%20proper%20management][SSH auth list]] of all nodes avaliable in the network. While this is not secure it
|
||||
comes with pre-assumption that all nodes joining the network are home servers and are needed to access each other
|
||||
with limited rules (set by user permission from the OS side).
|
||||
- We assume that all P2PRC processes run on a bare-metal machine without any virtualisation.
|
||||
This is because most users run on machines which they own and we offload to the users
|
||||
reponsibility to choose a tool that can support reproducable builds like [[https://nixos.org/][Nix]].
|
||||
|
||||
[[./P2PRC-Tracking-home-server.png]]
|
||||
|
||||
** Plan
|
||||
Based on the [[https://github.com/Akilan1999/p2p-rendering-computation/tree/master/haskell][Haskell bindings]] to build an extended library (There are still changes needed
|
||||
in the Haskell bindings before the addon can be built).
|
||||
|
||||
*** Handle more cases than machine name
|
||||
The current haskell library seems to only support 1 type Machine name which is parseable from
|
||||
the config file. We would need to handle conditions such as handling types such as [[https://github.com/Akilan1999/p2p-rendering-computation/blob/67165d4bf63d82794a1a264edf843295b727c226/config/config.go#L39][Baremetal]] and [[https://github.com/Akilan1999/p2p-rendering-computation/blob/67165d4bf63d82794a1a264edf843295b727c226/config/config.go#L40][UnsafeMode]].
|
||||
On this proposed library they would both be set to true.
|
||||
#+BEGIN_SRC haskell
|
||||
instance FromJSON P2prcConfig where
|
||||
parseJSON (Object o) = do
|
||||
|
||||
machineName <- o .: "MachineName"
|
||||
|
||||
pure
|
||||
$ MkP2prConfig
|
||||
{ machineName=machineName
|
||||
}
|
||||
|
||||
parseJSON _ = mzero
|
||||
#+END_SRC
|
||||
|
||||
*** Representation of a process
|
||||
To design a data structure that can represent current set of properties:
|
||||
1. IP address (string)
|
||||
2. Port no (int)
|
||||
3. Task name (string)
|
||||
4. Task id (int)
|
||||
5. Encoded deployment script (multi-line string)
|
||||
6. Command to run deployment script (multi line string)
|
||||
7. Command to kill deployment script (multi line string)
|
||||
8. Status (boolean)
|
||||
9. Domain name (string)
|
||||
|
||||
*** Representation of a node:
|
||||
Follows the implemented Haskell data structure from the bindings:
|
||||
#+BEGIN_SRC haskell
|
||||
instance FromJSON ServerInfo where
|
||||
parseJSON = withObject "ServerInfo" $
|
||||
\ o -> do
|
||||
|
||||
name <- o .: "Name"
|
||||
ip4str <- o .: "IPV4"
|
||||
ip6str <- o .: "IPV6"
|
||||
latency <- o .: "Latency"
|
||||
download <- o .: "Download"
|
||||
upload <- o .: "Upload"
|
||||
serverPort <- o .: "ServerPort"
|
||||
bmSshPort <- o .: "BareMetalSSHPort"
|
||||
nat <- o .: "NAT"
|
||||
mEscImpl <- o .: "EscapeImplementation"
|
||||
custInfo <- o .: "CustomInformation"
|
||||
#+END_SRC
|
||||
|
||||
*** Function expected to be built:
|
||||
The following refers to the functions we would be building for our abstraction:
|
||||
1. SpinProcess(<P2PRC process type>,<Node Type>)
|
||||
2. KillProcess(<P2PRC process type>)
|
||||
3. ProcessInformation(<process id> or <domain name>) returns <P2PRC process type>
|
||||
4. ListProcess() return <P2PRC process type>
|
||||
|
||||
** Terms
|
||||
P2PRC process: A p2prc process refers to potencially an instance (i.e web-server or any task). This process
|
||||
stores information such as:
|
||||
- Memory usage.
|
||||
- Instructions to re-produce that task etc...
|
||||
|
||||
Root node: Refers to a node running P2PRC with a public IPV4 address to relay traffic through for nodes
|
||||
behind NAT and can potencially even act a proxy for nodes(Used for domain name mapping) in the P2P network.
|
||||
BIN
docs/p2prc-home-server.pdf
Normal file
BIN
docs/p2prc-home-server.pdf
Normal file
Binary file not shown.
177
docs/p2prc-home-server.tex
Normal file
177
docs/p2prc-home-server.tex
Normal file
@@ -0,0 +1,177 @@
|
||||
% Created 2024-12-10 Tue 23:38
|
||||
% Intended LaTeX compiler: pdflatex
|
||||
\documentclass[11pt]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{longtable}
|
||||
\usepackage{wrapfig}
|
||||
\usepackage{rotating}
|
||||
\usepackage[normalem]{ulem}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{capt-of}
|
||||
\usepackage{hyperref}
|
||||
\author{Akilan}
|
||||
\date{\today}
|
||||
\title{}
|
||||
\hypersetup{
|
||||
pdfauthor={Akilan},
|
||||
pdftitle={},
|
||||
pdfkeywords={},
|
||||
pdfsubject={},
|
||||
pdfcreator={Emacs 29.1 (Org mode 9.6.6)},
|
||||
pdflang={English}}
|
||||
\begin{document}
|
||||
|
||||
\tableofcontents
|
||||
|
||||
\section{P2PRC tracking home server}
|
||||
\label{sec:org64aa45e}
|
||||
\subsection{Abstract}
|
||||
\label{sec:org3d87056}
|
||||
This is a libary on top of P2PRC to create easier abstractions
|
||||
to setup servers on spare laptops at home and run applications
|
||||
which can exibit a monolithic behavoir (Ex: Self hosted
|
||||
jitsi, Indvidious). The motivation is to ensure users can
|
||||
share self hosted infrastructure with friends and can design
|
||||
a really simple replicatable instances of servers.
|
||||
|
||||
\subsection{Problems being addressed}
|
||||
\label{sec:org553bb54}
|
||||
\begin{enumerate}
|
||||
\item Remembering ports mapped and stateful restart. Rather than the OS remember
|
||||
information of the processes. The P2P network should also track it and
|
||||
propogate it to other nodes in the network. This is to ensure when a process
|
||||
fails there is a formally representable reason which can appropirate corrective
|
||||
actions.
|
||||
\item Arbitary instructions used to start a process and should be remembered to reproduce a
|
||||
process if a node is down.
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\subsection{What are attempting to do}
|
||||
\label{sec:org7867a81}
|
||||
The section below describes in detail the ideal startegy of addressing the problems stated
|
||||
above.
|
||||
|
||||
\subsubsection{Building Abstraction}
|
||||
\label{sec:org4988e19}
|
||||
We are proposting to build a library of the Haskell bindings which do the following:
|
||||
\begin{itemize}
|
||||
\item Creating a P2PRC process and allowing users to modify it's behavoir in functional manner with for instance
|
||||
immutable datatypes.
|
||||
\item Allowing users to run this abstraction in a reproducable manner or constrainting it to run on precise
|
||||
sets of machines.
|
||||
\item Should be able to represent the deployment strategy used (ex: Nix, Ansible etc\ldots{}). This keeps the
|
||||
deployment agnostic and not vendor specific.
|
||||
\item The intended idea of this is to only work with monolithic applications.
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{Building it for only home server users}
|
||||
\label{sec:orge2d540d}
|
||||
\begin{itemize}
|
||||
\item The use case is to ensure it's easier to setup a set of servers and shuffle P2PRC processes around
|
||||
when needed. We intend to do this by ensuring a process is represented as type.
|
||||
\item Targets initially with the assumption that there is only 1 reliable root node to relay traffic to the make the setup
|
||||
easier. Future plans will create a DNS layer which can make root nodes and P2PRC processes reproducable.
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{Linient rules}
|
||||
\label{sec:orge1dc5da}
|
||||
\begin{itemize}
|
||||
\item This library is built for home users, therefore the library will be setup for P2PRC using the \href{https://github.com/Akilan1999/p2p-rendering-computation/pull/115}{unsafe mode} which will ensure that all public
|
||||
keys will be added to the \href{https://www.ssh.com/academy/ssh/authorized-keys-file\#:\~:text=The\%20authorized\_keys\%20file\%20in\%20SSH,keys\%20and\%20needs\%20proper\%20management}{SSH auth list} of all nodes avaliable in the network. While this is not secure it
|
||||
comes with pre-assumption that all nodes joining the network are home servers and are needed to access each other
|
||||
with limited rules (set by user permission from the OS side).
|
||||
\item We assume that all P2PRC processes run on a bare-metal machine without any virtualisation.
|
||||
This is because most users run on machines which they own and we offload to the users
|
||||
reponsibility to choose a tool that can support reproducable builds like \href{https://nixos.org/}{Nix}.
|
||||
\end{itemize}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=.9\linewidth]{./P2PRC-Tracking-home-server.png}
|
||||
\end{center}
|
||||
|
||||
\subsection{Plan}
|
||||
\label{sec:org7e9ebcb}
|
||||
Based on the \href{https://github.com/Akilan1999/p2p-rendering-computation/tree/master/haskell}{Haskell bindings} to build an extended library (There are still changes needed
|
||||
in the Haskell bindings before the addon can be built).
|
||||
|
||||
\subsubsection{Handle more cases than machine name}
|
||||
\label{sec:org0007684}
|
||||
The current haskell library seems to only support 1 type Machine name which is parseable from
|
||||
the config file. We would need to handle conditions such as handling types such as \href{https://github.com/Akilan1999/p2p-rendering-computation/blob/67165d4bf63d82794a1a264edf843295b727c226/config/config.go\#L39}{Baremetal} and \href{https://github.com/Akilan1999/p2p-rendering-computation/blob/67165d4bf63d82794a1a264edf843295b727c226/config/config.go\#L40}{UnsafeMode}.
|
||||
On this proposed library they would both be set to true.
|
||||
\begin{verbatim}
|
||||
instance FromJSON P2prcConfig where
|
||||
parseJSON (Object o) = do
|
||||
|
||||
machineName <- o .: "MachineName"
|
||||
|
||||
pure
|
||||
$ MkP2prConfig
|
||||
{ machineName=machineName
|
||||
}
|
||||
|
||||
parseJSON _ = mzero
|
||||
\end{verbatim}
|
||||
|
||||
\subsubsection{Representation of a process}
|
||||
\label{sec:org07241c8}
|
||||
To design a data structure that can represent current set of properties:
|
||||
\begin{enumerate}
|
||||
\item IP address (string)
|
||||
\item Port no (int)
|
||||
\item Task name (string)
|
||||
\item Task id (int)
|
||||
\item Encoded deployment script (multi-line string)
|
||||
\item Command to run deployment script (multi line string)
|
||||
\item Command to kill deployment script (multi line string)
|
||||
\item Status (boolean)
|
||||
\item Domain name (string)
|
||||
\end{enumerate}
|
||||
|
||||
\subsubsection{Representation of a node:}
|
||||
\label{sec:org7837ede}
|
||||
Follows the implemented Haskell data structure from the bindings:
|
||||
\begin{verbatim}
|
||||
instance FromJSON ServerInfo where
|
||||
parseJSON = withObject "ServerInfo" $
|
||||
\ o -> do
|
||||
|
||||
name <- o .: "Name"
|
||||
ip4str <- o .: "IPV4"
|
||||
ip6str <- o .: "IPV6"
|
||||
latency <- o .: "Latency"
|
||||
download <- o .: "Download"
|
||||
upload <- o .: "Upload"
|
||||
serverPort <- o .: "ServerPort"
|
||||
bmSshPort <- o .: "BareMetalSSHPort"
|
||||
nat <- o .: "NAT"
|
||||
mEscImpl <- o .: "EscapeImplementation"
|
||||
custInfo <- o .: "CustomInformation"
|
||||
\end{verbatim}
|
||||
|
||||
\subsubsection{Function expected to be built:}
|
||||
\label{sec:org27760db}
|
||||
The following refers to the functions we would be building for our abstraction:
|
||||
\begin{enumerate}
|
||||
\item SpinProcess(<P2PRC process type>,<Node Type>)
|
||||
\item KillProcess(<P2PRC process type>)
|
||||
\item ProcessInformation(<process id> or <domain name>) returns <P2PRC process type>
|
||||
\item ListProcess() return <P2PRC process type>
|
||||
\end{enumerate}
|
||||
|
||||
\subsection{Terms}
|
||||
\label{sec:org2f4d383}
|
||||
P2PRC process: A p2prc process refers to potencially an instance (i.e web-server or any task). This process
|
||||
stores information such as:
|
||||
\begin{itemize}
|
||||
\item Memory usage.
|
||||
\item Instructions to re-produce that task etc\ldots{}
|
||||
\end{itemize}
|
||||
|
||||
Root node: Refers to a node running P2PRC with a public IPV4 address to relay traffic through for nodes
|
||||
behind NAT and can potencially even act a proxy for nodes(Used for domain name mapping) in the P2P network.
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user