Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/helm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ jobs:
run: |
python -m pip install pytest httpx

# - name: Setup upterm session
# uses: lhotari/action-upterm@v1

- name: run the tests
run: |
# first substitute test endpoints in the test files
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests/test_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
timeout = httpx.Timeout(15.0, connect=60.0)
client = httpx.Client(timeout=timeout)

raster_endpoint="http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/raster"
raster_endpoint="http://k8s-eoapi-ingressn-cd16d0ed58-580a04972ec20c3c.elb.us-west-1.amazonaws.com/raster"


def test_raster_api():
Expand Down
54 changes: 26 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,13 @@ If you don't have a k8s cluster set up on AWS or GCP then follow an IaC guide be

* [AWS EKS Cluster Setup](./docs/aws-eks.md)

* [TBD: GCP GKE Cluster Setup](./docs/gcp-gke.md)
* [GCP GKE Cluster Setup](./docs/gcp-gke.md)

## Helm Installation

Once you have a k8s cluster set up you can `helm install` eoAPI as follows

1. `helm install` from this repo's `helm-chart/` folder:

```python
######################################################
# create os environment variables for required secrets
######################################################
$ export GITSHA=$(git rev-parse HEAD | cut -c1-10)
$ export PGUSER=s00pers3cr3t
$ export POSTGRES_USER=s00pers3cr3t
$ export POSTGRES_PASSWORD=superuserfoobar
$ export PGPASSWORD=foobar

$ cd ./helm-chart

$ helm install \
--namespace eoapi \
--create-namespace \
--set gitSha=$GITSHA \
--set db.settings.secrets.PGUSER=$PGUSER \
--set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \
--set db.settings.secrets.PGPASSWORD=$PGPASSWORD \
--set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
eoapi \
./eoapi
```

2. or `helm install` from https://devseed.com/eoapi-k8s/:
1. `helm install` from https://devseed.com/eoapi-k8s/:

```python
# add the eoapi helm repo locally
Expand All @@ -80,4 +54,28 @@ Once you have a k8s cluster set up you can `helm install` eoAPI as follows
$ helm install -n eoapi --create-namespace eoapi eoapi/eoapi --version 0.1.2 -f config.yaml
```

2. or `helm install` from this repo's `helm-chart/` folder:

```python
######################################################
# create os environment variables for required secrets
######################################################
$ export GITSHA=$(git rev-parse HEAD | cut -c1-10)
$ export PGUSER=s00pers3cr3t
$ export POSTGRES_USER=s00pers3cr3t
$ export POSTGRES_PASSWORD=superuserfoobar
$ export PGPASSWORD=foobar

$ cd ./helm-chart

$ helm install \
--namespace eoapi \
--create-namespace \
--set gitSha=$GITSHA \
--set db.settings.secrets.PGUSER=$PGUSER \
--set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \
--set db.settings.secrets.PGPASSWORD=$PGPASSWORD \
--set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
eoapi \
./eoapi
```
7 changes: 3 additions & 4 deletions docs/aws-eks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AWS EKS Cluster Walk-through
# AWS EKS Cluster Walkthrough

This walk-through uses `eksctl` and assumes you already have an AWS account, have the [eksctl prerequisites installed](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html) including `eksctl` and `helm`.
This walkthrough uses `eksctl` and assumes you already have an AWS account, have the [eksctl prerequisites installed](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html) including `eksctl` and `helm`.
After creating the cluster we'll walk through installing the following add-ons and controllers:

* `aws-ebs-csi-driver`
Expand Down Expand Up @@ -215,8 +215,7 @@ $ helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
$ helm upgrade \
-i ingress-nginx \
ingress-nginx/ingress-nginx \
--set controller.service.type=LoadBalancer
# these next two annotations are the most important otherwise nginx controller will create an "internal" NLB
--set controller.service.type=LoadBalancer \
--set controller.service.annotations."service\.beta\.kubernetes\.io/aws-load-balancer-type"="nlb" \
--set controller.service.annotations."service\.beta\.kubernetes\.io/aws-load-balancer-scheme"="internet-facing" \
--namespace <the-same-namespace-where-your-services-will-be-deployed>
Expand Down
5 changes: 5 additions & 0 deletions helm-chart/eoapi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version numbers below correspond to helm chart `appVersion`: see ./helm-chart/eoapi/Chart.yaml
---
# 0.1.2 (2023-08-31)

* move `command` blocks out to `values.yml` for [generalizing ticket](https://github.com/developmentseed/eoapi-k8s/issues/31)
* add `livenessProbe` for all deployments for [livenessProbe bug](https://github.com/developmentseed/eoapi-k8s/issues/26)

# 0.1.1 (2023-07-21)

* For the shared-nginx ingress option [add root path with docs](https://github.com/developmentseed/eoapi-k8s/issues/18) pointing to path rewrites
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/eoapi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ version: "0.1.3"
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.1"
appVersion: "0.1.2"
4 changes: 1 addition & 3 deletions helm-chart/eoapi/templates/db/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ spec:
- name: pgstac
image: {{ .Values.db.image.name }}:{{ .Values.db.image.tag }}
args:
- "postgres"
- "-N"
- "500"
{{- toYaml .Values.db.command | nindent 12 }}
envFrom:
- secretRef:
name: pgstac-secrets
Expand Down
23 changes: 13 additions & 10 deletions helm-chart/eoapi/templates/services/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ spec:
{{- end }}
name: {{ $serviceName }}
command:
- "uvicorn"
{{ if (eq $serviceName "vector") }}
- "tipg.main:app"
{{- else if (eq $serviceName "raster") }}
- "titiler.pgstac.main:app"
{{- else if (eq $serviceName "stac") }}
- "stac_fastapi.pgstac.app:app"
{{- end }}
- "--host=$(HOST)"
- "--port=$(PORT)"
{{- toYaml (index $v "command") | nindent 10 }}
{{- if (and ($.Values.ingress.className) (eq $.Values.ingress.className "nginx")) }}
- "--root-path=/{{ $serviceName }}"
{{- end }}{{/* needed for proxies and path rewrites on NLB */}}
livenessProbe:
httpGet:
{{- if (eq $serviceName "stac") }}
path: /_mgmt/ping
{{- else }}
path: /healthz
{{- end }}
port: {{ $.Values.service.port }}
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 15
successThreshold: 1
ports:
- containerPort: {{ $.Values.service.port }}
resources:
Expand Down
19 changes: 19 additions & 0 deletions helm-chart/eoapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ db:
image:
name: ghcr.io/stac-utils/pgstac
tag: v0.7.1
command:
- "postgres"
- "-N"
- "500"
# toggle to true||false if you want the db test fixtures loaded
enable_data_fixtures: true
settings:
Expand Down Expand Up @@ -83,6 +87,11 @@ raster:
image:
name: ghcr.io/stac-utils/titiler-pgstac
tag: uvicorn-0.4.1
command:
- "uvicorn"
- "titiler.pgstac.main:app"
- "--host=$(HOST)"
- "--port=$(PORT)"
settings:
timeout: 10
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down Expand Up @@ -120,6 +129,11 @@ stac:
image:
name: ghcr.io/stac-utils/stac-fastapi-pgstac
tag: 2.4.9
command:
- "uvicorn"
- "stac_fastapi.pgstac.app:app"
- "--host=$(HOST)"
- "--port=$(PORT)"
settings:
timeout: 10
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand All @@ -144,6 +158,11 @@ vector:
image:
name: ghcr.io/developmentseed/tipg
tag: uvicorn-0.2.0
command:
- "uvicorn"
- "tipg.main:app"
- "--host=$(HOST)"
- "--port=$(PORT)"
settings:
timeout: 10
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand Down