Server Settings (.settings
)#
Estimated reading time: 5’
What you’ll learn#
This guide’s objective is to help you learn how to configure the Datasite server’s profile.
Server Settings#
The server profile (or metadata) are very important in welcoming researchers to your server, so they easily understand who is supporting the server, what organisation and what they can find on it
# Launching a simple server
import syft as sy
server = sy.orchestra.launch(
name="my_special_server",
reset=True,
dev_mode=False,
port="auto",
)
To configure your server as a data owner, you can start by looking into the server’s settings:
client = sy.login(url="localhost", port=server.port, email="[email protected]", password="changethis")
client.settings
The available settings on the domain are as follows:
Self-service registration#
This setting, available via client.settings.allow_guest_signup()
, allows admin to turn on or off the self-service registration. This way, guest users can self-register on your server if they have the address where your server is hosted (e.g. public IP). This is ideal for a low-side server, but proceed with caution for a high-side one.
Notifications#
Via settings, the admin can also configure whether the server should or not dispatch notifications to the users. This can be enabled only if the SMTP services were configured, via client.settings.enable_notifications()
and disabled via client.settings.disable_notifications()
. Read more about it here.
Association#
Your server can be discovered via other peer server or gateway server only if your server is associated with the other. This means that a route exists between the two server and they can communicate as needed. For such, an association request must be created by either of the parties. More documentation coming soon about how to better use PySyft’s networking capabilities.
The available setting association_request_auto_approval
states that you are auto-approving such requests. This is ideal for a low-side server, but proceed with caution for a high-side one.
Server Profile#
Setting up the information others can see about a server is important for external researchers.
Let’s look what information is currently set on our default server:
dict(client.metadata)
Assuming we would like to update these information point to better reflect my server status, we can do it via the ServerSettingsUpdate
, which allows users to modify:
name: str
: the name of their serverorganization: str
: the name of their organizationdescription: str
: the description of your server and its purposeadmin_email: str
: the email of the admin user, that can be used by data scientists to reach outsignup_enabled: bool
: whether to allow for self-service registrationassociation_request_auto_approval: bool
: whether to allow for association requests auto approval
from syft.service.settings.settings import ServerSettingsUpdate
new_settings = ServerSettingsUpdate(
server_side_type="low",
organization="Green Org",
name="my_very_special_server",
description="This is the low side server of the Green Organisation.")
client.settings.update(settings=new_settings)
# Requires re-logining in to fetch the updates
client = sy.login(url="localhost", port=server.port, email="[email protected]", password="changethis")
client
Customise the welcome message#
It would be very useful for data scientists to learn as much about your server as soon as they log in. PySyft allows you to customize the welcome message shown upon login with anything HTML or Markdown.
To make it easy to develop your custom one, PySyft has a few utilities to help you:
client.settings.welcome_preview(markdown/html="..")
to preview how your intended welcome message is rendered in your execution environment (e.g Jupyter Notebook)client.settings.welcome_customize(markdown/html="..")
to set a new version of the welcome messageclient.settings.welcome_show()
to check whether the change was successful
Let’s see how it would be to expand the current message with a description.
# Expanding the default message
previous_welcome = client.settings.welcome_show()
previous_welcome
Let’s compose one by starting with the current style. We will take over the same styling, but modify the image, the url and the information presented. To copy the styles, we can access client.settings.welcome_show().text
:
Show code cell source
new_welcome ="""
<style>
/* cyrillic-ext */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu0SC55K5gw.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
/* cyrillic */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu0SC55K5gw.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
/* greek-ext */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu0SC55K5gw.woff2) format("woff2"); unicode-range: U+1F00-1FFF; }
/* greek */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu0SC55K5gw.woff2) format("woff2"); unicode-range: U+0370-03FF; }
/* hebrew */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu0SC55K5gw.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
/* vietnamese */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu0SC55K5gw.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
/* latin-ext */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu0SC55K5gw.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* latin */ @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-stretch: 100%; src: url(https://fonts.gstatic.com/s/opensans/v35/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-mu0SC55I.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
.syft-container {
padding: 5px;
font-family: 'Open Sans';
}
.syft-alert-info {
color: #1F567A;
background-color: #C2DEF0;
border-radius: 4px;
padding: 5px;
padding: 13px 10px
}
.syft-code-block {
background-color: #f7f7f7;
border: 1px solid #cfcfcf;
padding: 0px 2px;
}
.syft-space {
margin-top: 1em;
}
</style>
<div class="syft-client syft-container">
<img src="https://emojiisland.com/cdn/shop/products/Smiling_Emoji_Icon_-_Blushed_large.png?v=1571606114" alt="Logo"
style="width:48px;height:48px;padding:3px;">
<h2>Welcome to Red Organisation</h2>
<div class="syft-space">
<strong>URL:</strong> https://datasite.red_organisation.org<br />
<strong>Server Type:</strong> Domain <br />
<strong>Server Side Type:</strong>High Side<br />
<strong>Syft Version:</strong> 0.8.7-beta.10<br />
</div>
<div>
<h3>About my_special_server</h3>
<p> This server is open to all researchers interested in conducting studies about climate change and its implications on the biodiveristy using Red Organisation's data.
</div>
</div><br />
"""
client.settings.welcome_preview(html=new_welcome)
client.settings.welcome_customize(html=new_welcome)
client.settings.welcome_show()
Now, your Datasite server should be ready to be further configured and used by data scientists!