Skip to content

Commit

Permalink
AWS server and client OK
Browse files Browse the repository at this point in the history
Azure template updated
  • Loading branch information
IsaacYangSLA committed Jan 11, 2024
1 parent db20c13 commit 1e8a397
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 247 deletions.
42 changes: 30 additions & 12 deletions nvflare/dashboard/application/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
template = utils.load_yaml(os.path.join(lighter_folder, "impl", "master_template.yml"))


def get_csp_template(csp, participant, template):
return template[f"{csp}_start_{participant}_sh"]


def get_csp_start_script_name(csp):
return f"{csp}_start.sh"

Expand Down Expand Up @@ -157,20 +153,37 @@ def gen_server(key, first_server=True):
_write(os.path.join(dest_dir, "server.key"), cert_pair.ser_pri_key, "b", exe=False)
_write(os.path.join(dest_dir, "rootCA.pem"), project.root_cert, "b", exe=False)
if not project.ha_mode:
azure_start_svr_header_sh = tplt.get_azure_start_svr_header_sh()
azure_start_common_sh = tplt.get_azure_start_common_sh()
script = tplt.get_cloud_script_header() + azure_start_svr_header_sh + azure_start_common_sh
_write(
os.path.join(dest_dir, get_csp_start_script_name("azure")),
utils.sh_replace(
tplt.get_cloud_script_header() + get_csp_template("azure", "svr", template),
{"server_name": entity.name, "ORG": ""},
script,
{
"type": "server",
"docker_network": "--network host",
"uid_cln": "",
"server_name": entity.name,
"ORG": "",
},
),
"t",
exe=True,
)
aws_start_svr_cln_sh = tplt.get_aws_start_sh()
script = tplt.get_cloud_script_header() + aws_start_svr_cln_sh
_write(
os.path.join(dest_dir, get_csp_start_script_name("aws")),
utils.sh_replace(
tplt.get_cloud_script_header() + get_csp_template("aws", "svr", template),
{"server_name": entity.name, "ORG": ""},
script,
{
"type": "server",
"inbound_rule": "aws ec2 authorize-security-group-ingress --group-id $sg_id --protocol tcp --port 8002-8003 --cidr 0.0.0.0/0 >> /tmp/sec_grp.log",
"cln_uid": "",
"server_name": entity.name,
"ORG": "",
},
),
"t",
exe=True,
Expand Down Expand Up @@ -282,20 +295,25 @@ def gen_client(key, id):
_write(os.path.join(dest_dir, "client.crt"), cert_pair.ser_cert, "b", exe=False)
_write(os.path.join(dest_dir, "client.key"), cert_pair.ser_pri_key, "b", exe=False)
_write(os.path.join(dest_dir, "rootCA.pem"), project.root_cert, "b", exe=False)
azure_start_cln_header_sh = tplt.get_azure_start_cln_header_sh()
azure_start_common_sh = tplt.get_azure_start_common_sh()
script = tplt.get_cloud_script_header() + azure_start_cln_header_sh + azure_start_common_sh
_write(
os.path.join(dest_dir, get_csp_start_script_name("azure")),
utils.sh_replace(
tplt.get_cloud_script_header() + get_csp_template("azure", "cln", template),
{"SITE": entity.name, "ORG": entity.org},
script,
{"type": "client", "docker_network": "", "uid_cln": f"uid={entity.name}", "ORG": entity.org},
),
"t",
exe=True,
)
aws_start_svr_cln_sh = tplt.get_aws_start_sh()
script = tplt.get_cloud_script_header() + aws_start_svr_cln_sh
_write(
os.path.join(dest_dir, get_csp_start_script_name("aws")),
utils.sh_replace(
tplt.get_cloud_script_header() + get_csp_template("aws", "cln", template),
{"SITE": entity.name, "ORG": entity.org},
script,
{"type": "client", "inbound_rule": "", "cln_uid": f"uid={entity.name}", "ORG": entity.org},
),
"t",
exe=True,
Expand Down
Loading

0 comments on commit 1e8a397

Please sign in to comment.