Search code examples
google-cloud-platformenvoyproxy

Deploy ESPv2 locally


I have successfully deployed ESPv2 on CloudRun.

Since ESPv2 is based on Envoy, I was wondering if there a way to deploy ESPv2 locally on my machine.

Thanks


Solution

  • Yes you can. There's a documentation that tells you how to run ESP locally or on another platform such as AWS or on a Kubernetes cluster that's not running on Google Cloud. I highly recommend that you study it first but I will try summarize it.

    The guide is also applicable for ESPv2.

    Take note that Windows is not yet supported and there are a few prerequisites before you can run the ESPv2 container on your machine:

    1. You should have Docker installed on your machine.
    2. You have deployed an API locally or on a host that is reachable to the host where you run ESPv2.
    3. You've set-up Cloud Endpoints and deployed the configuration to create a service for your API.

    You also need to provide a service account JSON file with the following roles:

    • Service Controller
    • Cloud Trace Agent

    because ESPv2 uses the service account details to generate access tokens to call the services to manage your API.

    Sample command to run using Docker on Linux:

    sudo docker run \
        --detach \
        --name="esp" \
        --net="host" \
        --volume=$HOME/Downloads:/esp \
        --publish=8082 \
        gcr.io/endpoints-release/endpoints-runtime:1 \
        --service=YOUR_SERVICE_NAME \
        --rollout_strategy=managed \
        --http_port=8082 \
        --backend=localhost:8080 \
        --service_account_key=/esp/service-account-creds.json