Skip to main content

OpenMined PyGrid CLI for Infrastructure and cloud deployment

Project description

Deployment & CLI

OpenMined 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 of Terraform and TerraScript integrated within the CLI.

Installing Terraform

Check Instructions here:

Installing the CLI

Using pip (recommended)

pip install pygrid-cli

Manual install

To get started, install the CLI first through thess commands:

Clone PyGrid Repo:

git clone https://github.com/OpenMined/PyGrid.git

Then install the python package through pip

pip install -e .

CLI Instructions

Using the PyGrid CLI is very simple through this command pygrid deploy then following the instruction to successfully deploying a specific pygrid app, described in the commands below

List of CLI Commands

Deploy a Domain to AWS

pygrid deploy --provider aws --app domain

Deploy a Network to Azure

pygrid deploy --provider azure --app network

CLI Instructions Example

$ pygrid deploy                                                                                                                                           [7h 19m]
Welcome to OpenMined PyGrid CLI
Cloud Provider:  (AWS, GCP, AZURE) [AWS]: AWS
PyGrid App:  (Domain, Network) [Domain]: Domain
Please enter path to your  aws credentials json file [/Users/amrmkayid/.aws/credentials.json]:
Will you need to support Websockets? [y/N]: N
How many servers do you wish to deploy? (All are managed under the load balancer) [1]: 1
#1: PyGrid Domain ID: domain-demo
#1: Port number of the socket.io server [5000]:
? Please select your desired AWS region  eu-west-2
? Please select at least two availability zones. (Not sure? Select the first two)  done (3 selections)
? Please select an AWS instance category.  General Purpose Instances
? Please select your desired AWS instance.  Instance: t2.xlarge           Memory: 16.0 GB               CPUs: 4
? Please set a username for your Database  amrmkayid
? Enter a password for your Database (length > 8)  **********
? Enter the password again  **********
Your current configration are:

{
  "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 deployment

Resource Managers (PM2)

Cloud Providers

PyGrid CLI provide the full suport for the following cloud providers

  • Amazon Web Services (AWS): Both serverfull and serverless deployment

  • Google Cloud Platform (GCP): serverfull deployment

  • Microsoft Cloud Computing Services Azure: serverfull deployment

Getting Cloud Credentials

AWS credentials

You need to obtain

{
    "aws_access_key_id": "XXXXXXXXXXXXXXXXXXXX",
    "aws_secret_access_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

and store the credentials into this folder ~/.aws/credentials.json in your home directory

GCP credentials

You will need to use a GCP service account to provide authentication and obtain required credentials

Instructions for adding credentials here: https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#adding-credentials

Or through using GCloud CLI and loggining to your GCP provider through this command:

gcloud auth application-default login

AZURE credentials

You need to these keys

application_id = "APPLICATION_ID"
subscription_id = "SUBSCRIPTION_ID"
tenant_id = "TENANT_ID"
key = "KEY"

and provide them to PyGrid CLI as AZURE credentials

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygrid-cli-0.5.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

pygrid_cli-0.5.0-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file pygrid-cli-0.5.0.tar.gz.

File metadata

  • Download URL: pygrid-cli-0.5.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10

File hashes

Hashes for pygrid-cli-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9604f0e5b3a28cba1733717008ff0c428d2c1d18c28d31f6cdf8c96206692f1e
MD5 1797f7c79df7112a7cdb16bc83c617cd
BLAKE2b-256 d65de807d5bf5076b9910f8e3f6b2a47decedb318e6fd04ca6f10e9feb92ac73

See more details on using hashes here.

File details

Details for the file pygrid_cli-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pygrid_cli-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.10

File hashes

Hashes for pygrid_cli-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00ff1de5606daf6620ccfb8d7e074b2d42ff20616ff64d4fa782448bef06d2e0
MD5 6b7c11acf548794baf4c3c7458071447
BLAKE2b-256 6c83c86d319e5ffec557120c015742829a20297e4e7c7065cfe1cb4cec9b370a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page