Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs/SK-691 | Add tutorial for distributed deployment #530

Merged
merged 9 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
Expand Down
67 changes: 67 additions & 0 deletions docs/distributed.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Distributed Deployment
===================================

This tutorial outlines the steps for deploying the FEDn framework on a local network, using a workstation as
the host and different devices as clients. For general steps on how to run FEDn, see one of the quickstart tutorials.


.. note::
For deployment over a public network, ensure you have:

- A public IP address
- Forwarded the necessary ports
- Implemented necessary security precautions

Then, follow these steps but substitute the local IP address with your public IP.

Prerequisites
-------------
- `One host workstation and atleast one client device`
- `Python 3.8, 3.9 or 3.10 <https://www.python.org/downloads>`__
- `Docker <https://docs.docker.com/get-docker>`__
- `Docker Compose <https://docs.docker.com/compose/install>`__

Launch a distributed FEDn Network
-------------


Note the local IP address of your host device; it will be needed later. Follow the standard procedure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better here to replicate how you start up the server-side? Suggest the user to use docker-compose? Also mention where to find the ports they need to open?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested docker-compose and added where to find the ports in the note.

to initiate a FEDn network. Once the network is active, upload your compute package and seed (for comprehensive details,
see the quickstart tutorials).


Configuring and Attaching Clients
-------------

On your client device, continue with initializing your client. To connect to the host machine we need to ensure we are
routing the correct DNS to our hosts local IP adress. We can do this using the standard FEDn `client.yaml`:

.. code-block::

network_id: fedn-network
discover_host: api-server
discover_port: 8092


We can then run using docker by adding the hosts to the docker run command:

.. code-block::

docker run \
—add-host=api-server:<host local ip> \
—add-host=combiner:<host local ip> \
<image name> run client -in client.yaml --name client1


Alternatively updating the `/etc/hosts` file, appending the following lines for running naitively:

.. code-block::

<host local ip> api-server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be public ip, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mainly for deployment over local networks, so the host's local network IP. I've clarified that and referred to Studio for secure deployment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is a distributed setup you cannot communicate on the hosts local IP from a client. I think the setting that all machines are on the same local network is fairly uncommon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see, you made that clear in the beginning of the tutorial.

<host local ip> combiner


Start a training session
-------------

After connecting with your clients, you are ready to start training sessions from the host machine.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

introduction
quickstart
distributed
apiclient
tutorial
architecture
Expand Down
Loading