Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
minor edits to be rebased back into prev commits
Browse files Browse the repository at this point in the history
Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny committed Oct 16, 2023
1 parent 8111557 commit 12f8241
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 6 additions & 2 deletions docs/federation_activitypub.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ $ hypercorn app:app -b 0.0.0.0:5000
[2023-10-16 02:44:48 -0700] [36467] [INFO] Running on http://0.0.0.0:5000 (CTRL + C to quit)
```

> Cleanup: `rm -f *sqlite* federation_*/config.toml`
### Bring up Bob's SCITT Instance

Populate Bob's federation config
Expand All @@ -118,7 +120,8 @@ Start the server
```console
$ rm -rf workspace_bob/
$ mkdir -p workspace_bob/storage/operations
$ scitt-emulator server --workspace workspace_bob/ --tree-alg CCF --port 6000 \
$ BOVINE_DB_URL="sqlite://${PWD}/bovine.sqlite3" scitt-emulator server \
--workspace workspace_bob/ --tree-alg CCF --port 6000 \
--federation scitt_emulator.federation_activitypub_bovine:SCITTFederationActivityPubBovine \
--federation-config-path federation_bob/config.json
```
Expand Down Expand Up @@ -157,7 +160,8 @@ Start the server
```console
$ rm -rf workspace_alice/
$ mkdir -p workspace_alice/storage/operations
$ scitt-emulator server --workspace workspace_alice/ --tree-alg CCF --port 7000 \
$ BOVINE_DB_URL="sqlite://${PWD}/bovine.sqlite3" scitt-emulator server \
--workspace workspace_alice/ --tree-alg CCF --port 7000 \
--federation scitt_emulator.federation_activitypub_bovine:SCITTFederationActivityPubBovine \
--federation-config-path federation_alice/config.json
```
Expand Down
11 changes: 4 additions & 7 deletions scitt_emulator/federation_activitypub_bovine.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,14 @@ def __init__(
)

def initialize_service(self):
# read, self.write = multiprocessing.Pipe(duplex=False)
# reader_process = multiprocessing.Process(target=self.reader, args=(read,))

# TODO Avoid creating user if already exists
cmd = [
sys.executable,
"-um",
"mechanical_bull.add_user",
"--accept",
self.handle_name,
domain,
self.domain,
]
add_user_output = subprocess.check_output(
cmd,
Expand All @@ -104,7 +101,7 @@ def initialize_service(self):
"bovine_tool.register",
self.handle_name,
"--domain",
domain,
self.domain,
]
register_output = subprocess.check_output(
cmd,
Expand All @@ -116,7 +113,7 @@ def initialize_service(self):
sys.executable,
"-um",
"bovine_tool.manage",
self.handle_name,
bovine_name,
"--did_key",
"key0",
did_key,
Expand Down Expand Up @@ -148,7 +145,7 @@ def initialize_service(self):

def created_entry(self, entry_id: str, receipt: bytes):
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client:
client.connect(self.federate_created_entries_socket_path)
client.connect(str(self.federate_created_entries_socket_path.resolve()))
client.send(receipt)
client.close()

Expand Down
5 changes: 3 additions & 2 deletions scitt_emulator/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ def create_flask_app(config):

federation = None
if app.config.get("federation", None):
federation = app.config["federation"](
app.federation = app.config["federation"](
config_path=app.config.get("federation_config_path", None),
storage_path=storage_path,
service_parameters_path=app.service_parameters_path
)
app.federation.initialize_service()

app.scitt_service = clazz(
storage_path=storage_path,
service_parameters_path=app.service_parameters_path,
federation=federation,
federation=app.federation,
)
app.scitt_service.initialize_service()
print(f"Service parameters: {app.service_parameters_path}")
Expand Down

0 comments on commit 12f8241

Please sign in to comment.