Package: pygrid-cli
Deployment & CLIOpenMined PyGrid CLI provide the necessary support for Infrastructure and Deployment management of various PyGrid apps including (Domains, Networks, and Workers) to the main cloud providers (AWS,GCP,Azure) through the usage ofTerraformandTerraScriptintegrated within the CLI.Installing TerraformCheck Instructions here:https://www.terraform.io/downloads.htmlhttps://learn.hashicorp.com/tutorials/terraform/install-cliInstalling the CLIUsing pip (recommended)pipinstallpygrid-cliManual installTo get started, install the CLI first through thess commands:Clone PyGrid Repo:gitclonehttps://github.com/OpenMined/PyGrid.gitThen install the python package through pippipinstall-e.CLI InstructionsUsing the PyGrid CLI is very simple through this commandpygrid deploythen following the instruction to successfully deploying a specific pygrid app, described in the commands belowList of CLI CommandsDeploy a Domain to AWSpygriddeploy--provideraws--appdomainDeploy a Network to Azurepygriddeploy--providerazure--appnetworkCLI Instructions Example$pygriddeploy[7h19m]WelcometoOpenMinedPyGridCLI
CloudProvider:(AWS,GCP,AZURE)[AWS]:AWS
PyGridApp:(Domain,Network)[Domain]:Domain
Pleaseenterpathtoyourawscredentialsjsonfile[/Users/amrmkayid/.aws/credentials.json]:
WillyouneedtosupportWebsockets?[y/N]:N
Howmanyserversdoyouwishtodeploy?(Allaremanagedundertheloadbalancer)[1]:1#1: PyGrid Domain ID: domain-demo#1: Port number of the socket.io server [5000]:?PleaseselectyourdesiredAWSregioneu-west-2
?Pleaseselectatleasttwoavailabilityzones.(Notsure?Selectthefirsttwo)done(3selections)?PleaseselectanAWSinstancecategory.GeneralPurposeInstances
?PleaseselectyourdesiredAWSinstance.Instance:t2.xlargeMemory:16.0GBCPUs:4?PleasesetausernameforyourDatabaseamrmkayid
?EnterapasswordforyourDatabase(length>8)**********
?Enterthepasswordagain**********
Yourcurrentconfigrationare:{"pygrid_root_path":"/Users/amrmkayid/.pygrid/cli","output_file":"/Users/amrmkayid/.pygrid/cli/config_2021-03-30_011924.json","provider":"aws","app":{"name":"domain","count":1},"root_dir":"/Users/amrmkayid/.pygrid/apps/aws/domain","serverless":false,"websockets":false,"apps":[{"id":"domain-demo","port":5000}],"vpc":{"region":"eu-west-2","av_zones":["eu-west-2a","eu-west-2b","eu-west-2c"],"instance_type":{"InstanceType":"t2.xlarge"}}}Continue?[y/N]:Serverfull and Serverless deploymentResource Managers (PM2)Cloud ProvidersPyGrid CLI provide the full suport for the following cloud providersAmazon Web Services (AWS): Both serverfull and serverless deploymentGoogle Cloud Platform (GCP): serverfull deploymentMicrosoft Cloud Computing ServicesAzure: serverfull deploymentGetting Cloud CredentialsAWS credentialsYou need to obtain{"aws_access_key_id":"XXXXXXXXXXXXXXXXXXXX","aws_secret_access_key":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}and store the credentials into this folder~/.aws/credentials.jsonin your home directoryInstructions for finding your keys are here:https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keysGCP credentialsYou will need to use aGCP service accountto provide authentication and obtain required credentialsInstructions for adding credentials here:https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#adding-credentialsOr through usingGCloud CLIand loggining to your GCP provider through this command:gcloudauthapplication-defaultloginAZURE credentialsYou need to these keysapplication_id="APPLICATION_ID"subscription_id="SUBSCRIPTION_ID"tenant_id="TENANT_ID"key="KEY"and provide them to PyGrid CLI as AZURE credentialsInstructions for finding values for subscription_id:https://blogs.msdn.microsoft.com/mschray/2015/05/13/getting-your-azure-guid-subscription-id/Instructions for finding values for tenant_id, application_id, key:https://docs.microsoft.com/en-ca/azure/active-directory/develop/howto-create-service-principal-portal