Go (>=1.12.9)
Docker
eksctl
kubectl
Clone the project:
git clone https://github.com/cortexlabs/cortex.gitcd cortex
Run the tests:
make test
Create the AWS Elastic Container Registry:
make registry-create
Take note of the registry URL, this will be needed shortly.
Create the S3 buckets:
aws s3 mb s3://cortex-cluster-<your_name>aws s3 mb s3://cortex-cli-<your_name> # if you'll be uploading your compiled CLI
Make the config folder:
mkdir dev/config
Create dev/config/cluster.yaml. Paste the following config, and update cortex_bucket, cortex_region, aws_access_key_id, aws_secret_access_key, and all registry URLs accordingly:
aws_access_key_id: ***aws_secret_access_key: ***​instance_type: m5.largemin_instances: 2max_instances: 5bucket: cortex-cluster-<your_name>region: us-west-2log_group: cortexcluster_name: cortextelemetry: false​image_predictor_serve: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/predictor-serve:latestimage_predictor_serve_gpu: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/predictor-serve-gpu:latestimage_tf_serve: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/tf-serve:latestimage_tf_serve_gpu: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/tf-serve-gpu:latestimage_tf_api: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/tf-api:latestimage_onnx_serve: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/onnx-serve:latestimage_onnx_serve_gpu: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/onnx-serve-gpu:latestimage_operator: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/operator:latestimage_manager: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/manager:latestimage_downloader: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/downloader:latestimage_cluster_autoscaler: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/cluster-autoscaler:latestimage_metrics_server: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/metrics-server:latestimage_nvidia: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/nvidia:latestimage_fluentd: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/fluentd:latestimage_statsd: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/statsd:latestimage_istio_proxy: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/istio-proxy:latestimage_istio_pilot: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/istio-pilot:latestimage_istio_citadel: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/istio-citadel:latestimage_istio_galley: XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com/cortexlabs/istio-galley:latest
Create dev/config/build.sh. Paste the following config, and update CLI_BUCKET_NAME, CLI_BUCKET_REGION, REGISTRY_URL, and REGISTRY_REGION accordingly:
export VERSION="master"​export REGISTRY_URL="XXXXXXXX.dkr.ecr.us-west-2.amazonaws.com"export REGISTRY_REGION="us-west-2"​# optional, only used for make ci-build-and-upload-cliexport CLI_BUCKET_NAME="cortex-cli-<your_name>"export CLI_BUCKET_REGION="us-west-2"
Build and push all Cortex images:
make registry-all
Build and configure the Cortex CLI:
make cli # The binary will be placed in path/to/cortex/bin/cortexpath/to/cortex/bin/cortex configure
Start Cortex:
make cortex-up
Tear down the Cortex cluster:
make cortex-down
cd examples/iris-classifierpath/to/cortex/bin/cortex deploy
If you're making changes in the operator and want faster iterations, you can run an off-cluster operator.
make operator-stop to stop the in-cluster operator
make devstart to run the off-cluster operator (which rebuilds the CLI and restarts the Operator when files change)
path/to/cortex/bin/cortex configure (on a separate terminal) to configure your cortex CLI to use the off-cluster operator. When prompted for operator URL, use http://localhost:8888
Note: make cortex-up-dev will start Cortex without installing the operator.
If you want to switch back to the in-cluster operator:
<ctrl+C> to stop your off-cluster operator
make operator-start to install the operator in your cluster
path/to/cortex/bin/cortex configure to configure your cortex CLI to use the in-cluster operator. When prompted for operator URL, use the URL shown when running make cortex-info
make cortex-up-dev
make devstart
Make changes
make registry-dev
Test your changes with projects in examples or your own
See Makefile for additional dev commands