Skip to content

Commit c834752

Browse files
authored
Add GCP dev instructions (#1720)
1 parent 64f8e9e commit c834752

File tree

2 files changed

+61
-23
lines changed

2 files changed

+61
-23
lines changed

CONTRIBUTING.md

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ git diff # there should be no diff
134134

135135
### Cluster configuration
136136

137+
These instructions assume you'll be creating clusters on AWS and GCP. You may skip some of the steps and configuration if you'll only be developing / testing on a single cloud provider.
138+
137139
Create a config directory in the repo's root directory:
138140

139141
```bash
@@ -146,9 +148,14 @@ Create `dev/config/env.sh` with the following information:
146148
# dev/config/env.sh
147149

148150
export AWS_ACCOUNT_ID="***" # you can find your account ID in the AWS web console; here is an example: 764403040417
149-
export AWS_REGION="us-west-2" # you can use any AWS region you'd like
151+
export AWS_REGION="***" # you can use any AWS region you'd like, e.g. "us-west-2"
150152
export AWS_ACCESS_KEY_ID="***"
151153
export AWS_SECRET_ACCESS_KEY="***"
154+
155+
export GCP_PROJECT_ID="***"
156+
export GOOGLE_APPLICATION_CREDENTIALS="***"
157+
export GCR_HOST="gcr.io" # must be "gcr.io", "us.gcr.io", "eu.gcr.io", or "asia.gcr.io"
158+
152159
# export NUM_BUILD_PROCS=2 # optional; can be >2 if you have enough memory
153160
```
154161

@@ -158,41 +165,68 @@ Create the ECR registries:
158165
make registry-create-aws
159166
```
160167

161-
Create `dev/config/cluster-aws.yaml`. Paste the following config, and update `cortex_region` and all registry URLs (replace `XXXXXXXX` with your AWS account ID, and update the region):
168+
Create `dev/config/cluster-aws.yaml`. Paste the following config, and update `region` and all registry URLs (replace `<account_id>` with your AWS account ID, and replace `<region>` with your region):
162169

163170
```yaml
164171
# dev/config/cluster-aws.yaml
165172

166173
cluster_name: cortex
167174
provider: aws
168-
region: us-west-2
175+
region: <region> # e.g. us-west-2
169176
instance_type: m5.large
170177
min_instances: 1
171178
max_instances: 5
172179

173-
image_operator: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/operator:latest
174-
image_manager: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/manager:latest
175-
image_downloader: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/downloader:latest
176-
image_request_monitor: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/request-monitor:latest
177-
image_cluster_autoscaler: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/cluster-autoscaler:latest
178-
image_metrics_server: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/metrics-server:latest
179-
image_inferentia: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/inferentia:latest
180-
image_neuron_rtd: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/neuron-rtd:latest
181-
image_nvidia: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/nvidia:latest
182-
image_fluentd: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/fluentd:latest
183-
image_statsd: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/statsd:latest
184-
image_istio_proxy: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/istio-proxy:latest
185-
image_istio_pilot: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/istio-pilot:latest
180+
image_operator: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/operator:latest
181+
image_manager: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/manager:latest
182+
image_downloader: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/downloader:latest
183+
image_request_monitor: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/request-monitor:latest
184+
image_cluster_autoscaler: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/cluster-autoscaler:latest
185+
image_metrics_server: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/metrics-server:latest
186+
image_inferentia: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/inferentia:latest
187+
image_neuron_rtd: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/neuron-rtd:latest
188+
image_nvidia: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/nvidia:latest
189+
image_fluentd: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/fluentd:latest
190+
image_statsd: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/statsd:latest
191+
image_istio_proxy: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/istio-proxy:latest
192+
image_istio_pilot: <account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs/istio-pilot:latest
193+
```
194+
195+
Create `dev/config/cluster-gcp.yaml`. Paste the following config, and update `project`, `zone`, and all registry URLs (replace `<project_id>` with your project ID, and update `gcr.io` if you are using a different host):
196+
197+
```yaml
198+
# dev/config/cluster-gcp.yaml
199+
200+
project: <project_id>
201+
zone: <zone> # e.g. us-central1-a
202+
cluster_name: cortex
203+
provider: gcp
204+
instance_type: n1-standard-2
205+
min_instances: 1
206+
max_instances: 5
207+
# accelerator_type: nvidia-tesla-k80 # optional
208+
209+
image_operator: /cortexlabs/operator:latest
210+
image_manager: gcr.io/<project_id>/cortexlabs/manager:latest
211+
image_downloader: gcr.io/<project_id>/cortexlabs/downloader:latest
212+
image_istio_proxy: gcr.io/<project_id>/cortexlabs/istio-proxy:latest
213+
image_istio_pilot: gcr.io/<project_id>/cortexlabs/istio-pilot:latest
214+
image_google_pause: gcr.io/<project_id>/cortexlabs/google-pause:latest
186215
```
187216

188217
### Building
189218

190-
Add this to your bash profile (e.g. `~/.bash_profile`, `~/.profile` or `~/.bashrc`), replacing the image registry URL accordingly:
219+
Add this to your bash profile (e.g. `~/.bash_profile`, `~/.profile` or `~/.bashrc`), replacing the placeholders accordingly:
191220

192221
```bash
193-
export CORTEX_DEV_DEFAULT_PREDICTOR_IMAGE_REGISTRY_AWS="XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs" # set the default image for APIs
194-
export CORTEX_TELEMETRY_SENTRY_DSN="https://c334df915c014ffa93f2076769e5b334@sentry.io/1848098" # redirect analytics to our dev environment
195-
export CORTEX_TELEMETRY_SEGMENT_WRITE_KEY="0WvoJyCey9z1W2EW7rYTPJUMRYat46dl" # redirect error reporting to our dev environment
222+
# set the default image for APIs
223+
export CORTEX_DEV_DEFAULT_PREDICTOR_IMAGE_REGISTRY_AWS="<account_id>.dkr.ecr.<region>.amazonaws.com/cortexlabs"
224+
export CORTEX_DEV_DEFAULT_PREDICTOR_IMAGE_REGISTRY_GCP="gcr.io/<project_id>/cortexlabs"
225+
export CORTEX_DEV_DEFAULT_PREDICTOR_IMAGE_REGISTRY="cortexlabs"
226+
227+
# redirect analytics and error reporting to our dev environment
228+
export CORTEX_TELEMETRY_SENTRY_DSN="https://c334df915c014ffa93f2076769e5b334@sentry.io/1848098"
229+
export CORTEX_TELEMETRY_SEGMENT_WRITE_KEY="0WvoJyCey9z1W2EW7rYTPJUMRYat46dl"
196230
197231
alias cortex='$HOME/bin/cortex' # your path may be different depending on where you cloned the repo
198232
```
@@ -213,12 +247,16 @@ cortex version # should show "master"
213247
Build and push all Cortex images:
214248

215249
```bash
250+
# for AWS:
216251
make images-all-aws
252+
253+
# for GCP:
254+
make images-all-gcp
217255
```
218256

219257
## Dev workflow
220258

221-
Here is the typical full dev workflow which covers most cases:
259+
Here is the typical full dev workflow which covers most cases (replace `aws` with `gcp` if desired):
222260

223261
1. `make cluster-up-aws` (creates a cluster using `dev/config/cluster-aws.yaml`)
224262
2. `make devstart-aws` (deletes the in-cluster operator, builds the CLI, and starts the operator locally; file changes will trigger the CLI and operator to re-build)
@@ -230,7 +268,7 @@ Here is the typical full dev workflow which covers most cases:
230268
If you want to switch back to the in-cluster operator:
231269

232270
1. `<ctrl+c>` to stop your local operator
233-
2. `make cluster-configure-aws` to install the operator in your cluster
271+
2. `make operator-start-aws` to restart the operator in your cluster
234272

235273
If you only want to test Cortex's local environment, here is the common workflow:
236274

docs/workloads/dependencies/docker-images.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docker images
22

3-
You can build a custom Docker image for use in your APIs, e.g. to avoid installing dependencies during replica initialization.
3+
You can build a custom Docker image for use in your APIs, e.g. to avoid installing dependencies during replica initialization or to have smaller images.
44

55
## Create a Dockerfile
66

0 commit comments

Comments
 (0)