Skip to content
Merged
71 changes: 71 additions & 0 deletions .github/workflows/stac-browser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build STAC Browser

on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name for this image"
required: true
default: "eoapi-k8s-stac-browser"
STAC_BROWSER_VERSION:
description: "STAC Browser version to build (e.g. v3.3.4)"
required: true
default: "v3.3.4"

env:
REGISTRY: ghcr.io
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}

jobs:
build-and-push:
runs-on: ubuntu-latest
name: Build and push STAC Browser image

steps:
- name: Checkout STAC Browser repository
uses: actions/checkout@v4
with:
repository: radiantearth/stac-browser
ref: ${{ github.event.inputs.STAC_BROWSER_VERSION }}

- name: Set environment variables
run: |
echo VERSION=${TAG_NAME#v} >> $GITHUB_ENV
echo IMAGE_NAME=$REGISTRY/$(echo ${GITHUB_REPOSITORY,,})/stac-browser >> $GITHUB_ENV
echo COMMITED_AT=$(git show -s --format=%cI `git rev-parse HEAD`) >> $GITHUB_ENV
echo REVISION=$(git rev-parse --short HEAD) >> $GITHUB_ENV

- name: Collect Docker image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.created=${{ env.COMMITED_AT }}
org.opencontainers.image.version=v${{ env.VERSION }}
org.opencontainers.image.maintainer=${{ github.repository_owner }}
tags: |
type=semver,pattern={{version}},value=v${{ env.VERSION }}

- name: Log in to the GitHub container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
VERSION=${{ env.VERSION }}
REVISION=${{ env.REVISION }}
pathPrefix=/browser/
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:edge
cache-to: type=inline
24 changes: 24 additions & 0 deletions helm-chart/eoapi/templates/services/browser/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.browser.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: browser-{{ .Release.Name }}
spec:
replicas: {{.Values.browser.replicaCount}}
selector:
matchLabels:
app: browser-{{ .Release.Name }}
template:
metadata:
labels:
app: browser-{{ .Release.Name }}
spec:
containers:
- name: browser
image: {{ .Values.browser.image.name }}:{{ .Values.browser.image.tag }}
ports:
- containerPort: 8080
env:
- name: SB_catalogUrl
value: "/stac"
{{- end }}
13 changes: 13 additions & 0 deletions helm-chart/eoapi/templates/services/browser/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.browser.enabled }}
apiVersion: v1
kind: Service
metadata:
name: browser-{{ .Release.Name }}
spec:
selector:
app: browser-{{ .Release.Name }}
ports:
- protocol: TCP
port: 8080
targetPort: 8080
{{- end }}
1 change: 1 addition & 0 deletions helm-chart/eoapi/templates/services/doc-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ data:
{{- if .Values.multidim.enabled }}
<li><a href="/multidim" target="_blank" rel="noopener noreferrer">/multidim</a></li>
{{- end}}
<li><a href="/browser/" target="_blank" rel="noopener noreferrer">/browser</a></li>
</ul>
</body>
</html>
Expand Down
21 changes: 16 additions & 5 deletions helm-chart/eoapi/templates/services/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
path: /raster{{ .Values.ingress.pathSuffix }}
backend:
service:
name: raster
name: raster-{{ $.Release.Name }}
port:
number: {{ .Values.service.port }}
{{- end }}
Expand All @@ -48,7 +48,7 @@ spec:
path: /stac{{ .Values.ingress.pathSuffix }}
backend:
service:
name: stac
name: stac-{{ $.Release.Name }}
port:
number: {{ .Values.service.port }}
{{- end }}
Expand All @@ -58,7 +58,7 @@ spec:
path: /vector{{ .Values.ingress.pathSuffix }}
backend:
service:
name: vector
name: vector-{{ $.Release.Name }}
port:
number: {{ .Values.service.port }}
{{- end }}
Expand All @@ -68,17 +68,28 @@ spec:
path: /multidim{{ .Values.ingress.pathSuffix }}
backend:
service:
name: multidim
name: multidim-{{ $.Release.Name }}
port:
number: {{ .Values.service.port }}
{{- end }}

{{- if and .Values.browser.enabled (or (not (hasKey .Values.browser "ingress")) .Values.browser.ingress.enabled) }}
# We need a separate path because browser does not play well with nginx rewrite_path directive
- pathType: {{ .Values.ingress.pathType }}
path: "/browser"
backend:
service:
name: browser-{{ $.Release.Name }}
port:
number: 8080
{{- end }}

{{- if .Values.docServer.enabled }}
- pathType: {{ $.Values.ingress.pathType | default "Prefix" }}
path: "/{{ $.Values.ingress.rootPath | default "" }}"
backend:
service:
name: eoapi-doc-server
name: doc-server-{{ $.Release.Name }}
port:
number: 80
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/eoapi/templates/services/multidim/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: multidim
name: multidim-{{ $.Release.Name }}
labels:
app: multidim-{{ .Release.Name }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/eoapi/templates/services/raster/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: raster
name: raster-{{ $.Release.Name }}
labels:
app: raster-{{ .Release.Name }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/eoapi/templates/services/stac/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: stac
name: stac-{{ $.Release.Name }}
labels:
app: stac-{{ .Release.Name }}
spec:
Expand Down
3 changes: 3 additions & 0 deletions helm-chart/eoapi/templates/services/traefik-middleware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ spec:
{{- if .Values.multidim.enabled }}
- /multidim
{{- end }}
# {{- if .Values.browser.enabled }}
# - /browser
# {{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion helm-chart/eoapi/templates/services/vector/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: vector
name: vector-{{ $.Release.Name }}
labels:
app: vector-{{ .Release.Name }}
spec:
Expand Down
5 changes: 4 additions & 1 deletion helm-chart/eoapi/tests/ingress_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests:
stac.enabled: false
vector.enabled: true
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
Expand Down Expand Up @@ -46,6 +47,7 @@ tests:
stac.enabled: true
vector.enabled: false
multidim.enabled: false
browser.enabled: false
asserts:
- isKind:
of: Ingress
Expand Down Expand Up @@ -77,6 +79,7 @@ tests:
stac.enabled: false
vector.enabled: false
multidim.enabled: true
browser.enabled: false
asserts:
- isKind:
of: Ingress
Expand All @@ -91,4 +94,4 @@ tests:
value: "/"
- equal:
path: spec.rules[0].http.paths[1].backend.service.name
value: eoapi-doc-server
value: doc-server-RELEASE-NAME
18 changes: 14 additions & 4 deletions helm-chart/eoapi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ comment_install: >
# the correct updated value otherwise it's defaulted
gitSha: "gitshaABC123"


######################
# TESTING
######################
Expand All @@ -31,7 +30,6 @@ serviceAccount:
annotations: {}
labels: {}


######################
# SERVICE & INGRESS
######################
Expand Down Expand Up @@ -61,7 +59,6 @@ ingress:
certManagerIssuer: letsencrypt-prod
certManagerEmail: ""


######################
# DATABASE
######################
Expand Down Expand Up @@ -186,7 +183,6 @@ pgstacBootstrap:
# toggle to "false" if you don't want fixtures default loaded
LOAD_FIXTURES: "true"


######################
# API SERVICES
######################
Expand Down Expand Up @@ -461,5 +457,19 @@ vector:
# https://www.uvicorn.org/settings/#production
WEB_CONCURRENCY: "5"

######################
# STAC Browser
######################
# It is a good idea to deploy stac-browser outside of k8s, since it's SPA with static files.
browser:
enabled: true
replicaCount: 1
image:
# we use a custom image with pathPrefix built into it
name: ghcr.io/developmentseed/eoapi-k8s-stac-browser
tag: 3.3.4
ingress:
enabled: true # Control ingress specifically for browser service

docServer:
enabled: true
2 changes: 1 addition & 1 deletion ingest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else
fi

# Define namespaces
NAMESPACES=("default" "eoapi", "data-access")
NAMESPACES=("default" "eoapi" "data-access")
EOAPI_POD_RASTER=""
FOUND_NAMESPACE=""

Expand Down