This repository has been archived by the owner on Mar 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from larsid/dev
Dev
- Loading branch information
Showing
45 changed files
with
1,778 additions
and
10 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/docker-image.yml → .github/workflows/docker-image-indy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: publish docker images | ||
name: publish docker images indy | ||
on: | ||
push: | ||
tags: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: publish docker images iota | ||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build and push Node | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./fogledger/images/iota | ||
file: ./fogledger/images/iota/iota.dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USER }}/fogbed-iota-node:${{ github.ref_name }} | ||
|
||
- name: Build and push IotaApi | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./fogledger/images/iota | ||
file: ./fogledger/images/iota/iota-explorer-api.dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USER }}/fogbed-iota-api:${{ github.ref_name }} | ||
|
||
- name: Build and push IotaWebApp | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./fogledger/images/iota | ||
file: ./fogledger/images/iota/iota-explorer-web-app.dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USER }}/fogbed-iota-web-app:${{ github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
__pycache__/ | ||
.pytest_cache/ | ||
tests/ | ||
|
||
fogLedger.egg-info/ | ||
dist/ | ||
build/ | ||
main.py | ||
stats.txt | ||
pox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
from fogledger.iota.IotaBasic import (IotaBasic) | ||
from fogledger.iota.config.NodeConfig import (NodeConfig) | ||
from fogledger.iota.config.CoordConfig import (CoordConfig) | ||
from fogledger.iota.config.SpammerConfig import (SpammerConfig) | ||
from fogledger.iota.config.ApiConfig import (ApiConfig) | ||
from fogledger.iota.config.WebAppConfig import (WebAppConfig) | ||
from typing import List | ||
from fogbed import ( | ||
VirtualInstance, setLogLevel, FogbedDistributedExperiment, Worker, Container, Controller | ||
) | ||
import signal | ||
|
||
|
||
setLogLevel('info') | ||
|
||
if (__name__ == '__main__'): | ||
|
||
exp = FogbedDistributedExperiment(controller_ip='localhost', controller_port=6633) | ||
|
||
iota_worker = exp.add_worker(ip = 'localhost', controller=Controller('localhost', 6633)) | ||
|
||
node0 = NodeConfig(name='node0', port_bindings={'8081':'8081', '14265':'14265','1883':'1883'}) | ||
node1 = NodeConfig(name='node1', port_bindings={'8081':'8082', '14265':'14201'}) | ||
node2 = NodeConfig(name='node2', port_bindings={'8081':'8083', '14265':'14202'}) | ||
node3 = NodeConfig(name='node3', port_bindings={'8081':'8084', '14265':'14203'}) | ||
node4 = NodeConfig(name='node4', port_bindings={'8081':'8085', '14265':'14204'}) | ||
node5 = NodeConfig(name='node5', port_bindings={'8081':'8086', '14265':'14205'}) | ||
node6 = NodeConfig(name='node6', port_bindings={'8081':'8087', '14265':'14206'}) | ||
node7 = NodeConfig(name='node7', port_bindings={'8081':'8088', '14265':'14207'}) | ||
node8 = NodeConfig(name='node8', port_bindings={'8081':'8089', '14265':'14208'}) | ||
|
||
cord = CoordConfig(name='cord', port_bindings={'8081':'8085'}, interval='60s') | ||
spammer = SpammerConfig(name='spammer', port_bindings={'8081':'8086'}, message ='one-click-tangle.') | ||
|
||
api = ApiConfig(name='api', port_bindings={'4000':'4000'}) | ||
web_app = WebAppConfig(name='web_app', port_bindings={'80':'82'}) | ||
|
||
#iota = IotaBasic(exp=exp, prefix='iota1', conf_nodes=[node1, node2, node3, node4], conf_coord=cord, conf_spammer=spammer) | ||
iota = IotaBasic(exp=exp, prefix='iota1', conf_nodes=[node0 ,node1, node2, node3, node4, node5, node6, node7, node8]) | ||
#iota = IotaBasic(exp=exp, prefix='iota1', nodes_number=4) | ||
|
||
for iota_node in iota.ledgers: | ||
iota_worker.add(iota_node, reachable=True) | ||
|
||
zmq = Container( | ||
name='zmq', | ||
dimage='larsid/iota-zmq-bridge:1.0.0', | ||
dcmd=f'/entrypoint.sh', | ||
port_bindings={'5556':'5556'}, | ||
environment={ | ||
'MQTT_IP': iota.containers['node0'].ip, | ||
'INDEXES': 'LB_*', | ||
'NUM_WORKERS':20 | ||
} | ||
) | ||
|
||
zmq_bridge = exp.add_virtual_instance('zmq_bridge') | ||
|
||
exp.add_docker(zmq, zmq_bridge) | ||
|
||
iota_worker.add(zmq_bridge, reachable=True) | ||
|
||
try: | ||
exp.start() | ||
iota.start_network() | ||
print("Experiment started") | ||
while True: | ||
key = input("\nPress 'p' to stop the experiment: ") | ||
if key.lower() == 'p': | ||
print("Stopping the experiment...") | ||
exp.stop() | ||
break | ||
else: | ||
print(f"Ignoring key: {key}") | ||
except Exception as ex: | ||
print(ex) | ||
finally: | ||
exp.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from fogledger.iota.IotaBasic import (IotaBasic) | ||
from fogledger.iota.config.NodeConfig import (NodeConfig) | ||
from fogledger.iota.config.CoordConfig import (CoordConfig) | ||
from fogledger.iota.config.SpammerConfig import (SpammerConfig) | ||
from fogledger.iota.config.ApiConfig import (ApiConfig) | ||
from fogledger.iota.config.WebAppConfig import (WebAppConfig) | ||
from typing import List | ||
from fogbed import ( | ||
VirtualInstance, setLogLevel, FogbedDistributedExperiment, Worker, Controller | ||
) | ||
|
||
setLogLevel('info') | ||
|
||
def add_datacenters_to_worker(worker: Worker, datacenters: List[VirtualInstance]): | ||
for device in datacenters: | ||
worker.add(device, reachable=True) | ||
|
||
if (__name__ == '__main__'): | ||
exp = FogbedDistributedExperiment(controller_ip='35.245.131.33', controller_port=6633) | ||
worker1 = exp.add_worker(ip = '35.231.54.58', controller=Controller('35.245.131.33', 6633)) | ||
worker2 = exp.add_worker(ip = '34.145.164.105', controller=Controller('35.245.131.33', 6633)) | ||
|
||
node1 = NodeConfig(name='node1', port_bindings={'8081':'8081', '14265':'14265'}) | ||
node2 = NodeConfig(name='node2', port_bindings={'8081':'8082'}) | ||
node3 = NodeConfig(name='node3', port_bindings={'8081':'8083'}) | ||
node4 = NodeConfig(name='node4', port_bindings={'8081':'8084'}) | ||
|
||
cord = CoordConfig(name='cord', port_bindings={'8081':'8085'}, interval='60s') | ||
|
||
spammer = SpammerConfig(name='spammer', port_bindings={'8081':'8086'}, message ='one-click-tangle.') | ||
|
||
api = ApiConfig(name='api', port_bindings={'4000':'4000'}) | ||
web_app = WebAppConfig(name='web_app', port_bindings={'80':'82'}) | ||
|
||
iota = IotaBasic(exp=exp, prefix='iota1', conf_nodes=[node1, node2, node3, node4], conf_coord=cord, conf_spammer=spammer) | ||
|
||
add_datacenters_to_worker(worker1, iota.ledgers[:len(iota.ledgers)//2]) | ||
add_datacenters_to_worker(worker2, iota.ledgers[len(iota.ledgers)//2:]) | ||
exp.add_tunnel(worker1, worker2) | ||
|
||
try: | ||
exp.start() | ||
iota.start_network() | ||
print("Experiment started") | ||
input('Press any key...') | ||
|
||
except Exception as ex: | ||
print(ex) | ||
finally: | ||
exp.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from fogledger.iota.IotaBasic import (IotaBasic) | ||
from fogledger.iota.config.NodeConfig import (NodeConfig) | ||
from fogledger.iota.config.CoordConfig import (CoordConfig) | ||
from fogledger.iota.config.SpammerConfig import (SpammerConfig) | ||
from fogledger.iota.config.ApiConfig import (ApiConfig) | ||
from fogledger.iota.config.WebAppConfig import (WebAppConfig) | ||
from typing import List | ||
from fogbed import ( | ||
FogbedExperiment, | ||
CloudResourceModel, EdgeResourceModel, FogResourceModel, VirtualInstance, | ||
setLogLevel, | ||
) | ||
|
||
setLogLevel('info') | ||
|
||
def create_links(cloud: VirtualInstance, devices: List[VirtualInstance]): | ||
for device in devices: | ||
exp.add_link(device, cloud) | ||
|
||
if (__name__ == '__main__'): | ||
exp = FogbedExperiment() | ||
|
||
node1 = NodeConfig(name='node1', port_bindings={'8081':'8081', '14265':'14265'}) | ||
node2 = NodeConfig(name='node2', port_bindings={'8081':'8082'}) | ||
#node3 = NodeConfig(name='node3', port_bindings={'8081':'8083'}) | ||
#node4 = NodeConfig(name='node4', port_bindings={'8081':'8084'}) | ||
|
||
cord = CoordConfig(name='cord', port_bindings={'8081':'8085'}, interval='60s') | ||
|
||
spammer = SpammerConfig(name='spammer', port_bindings={'8081':'8086'}, message ='one-click-tangle.') | ||
|
||
api = ApiConfig(name='api', port_bindings={'4000':'4000'}) | ||
web_app = WebAppConfig(name='web_app', port_bindings={'80':'82'}) | ||
|
||
fog = exp.add_virtual_instance('fog') | ||
iota = IotaBasic(exp=exp, prefix='iota1', virtual_instance=fog, nodes_number=4) | ||
|
||
try: | ||
exp.start() | ||
iota.start_network() | ||
print("Experiment started") | ||
input('Press any key...') | ||
|
||
except Exception as ex: | ||
print(ex) | ||
finally: | ||
exp.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from fogledger.iota.IotaBasic import (IotaBasic) | ||
from fogledger.iota.config.NodeConfig import (NodeConfig) | ||
from fogledger.iota.config.CoordConfig import (CoordConfig) | ||
from fogledger.iota.config.SpammerConfig import (SpammerConfig) | ||
from fogledger.iota.config.ApiConfig import (ApiConfig) | ||
from fogledger.iota.config.WebAppConfig import (WebAppConfig) | ||
from typing import List | ||
from fogbed import ( | ||
FogbedExperiment, | ||
CloudResourceModel, EdgeResourceModel, FogResourceModel, VirtualInstance, | ||
setLogLevel, | ||
) | ||
|
||
setLogLevel('info') | ||
|
||
def create_links(cloud: VirtualInstance, devices: List[VirtualInstance]): | ||
for device in devices: | ||
exp.add_link(device, cloud) | ||
|
||
if (__name__ == '__main__'): | ||
exp = FogbedExperiment() | ||
|
||
node1 = NodeConfig(name='node1', port_bindings={'8081':'8081', '14265':'14265'}) | ||
node2 = NodeConfig(name='node2', port_bindings={'8081':'8082'}) | ||
#node3 = NodeConfig(name='node3', port_bindings={'8081':'8083'}) | ||
#node4 = NodeConfig(name='node4', port_bindings={'8081':'8084'}) | ||
|
||
cord = CoordConfig(name='cord', port_bindings={'8081':'8085'}, interval='60s') | ||
|
||
spammer = SpammerConfig(name='spammer', port_bindings={'8081':'8086'}, message ='one-click-tangle.') | ||
|
||
api = ApiConfig(name='api', port_bindings={'4000':'4000'}) | ||
web_app = WebAppConfig(name='web_app', port_bindings={'80':'82'}) | ||
|
||
iota = IotaBasic(exp=exp, prefix='iota1', nodes_number=4) | ||
|
||
fog = exp.add_virtual_instance('fog') | ||
create_links(fog, iota.ledgers) | ||
|
||
try: | ||
exp.start() | ||
iota.start_network() | ||
print("Experiment started") | ||
input('Press any key...') | ||
|
||
except Exception as ex: | ||
print(ex) | ||
finally: | ||
exp.stop() |
Oops, something went wrong.