diff --git a/adjacent-servers/adjacent-servers-proxy.js b/adjacent-servers/adjacent-servers-proxy.js index 75069c6f..e9dc52ba 100644 --- a/adjacent-servers/adjacent-servers-proxy.js +++ b/adjacent-servers/adjacent-servers-proxy.js @@ -89,6 +89,24 @@ function initAdjacentServersProxy(app, isDocker, ensureAdmin) { }) ); } + + // Veloserver + if (process.env.WITH_VELOSERVER === "true") { + app.use( + `${process.env.ROOT_PATH || ""}/veloserver`, + ensureAdmin(false, false, true), // true to allow all GETs - others require admin auth + createProxyMiddleware({ + target: `http://${isDocker ? "veloserver" : "localhost"}:${ + process.env.VELOSERVER_PORT || 8885 + }`, + changeOrigin: true, + pathRewrite: { + [`^${process.env.ROOT_PATH || ""}/titilerpgstac`]: "", + }, + selfHandleResponse: true, + }) + ); + } } const createSwaggerInterceptor = (path) => { diff --git a/docs/pages/Setup/Adjacent-Servers/adjacent-servers.md b/docs/pages/Setup/Adjacent-Servers/adjacent-servers.md new file mode 100644 index 00000000..5cfb853a --- /dev/null +++ b/docs/pages/Setup/Adjacent-Servers/adjacent-servers.md @@ -0,0 +1,60 @@ +--- +layout: page +title: Adjacent Servers +permalink: /setup/adjacent-servers +parent: Setup +has_children: false +nav_order: 3 +--- + +## Adjacent Servers + +Version 4.0.0+ adds support for the following adjacent services: + +- stac-fastapi - [https://github.com/stac-utils/stac-fastapi](https://github.com/stac-utils/stac-fastapi) +- tipg - [https://github.com/developmentseed/tipg](https://github.com/developmentseed/tipg) +- titiler - [https://github.com/developmentseed/titiler](https://github.com/developmentseed/titiler) +- titiler-pgstac - [https://github.com/stac-utils/titiler-pgstac](https://github.com/stac-utils/titiler-pgstac) +- veloserver - [https://github.com/NASA-AMMOS/Veloserver](https://github.com/NASA-AMMOS/Veloserver) + +All adjacent services are proxied through MMGIS and endpoints that perform writes are locked behind MMGIS' authentication. + +- https://{mmgis-domain}/stac +- https://{mmgis-domain}/tipg +- https://{mmgis-domain}/titiler +- https://{mmgis-domain}/titilerpgstac +- https://{mmgis-domain}/veloserver + +### Upgrading Python and Installing the Adjacent Services + +**If using docker, this is unneeded.** + +1. Make sure you are using python >=3.10 to <3.13 (3.13 is not supported). +1. In the root MMGIS directory `/`, run `python -m pip install -r python-requirements.txt` + +### Setting the Adjacent Server ENVs + +#### With Docker + +1. Fill out the `POSTGRES_*` environment variables in and use `docker-compose.sample.yml` +1. Unused services within the docker-compose.yml can be safely removed. + +#### Without Docker + +1. Copy `/adjacent-servers/stac/.env.example` to `/adjacent-servers/stac/.env` and fill out the `POSTGRES_*` environment variables. +1. Copy `/adjacent-servers/tipg/.env.example` to `/adjacent-servers/tipg/.env` and fill out the `POSTGRES_*` environment variables. +1. Copy `/adjacent-servers/titiler/.env.example` to `/adjacent-servers/titiler/.env`. +1. Copy `/adjacent-servers/titiler-pgstac/.env.example` to `/adjacent-servers/titiler-pgstac/.env` and fill out the `POSTGRES_*` environment variables. +1. Make sure your system `PROJ_LIB` environment variable is pointed to the installation of proj within the python version in use. For example, my local machine's installation is located at `.../Programs/Python/Python312/Lib/site-packages/pyproj/proj_dir/share/proj`. + +### Setting MMGIS ENVs + +To finally enable the proxying to services, enable the following MMGIS ENVs in your `.env`: + +- WITH_STAC=true +- WITH_TIPG=true +- WITH_TITILER=true +- WITH_TITILER_PGSTAC=true +- WITH_VELOSERVER=true + +_Note:_ The STAC, TITILER and TITILER_PGSTAC services being enabled activates certain features within MMGIS. The other services can be setup independently if desired. diff --git a/docs/pages/Setup/ENVs/ENVs.md b/docs/pages/Setup/ENVs/ENVs.md index 400f6bca..c9aee8b0 100644 --- a/docs/pages/Setup/ENVs/ENVs.md +++ b/docs/pages/Setup/ENVs/ENVs.md @@ -3,6 +3,7 @@ layout: page title: ENVs permalink: /setup/envs parent: Setup +nav_order: 2 --- # Environment Variables @@ -191,3 +192,47 @@ A cron schedule expression for use in the [node-schedule npm library](https://ww #### `COMPOSITE_TILE_DIR_STORE_MAX_AGE_MS=` When using composited time tiles, MMGIS queries the tileset's folder for existing time folders. It caches the results of the these folder listings every COMPOSITE_TILE_DIR_STORE_MAX_AGE_MS milliseconds. Defaults to requerying every 30 minutes. If 0, no caching. If null or NaN, uses default. | number | default `1800000` + +## Adjacent Servers + +Enables and proxies to other self-hosted services. [Additional setup](/MMGIS/setup/adjacent-servers) may be required. + +#### `WITH_STAC=` + +STAC Catalogs - https://github.com/stac-utils/stac-fastapi-pgstac | default `false` + +#### `STAC_PORT=` + +Port to proxy stac on | default `8881` + +#### `WITH_TIPG=` + +TiTiler PG Vectors - https://github.com/developmentseed/tipg | default `false` + +#### `TIPG_PORT=` + +Port to ruproxyn tipg on | default `8882` + +#### `WITH_TITILER=` + +TiTiler - https://developmentseed.org/titiler | default `false` + +#### `TITILER_PORT=` + +Port to proxy titiler on | default `8883` + +#### `WITH_TITILER_PGSTAC=` + +TiTiler Mosaicking - https://github.com/stac-utils/titiler-pgstac | default `false` + +#### `TITILER_PGSTAC_PORT=` + +Port to proxy titiler-pgstac on | default `8884` + +#### `WITH_VELOSERVER=` + +Veloserver - Velocity and Wind Data Visualization Server - https://github.com/NASA-AMMOS/Veloserver | default `false` + +#### `VELOSERVER_PORT=` + +Port to proxy veloserver on | default `8885` diff --git a/sample.env b/sample.env index 7237b9d9..e637aff4 100644 --- a/sample.env +++ b/sample.env @@ -49,6 +49,9 @@ TITILER_PORT=8883 # TiTiler Mosaicking - https://github.com/stac-utils/titiler-pgstac WITH_TITILER_PGSTAC=true TITILER_PGSTAC_PORT=8884 +# Veloserver - Velocity and Wind Data Visualization Server - https://github.com/NASA-AMMOS/Veloserver +WITH_VELOSERVER=true +VELOSERVER_PORT=8885 # Sets the Content-Security-Policy: frame-ancestors header to allow the embedding in external sites. default null, ex: FRAME_ANCESTORS='["https://*.jpl.nasa.gov"]' FRAME_ANCESTORS=