|
| 1 | +# Deployment |
| 2 | + |
| 3 | +## General |
| 4 | + |
| 5 | +Deploying the STAC Auth Proxy is similar to deploying any other service. In general, we recommend you mirror the architecture of your other systems. |
| 6 | + |
| 7 | +The core principles of deploying the STAC Auth Proxy are: |
| 8 | + |
| 9 | +1. The STAC API should not be available on the public internet |
| 10 | +2. The STAC Auth Proxy should be able to communicate with both the STAC API and the OIDC Server (namely, the discovery endpoint and JWKS endpoint) |
| 11 | + |
| 12 | +### Networking Considerations |
| 13 | + |
| 14 | +#### Hiding the STAC API |
| 15 | + |
| 16 | +The STAC API should not be directly accessible from the public internet. The STAC Auth Proxy acts as the public-facing endpoint. |
| 17 | + |
| 18 | +##### AWS Strategy |
| 19 | + |
| 20 | +- Place the STAC API in a private subnet |
| 21 | +- Place the STAC Auth Proxy in a public subnet with internet access |
| 22 | +- Use security groups to restrict access between components |
| 23 | + |
| 24 | +##### Kubernetes Strategy |
| 25 | + |
| 26 | +- Deploy the STAC API as an internal service (ClusterIP) |
| 27 | +- Deploy the STAC Auth Proxy with an Ingress for external access |
| 28 | +- Use network policies to control traffic flow |
| 29 | + |
| 30 | +#### Communicating with the OIDC Server |
| 31 | + |
| 32 | +The STAC Auth Proxy needs to communicate with your OIDC provider for authentication. If your OIDC server is not directly available to the STAC Auth Proxy, use [`OIDC_DISCOVERY_INTERNAL_URL`](configuration.md#oidc_discovery_internal_url) (the [`OIDC_DISCOVERY_URL`](configuration.md#oidc_discovery_url) will still be used for auth in the browser, such as the Swagger UI page). |
| 33 | + |
| 34 | +## AWS Lambda |
| 35 | + |
| 36 | +For AWS Lambda deployments, we recommend using the [Mangum](https://pypi.org/project/mangum/) handler with disabled lifespan events. Such a handler is available at `stac_auth_proxy.lambda:handler`. |
| 37 | + |
| 38 | +> [!TIP] |
| 39 | +> |
| 40 | +> If using `stac_auth_proxy.lambda:handler`, be sure to install the `lambda` optional dependencies: |
| 41 | +> |
| 42 | +> ```bash |
| 43 | +> pip install stac_auth_proxy[lambda] |
| 44 | +> ``` |
| 45 | +
|
| 46 | +### CDK |
| 47 | +
|
| 48 | +If using [AWS CDK](https://docs.aws.amazon.com/cdk/), a [`StacAuthProxy` Construct](https://developmentseed.org/eoapi-cdk/#stacauthproxylambda-) is made available within the [`eoapi-cdk`](https://github.com/developmentseed/eoapi-cdk) project. |
| 49 | +
|
| 50 | +## Docker |
| 51 | +
|
| 52 | +The STAC Auth Proxy is available as a Docker image from the [GitHub Container Registry (GHCR)](https://github.com/developmentseed/stac-auth-proxy/pkgs/container/stac-auth-proxy). |
| 53 | +
|
| 54 | +```bash |
| 55 | +# Latest version |
| 56 | +docker pull ghcr.io/developmentseed/stac-auth-proxy:latest |
| 57 | +
|
| 58 | +# Specific version |
| 59 | +docker pull ghcr.io/developmentseed/stac-auth-proxy:v0.7.1 |
| 60 | +``` |
| 61 | +
|
| 62 | +## Kubernetes |
| 63 | +
|
| 64 | +The STAC Auth Proxy can be deployed to Kubernetes using our [published Helm chart](https://github.com/developmentseed/stac-auth-proxy/pkgs/container/stac-auth-proxy%2Fcharts%2Fstac-auth-proxy). |
| 65 | +
|
| 66 | +### Prerequisites |
| 67 | +
|
| 68 | +- Kubernetes 1.19+ |
| 69 | +- Helm 3.2.0+ |
| 70 | +
|
| 71 | +### Installation |
| 72 | +
|
| 73 | +```bash |
| 74 | +# Add the Helm repository |
| 75 | +helm registry login ghcr.io |
| 76 | +
|
| 77 | +# Install with minimal configuration |
| 78 | +helm install stac-auth-proxy oci://ghcr.io/developmentseed/stac-auth-proxy/charts/stac-auth-proxy \ |
| 79 | + --set env.UPSTREAM_URL=https://your-stac-api.com/stac \ |
| 80 | + --set env.OIDC_DISCOVERY_URL=https://your-auth-server/.well-known/openid-configuration \ |
| 81 | + --set ingress.host=stac-proxy.your-domain.com |
| 82 | +``` |
| 83 | +
|
| 84 | +### Configuration |
| 85 | +
|
| 86 | +| Parameter | Description | Required | Default | |
| 87 | +| ------------------------ | --------------------------------------------- | -------- | ------- | |
| 88 | +| `env.UPSTREAM_URL` | URL of the STAC API to proxy | Yes | - | |
| 89 | +| `env.OIDC_DISCOVERY_URL` | OpenID Connect discovery document URL | Yes | - | |
| 90 | +| `env` | Environment variables passed to the container | No | `{}` | |
| 91 | +| `ingress.enabled` | Enable ingress | No | `true` | |
| 92 | +| `ingress.className` | Ingress class name | No | `nginx` | |
| 93 | +| `ingress.host` | Hostname for the ingress | No | `""` | |
| 94 | +| `ingress.tls.enabled` | Enable TLS for ingress | No | `true` | |
| 95 | +| `replicaCount` | Number of replicas | No | `1` | |
| 96 | +
|
| 97 | +For a complete list of values, see the [values.yaml](./helm/values.yaml) file. |
| 98 | +
|
| 99 | +### Management |
| 100 | +
|
| 101 | +```bash |
| 102 | +# Upgrade |
| 103 | +helm upgrade stac-auth-proxy oci://ghcr.io/developmentseed/stac-auth-proxy/charts/stac-auth-proxy |
| 104 | +
|
| 105 | +# Uninstall |
| 106 | +helm uninstall stac-auth-proxy |
| 107 | +``` |
0 commit comments