Local development server#

When you need this?¶#

For quick tests of Syft functionalities or experimenting with your server setup before deploying, a local development server can be extremely useful. These development servers function like in-memory servers, offering easy launch and tear-down capabilities.

This local development server has its own SQLite storage to keep the server’s metadata and data, and it has the same name as the server’s unique name. If you launch a server with an exsiting storage, that will be loaded together, which means you can use across longer development cycles.

Steps#

To deploy a local development server, you only need syft, which comes together with a special module, called orchestra. Via orchestra, you can experiment with a single server deployment or even simulate container workloads.

Installation#

Python Version

Please make sure you have Python 3.10+ installed and available.

pip install -U syft

Launch a development server#

import syft as sy

server = sy.orchestra.launch(
    name="my_special_server",
    reset=True,
    port=8093,
)
server.deployment_type

The returned object, a sy.ServerHandle, allows fetching specific information about your deployed local server, such as the url or the deployment_type. Here, the deployment type is PYTHON as the server is running in a process in Python. It is good to know that sy.orchestra allows users to experiment with further local containerised deployment as well, but more of this will be covered soon.

Multiple further APIs are available that are also offered on the client, for easy testing, such as register, login_as_guest, etc.

server.url
server.port

Further arguments can be passed to configure the way you would like to use your development server:

  • dev_mode: True/False, whether you would like verbose logging when using the server for debugging

  • server_type: enclave, domain or gateway

  • server_side_type: high or low, stating whether your server is purposed to host private data (high) or only mock data (low). A high side server is more defensive with how the data is being used.

  • local_db: True/False, whether you would like to initialize a local database or not

  • create_producer: True/False, whether your server can instantiate other in-memory server to simulate working with multiple containers

  • n_consumers: number of in-memory workers simulated, able to consume the workload scheduled. This is required for launching and running jobs and requires create_producer to be True.

  • thread_workers: True/False, whether the in-memory workers should be simulated using threads

  • association_request_auto_approval: True/False, states whether you should auto-approve requests of associating with another server (e.g. routing from one to another)

or from the command line: $ syft launch --name=my-server --port=8080 --reset=True

Access Client and Login#

data_owner_client = sy.login(url="localhost:8093", email="[email protected]", password="changethis")
data_owner_client

Landing (shutting down) of the server#

server.land()

More information on how to use this Datasite server in the Datasite guide and within the components section.