From 255eb2d87b10df071f81922814d1d986b1c08024 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Tue, 8 Dec 2020 23:53:30 +0200 Subject: [PATCH 1/2] Add GCP documentation --- .gitbook.yaml | 6 ++-- docs/cloud/install.md | 11 +++++++ docs/cloud/uninstall.md | 11 +++++++ docs/cloud/update.md | 11 +++++++ docs/gcp/credentials.md | 12 ++++++++ docs/gcp/install.md | 63 +++++++++++++++++++++++++++++++++++++++++ docs/gcp/uninstall.md | 18 ++++++++++++ docs/summary.md | 9 +++++- 8 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 docs/cloud/install.md create mode 100644 docs/cloud/uninstall.md create mode 100644 docs/cloud/update.md create mode 100644 docs/gcp/credentials.md create mode 100644 docs/gcp/install.md create mode 100644 docs/gcp/uninstall.md diff --git a/.gitbook.yaml b/.gitbook.yaml index 8e0ed9a10b..7a67fbf248 100644 --- a/.gitbook.yaml +++ b/.gitbook.yaml @@ -8,6 +8,6 @@ redirects: tutorial: ../examples/pytorch/text-generator/README.md tutorial/realtime: ../examples/pytorch/text-generator/README.md tutorial/batch: ../examples/batch/image-classifier/README.md - install: ./aws/install.md - uninstall: ./aws/uninstall.md - update: ./aws/update.md + install: ./cloud/install.md + uninstall: ./cloud/uninstall.md + update: ./cloud/update.md diff --git a/docs/cloud/install.md b/docs/cloud/install.md new file mode 100644 index 0000000000..cf59aac469 --- /dev/null +++ b/docs/cloud/install.md @@ -0,0 +1,11 @@ +# Install + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +## AWS + +To spin up Cortex using AWS as the cloud provider, follow [these instructions](../aws/install.md). + +## GCP + +To spin up Cortex using AWS as the cloud provider, follow [these instructions](../gcp/install.md). diff --git a/docs/cloud/uninstall.md b/docs/cloud/uninstall.md new file mode 100644 index 0000000000..31e95087a1 --- /dev/null +++ b/docs/cloud/uninstall.md @@ -0,0 +1,11 @@ +# Uninstall + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +## AWS + +To spin down a Cortex cluster on an AWS account, follow [these instructions](../aws/uninstall.md). + +## GCP + +To spin down a Cortex cluster on a GCP account, follow [these instructions](../gcp/uninstall.md). diff --git a/docs/cloud/update.md b/docs/cloud/update.md new file mode 100644 index 0000000000..7e92f3291c --- /dev/null +++ b/docs/cloud/update.md @@ -0,0 +1,11 @@ +# Update + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +## AWS + +To update the configuration of a running Cortex cluster on an AWS account, follow [these instructions](../aws/update.md). + +## GCP + +There is no way of updating a running Cortex cluster that has been spun up using a GCP account. diff --git a/docs/gcp/credentials.md b/docs/gcp/credentials.md new file mode 100644 index 0000000000..60ed396b02 --- /dev/null +++ b/docs/gcp/credentials.md @@ -0,0 +1,12 @@ +# Credentials + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +1. Create a service account for your GCP project as described [here](https://cloud.google.com/iam/docs/creating-managing-service-accounts#iam-service-accounts-create-console) with the following roles (the roles could be more restrictive if required): + 1. `Editor` role. + 1. `Kubernetes Engine Admin` role. + 1. `Container Registry Service Agent` role. + 1. `Storage Admin` role. + 1. `Storage Object Admin` role. +1. Generate a service account key for your service account as described [here](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and export it as a JSON file. +1. Export the `GOOGLE_APPLICATION_CREDENTIALS` variable and point it to the downloaded service account key from the previous step. diff --git a/docs/gcp/install.md b/docs/gcp/install.md new file mode 100644 index 0000000000..666188f94a --- /dev/null +++ b/docs/gcp/install.md @@ -0,0 +1,63 @@ +# Install + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +## Spin up Cortex on your GCP account + +Make sure [Docker](https://docs.docker.com/install) is running on your machine. + +If you're using GPUs, make sure your GPU quota is within the desirable values. More on GPU quotas [here](https://cloud.google.com/compute/quotas). + +```bash +# install the CLI +pip install cortex + +# spin up Cortex on your GCP account +cortex cluster up # or: cortex cluster up --config cluster.yaml (see configuration options below) + +# set the default environment +cortex env default gcp +``` + + +Try the [tutorial](../../examples/pytorch/text-generator/README.md) or deploy one of our [examples](https://github.com/cortexlabs/cortex/tree/master/examples). + +## Configure Cortex + + +```yaml +# cluster.yaml + +# GKE cluster name +cluster_name: cortex + +# GCP one +zone: us-east1-d + +# instance type +instance_type: n1-standard-2 + +# GPU to attach to your instance +accelerator_type: nvidia-tesla-t4 + +# minimum number of instances +min_instances: 1 + +# maximum number of instances +max_instances: 5 +``` + +The docker images used by the Cortex cluster can also be overridden, although this is not common. They can be configured by adding any of these keys to your cluster configuration file (default values are shown): + + +```yaml +image_operator: quay.io/cortexlabs/operator:master +image_manager: quay.io/cortexlabs/manager:master +image_downloader: quay.io/cortexlabs/downloader:master +image_statsd: quay.io/cortexlabs/statsd:master +image_istio_proxy: quay.io/cortexlabs/istio-proxy:master +image_istio_pilot: quay.io/cortexlabs/istio-pilot:master +image_pause: quay.io/cortexlabs/pause:master +``` + +The default docker images used for your Predictors are listed in the instructions for [system packages](../deployments/system-packages.md), and can be overridden in your [Realtime API configuration](../deployments/realtime-api/api-configuration.md). diff --git a/docs/gcp/uninstall.md b/docs/gcp/uninstall.md new file mode 100644 index 0000000000..dcab647f38 --- /dev/null +++ b/docs/gcp/uninstall.md @@ -0,0 +1,18 @@ +# Uninstall + +_WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ + +## Spin down Cortex + +```bash +# spin down Cortex +cortex cluster down + +# uninstall the CLI +pip uninstall cortex +rm -rf ~/.cortex +``` + +If you modified your bash profile, you may wish to remove `source <(cortex completion bash)` from it (or remove `source <(cortex completion zsh)` for `zsh`). + +*Note: The `cortex cluster down` command doesn't wait for the cluster to come down. You should ensure that the cluster has been removed by checking your GCP console.* diff --git a/docs/summary.md b/docs/summary.md index e92d69a771..5c2967a71c 100644 --- a/docs/summary.md +++ b/docs/summary.md @@ -1,7 +1,7 @@ # Table of contents * [Deploy machine learning models to production](../README.md) -* [Install](aws/install.md) +* [Install](cloud/install.md) * [Tutorial](https://docs.cortex.dev/v/master/deployments/realtime-api/text-generator) * [GitHub](https://github.com/cortexlabs/cortex) * [Examples](https://github.com/cortexlabs/cortex/tree/master/examples) @@ -9,6 +9,7 @@ ## Running Cortex on AWS +* [Install](aws/install.md) * [Credentials](aws/credentials.md) * [Security](aws/security.md) * [Spot instances](aws/spot.md) @@ -20,6 +21,12 @@ * [Update](aws/update.md) * [Uninstall](aws/uninstall.md) +## Running Cortex on GCP + +* [Install](gcp/install.md) +* [Credentials](gcp/credentials.md) +* [Uninstall](gcp/uninstall.md) + ## Deployments * [Realtime API](deployments/realtime-api.md) From 322e3909403c0e4f5166e96dfc43e207c07784b0 Mon Sep 17 00:00:00 2001 From: David Eliahu Date: Tue, 8 Dec 2020 14:52:50 -0800 Subject: [PATCH 2/2] Update docs --- docs/cloud/install.md | 6 +++++- docs/cloud/uninstall.md | 8 ++++++-- docs/cloud/update.md | 4 ++-- docs/deployments/batch-api/predictors.md | 4 ++++ docs/deployments/realtime-api/predictors.md | 4 ++++ docs/gcp/credentials.md | 4 ++-- docs/gcp/install.md | 15 +++++++++------ docs/gcp/uninstall.md | 4 ++-- 8 files changed, 34 insertions(+), 15 deletions(-) diff --git a/docs/cloud/install.md b/docs/cloud/install.md index cf59aac469..c210d7c2e4 100644 --- a/docs/cloud/install.md +++ b/docs/cloud/install.md @@ -8,4 +8,8 @@ To spin up Cortex using AWS as the cloud provider, follow [these instructions](. ## GCP -To spin up Cortex using AWS as the cloud provider, follow [these instructions](../gcp/install.md). +To spin up Cortex using GCP as the cloud provider, follow [these instructions](../gcp/install.md). + +## Local + +If you'll only be using Cortex locally, install it with `pip install cortex`. diff --git a/docs/cloud/uninstall.md b/docs/cloud/uninstall.md index 31e95087a1..a162f34dbd 100644 --- a/docs/cloud/uninstall.md +++ b/docs/cloud/uninstall.md @@ -4,8 +4,12 @@ _WARNING: you are on the master branch, please refer to the docs on the branch t ## AWS -To spin down a Cortex cluster on an AWS account, follow [these instructions](../aws/uninstall.md). +To spin down a Cortex cluster on AWS, follow [these instructions](../aws/uninstall.md). ## GCP -To spin down a Cortex cluster on a GCP account, follow [these instructions](../gcp/uninstall.md). +To spin down a Cortex cluster on GCP, follow [these instructions](../gcp/uninstall.md). + +## Local + +To uninstall the Cortex CLI, run `pip uninstall cortex`. diff --git a/docs/cloud/update.md b/docs/cloud/update.md index 7e92f3291c..1cf87cc8da 100644 --- a/docs/cloud/update.md +++ b/docs/cloud/update.md @@ -4,8 +4,8 @@ _WARNING: you are on the master branch, please refer to the docs on the branch t ## AWS -To update the configuration of a running Cortex cluster on an AWS account, follow [these instructions](../aws/update.md). +To update the configuration of a running Cortex cluster on AWS, follow [these instructions](../aws/update.md). ## GCP -There is no way of updating a running Cortex cluster that has been spun up using a GCP account. +It is currently not possible to update a Cortex cluster running on GCP. diff --git a/docs/deployments/batch-api/predictors.md b/docs/deployments/batch-api/predictors.md index 426a64ddd2..bd42cd464a 100644 --- a/docs/deployments/batch-api/predictors.md +++ b/docs/deployments/batch-api/predictors.md @@ -109,6 +109,7 @@ cloudpickle==1.6.0 Cython==0.29.21 dill==0.3.2 fastapi==0.61.1 +google-cloud-storage==1.32.0 joblib==0.16.0 Keras==2.4.3 msgpack==1.0.0 @@ -143,6 +144,7 @@ cloudpickle==1.6.0 Cython==0.29.21 dill==0.3.1.1 fastapi==0.54.1 +google-cloud-storage==1.32.0 joblib==0.16.0 msgpack==1.0.0 neuron-cc==1.0.20600.0+0.b426b885f @@ -244,6 +246,7 @@ The following Python packages are pre-installed in TensorFlow Predictors and can boto3==1.14.53 dill==0.3.2 fastapi==0.61.1 +google-cloud-storage==1.32.0 msgpack==1.0.0 numpy==1.19.1 opencv-python==4.4.0.42 @@ -331,6 +334,7 @@ The following Python packages are pre-installed in ONNX Predictors and can be us boto3==1.14.53 dill==0.3.2 fastapi==0.61.1 +google-cloud-storage==1.32.0 msgpack==1.0.0 numpy==1.19.1 onnxruntime==1.4.0 diff --git a/docs/deployments/realtime-api/predictors.md b/docs/deployments/realtime-api/predictors.md index 9bc05823b5..627f37b73a 100644 --- a/docs/deployments/realtime-api/predictors.md +++ b/docs/deployments/realtime-api/predictors.md @@ -202,6 +202,7 @@ cloudpickle==1.6.0 Cython==0.29.21 dill==0.3.2 fastapi==0.61.1 +google-cloud-storage==1.32.0 joblib==0.16.0 Keras==2.4.3 msgpack==1.0.0 @@ -236,6 +237,7 @@ cloudpickle==1.6.0 Cython==0.29.21 dill==0.3.1.1 fastapi==0.54.1 +google-cloud-storage==1.32.0 joblib==0.16.0 msgpack==1.0.0 neuron-cc==1.0.20600.0+0.b426b885f @@ -362,6 +364,7 @@ The following Python packages are pre-installed in TensorFlow Predictors and can boto3==1.14.53 dill==0.3.2 fastapi==0.61.1 +google-cloud-storage==1.32.0 msgpack==1.0.0 numpy==1.19.1 opencv-python==4.4.0.42 @@ -478,6 +481,7 @@ The following Python packages are pre-installed in ONNX Predictors and can be us boto3==1.14.53 dill==0.3.2 fastapi==0.61.1 +google-cloud-storage==1.32.0 msgpack==1.0.0 numpy==1.19.1 onnxruntime==1.4.0 diff --git a/docs/gcp/credentials.md b/docs/gcp/credentials.md index 60ed396b02..464a63faa3 100644 --- a/docs/gcp/credentials.md +++ b/docs/gcp/credentials.md @@ -2,11 +2,11 @@ _WARNING: you are on the master branch, please refer to the docs on the branch that matches your `cortex version`_ -1. Create a service account for your GCP project as described [here](https://cloud.google.com/iam/docs/creating-managing-service-accounts#iam-service-accounts-create-console) with the following roles (the roles could be more restrictive if required): +1. Create a service account for your GCP project as described [here](https://cloud.google.com/iam/docs/creating-managing-service-accounts#iam-service-accounts-create-console) with the following roles (these roles could be more restrictive if required): 1. `Editor` role. 1. `Kubernetes Engine Admin` role. 1. `Container Registry Service Agent` role. 1. `Storage Admin` role. 1. `Storage Object Admin` role. 1. Generate a service account key for your service account as described [here](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) and export it as a JSON file. -1. Export the `GOOGLE_APPLICATION_CREDENTIALS` variable and point it to the downloaded service account key from the previous step. +1. Export the `GOOGLE_APPLICATION_CREDENTIALS` variable and point it to the downloaded service account key from the previous step. For example: `export GOOGLE_APPLICATION_CREDENTIALS=/home/ubuntu/.config/gcloud/sample-269400-9a41792a969b.json` diff --git a/docs/gcp/install.md b/docs/gcp/install.md index 666188f94a..e65520c4b4 100644 --- a/docs/gcp/install.md +++ b/docs/gcp/install.md @@ -6,21 +6,21 @@ _WARNING: you are on the master branch, please refer to the docs on the branch t Make sure [Docker](https://docs.docker.com/install) is running on your machine. -If you're using GPUs, make sure your GPU quota is within the desirable values. More on GPU quotas [here](https://cloud.google.com/compute/quotas). +If you're using GPUs, make sure your GPU quota is sufficient (see [here](https://cloud.google.com/compute/quotas)). ```bash # install the CLI pip install cortex # spin up Cortex on your GCP account -cortex cluster up # or: cortex cluster up --config cluster.yaml (see configuration options below) +cortex cluster-gcp up # or: cortex cluster-gcp up --config cluster.yaml (see configuration options below) # set the default environment cortex env default gcp ``` -Try the [tutorial](../../examples/pytorch/text-generator/README.md) or deploy one of our [examples](https://github.com/cortexlabs/cortex/tree/master/examples). +Try the [tutorial](../../examples/pytorch/text-generator/README.md). ## Configure Cortex @@ -31,13 +31,16 @@ Try the [tutorial](../../examples/pytorch/text-generator/README.md) or deploy on # GKE cluster name cluster_name: cortex -# GCP one -zone: us-east1-d +# GCP project ID +project: + +# GCP zone for your cluster +zone: us-central1-a # instance type instance_type: n1-standard-2 -# GPU to attach to your instance +# GPU to attach to your instance (optional) accelerator_type: nvidia-tesla-t4 # minimum number of instances diff --git a/docs/gcp/uninstall.md b/docs/gcp/uninstall.md index dcab647f38..db5e91d267 100644 --- a/docs/gcp/uninstall.md +++ b/docs/gcp/uninstall.md @@ -6,7 +6,7 @@ _WARNING: you are on the master branch, please refer to the docs on the branch t ```bash # spin down Cortex -cortex cluster down +cortex cluster-gcp down # uninstall the CLI pip uninstall cortex @@ -15,4 +15,4 @@ rm -rf ~/.cortex If you modified your bash profile, you may wish to remove `source <(cortex completion bash)` from it (or remove `source <(cortex completion zsh)` for `zsh`). -*Note: The `cortex cluster down` command doesn't wait for the cluster to come down. You should ensure that the cluster has been removed by checking your GCP console.* +*Note: The `cortex cluster-gcp down` command doesn't wait for the cluster to come down. You can ensure that the cluster has been removed by checking the GKE console.*