Skip to content

Commit 5eaf505

Browse files
committed
add stac browser to docker deployment, change tiler in aws deployment to our tiler
1 parent 3437f85 commit 5eaf505

File tree

7 files changed

+133
-1
lines changed

7 files changed

+133
-1
lines changed

docker-compose.custom.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ services:
259259
volumes:
260260
- ./.pgdata:/var/lib/postgresql/data
261261

262+
stac-browser:
263+
build:
264+
context: dockerfiles
265+
dockerfile: Dockerfile.browser
266+
ports:
267+
- "${MY_DOCKER_IP:-127.0.0.1}:8084:8080"
268+
depends_on:
269+
- stac
270+
262271
networks:
263272
default:
264273
name: eoapi-network

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ services:
132132
volumes:
133133
- ./.pgdata:/var/lib/postgresql/data
134134

135+
# change to official image when available https://github.com/radiantearth/stac-browser/pull/386
136+
stac-browser:
137+
build:
138+
context: dockerfiles
139+
dockerfile: Dockerfile.browser
140+
ports:
141+
- "${MY_DOCKER_IP:-127.0.0.1}:8084:8080"
142+
depends_on:
143+
- stac-fastapi
144+
135145
networks:
136146
default:
137147
name: eoapi-network

dockerfiles/Dockerfile.browser

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright Radiant Earth Foundation
2+
3+
FROM node:lts-alpine3.18 AS build-step
4+
ARG DYNAMIC_CONFIG=true
5+
6+
WORKDIR /app
7+
8+
RUN apk add --no-cache git
9+
RUN git clone https://github.com/radiantearth/stac-browser.git .
10+
# remove the default config.js
11+
RUN rm config.js
12+
RUN npm install
13+
# replace the default config.js with our config file
14+
COPY ./browser_config.js ./config.js
15+
RUN \[ "${DYNAMIC_CONFIG}" == "true" \] && sed -i 's/<!-- <script defer="defer" src=".\/config.js"><\/script> -->/<script defer="defer" src=".\/config.js"><\/script>/g' public/index.html
16+
RUN npm run build
17+
18+
19+
FROM nginx:1-alpine-slim
20+
21+
COPY --from=build-step /app/dist /usr/share/nginx/html
22+
COPY --from=build-step /app/config.schema.json /etc/nginx/conf.d/config.schema.json
23+
24+
# change default port to 8080
25+
RUN apk add jq pcre-tools && \
26+
sed -i 's/\s*listen\s*80;/ listen 8080;/' /etc/nginx/conf.d/default.conf && \
27+
sed -i 's/\s*location \/ {/ location \/ {\n try_files $uri $uri\/ \/index.html;/' /etc/nginx/conf.d/default.conf
28+
29+
EXPOSE 8080
30+
31+
STOPSIGNAL SIGTERM
32+
33+
# override entrypoint, which calls nginx-entrypoint underneath
34+
COPY --from=build-step /app/docker/docker-entrypoint.sh ./docker-entrypoint.d/40-stac-browser-entrypoint.sh

dockerfiles/browser_config.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
catalogUrl: "http://0.0.0.0:8081",
3+
catalogTitle: "eoAPI STAC Browser",
4+
allowExternalAccess: true, // Must be true if catalogUrl is not given
5+
allowedDomains: [],
6+
detectLocaleFromBrowser: true,
7+
storeLocale: true,
8+
locale: "en",
9+
fallbackLocale: "en",
10+
supportedLocales: [
11+
"de",
12+
"es",
13+
"en",
14+
"fr",
15+
"it",
16+
"ro"
17+
],
18+
apiCatalogPriority: null,
19+
useTileLayerAsFallback: true,
20+
displayGeoTiffByDefault: false,
21+
buildTileUrlTemplate: ({href, asset}) => "http://0.0.0.0:8082/cog/tiles/{z}/{x}/{y}@2x?url=" + encodeURIComponent(asset.href.startsWith("/vsi") ? asset.href : href),
22+
stacProxyUrl: null,
23+
pathPrefix: "/",
24+
historyMode: "history",
25+
cardViewMode: "cards",
26+
cardViewSort: "asc",
27+
showThumbnailsAsAssets: false,
28+
stacLint: true,
29+
geoTiffResolution: 128,
30+
redirectLegacyUrls: false,
31+
itemsPerPage: 12,
32+
defaultThumbnailSize: null,
33+
maxPreviewsOnMap: 50,
34+
crossOriginMedia: null,
35+
requestHeaders: {},
36+
requestQueryParameters: {},
37+
preprocessSTAC: null,
38+
authConfig: null
39+
};

infrastructure/aws/cdk/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ def __init__( # noqa: C901
272272
stac_catalog_url=eostac_settings.stac_api_custom_domain_name,
273273
website_index_document="index.html",
274274
bucket_arn=stac_browser_bucket.bucket_arn,
275+
config_file_path="cdk/stac_browser_config.js",
275276
)
276277

277278
# eoapi.vector
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
catalogUrl: null,
3+
catalogTitle: "eoAPI STAC Browser",
4+
allowExternalAccess: true, // Must be true if catalogUrl is not given
5+
allowedDomains: [],
6+
detectLocaleFromBrowser: true,
7+
storeLocale: true,
8+
locale: "en",
9+
fallbackLocale: "en",
10+
supportedLocales: [
11+
"de",
12+
"es",
13+
"en",
14+
"fr",
15+
"it",
16+
"ro"
17+
],
18+
apiCatalogPriority: null,
19+
useTileLayerAsFallback: true,
20+
displayGeoTiffByDefault: false,
21+
buildTileUrlTemplate: ({href, asset}) => "https://raster.eoapi.dev/cog/tiles/{z}/{x}/{y}@2x?url=" + encodeURIComponent(asset.href.startsWith("/vsi") ? asset.href : href),
22+
stacProxyUrl: null,
23+
pathPrefix: "/",
24+
historyMode: "history",
25+
cardViewMode: "cards",
26+
cardViewSort: "asc",
27+
showThumbnailsAsAssets: false,
28+
stacLint: true,
29+
geoTiffResolution: 128,
30+
redirectLegacyUrls: false,
31+
itemsPerPage: 12,
32+
defaultThumbnailSize: null,
33+
maxPreviewsOnMap: 50,
34+
crossOriginMedia: null,
35+
requestHeaders: {},
36+
requestQueryParameters: {},
37+
preprocessSTAC: null,
38+
authConfig: null
39+
};

infrastructure/aws/requirements-cdk.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ boto3==1.28.71
77
# pydantic settings
88
pydantic~=2.0
99
pydantic-settings~=2.0
10-
eoapi-cdk==6.0.0
10+
eoapi-cdk==6.1.2

0 commit comments

Comments
 (0)