-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add mosaic search + other updates #36
Changes from all commits
968d067
1c7b380
558724c
a88a488
2fa23a3
5d5b96f
3795019
07dd7c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ class Config: | |
"""model config""" | ||
|
||
env_file = "deployment/.env" | ||
env_prefix = "EOAPI_" | ||
env_prefix = "CDK_EOAPI_" | ||
use_enum_values = True | ||
|
||
|
||
|
@@ -45,7 +45,7 @@ class Config: | |
"""model config""" | ||
|
||
env_file = "deployment/.env" | ||
env_prefix = "EOAPI_DB_" | ||
env_prefix = "CDK_EOAPI_DB_" | ||
|
||
|
||
class eoSTACSettings(pydantic.BaseSettings): | ||
|
@@ -60,7 +60,7 @@ class Config: | |
"""model config""" | ||
|
||
env_file = "deployment/.env" | ||
env_prefix = "EOAPI_STAC_" | ||
env_prefix = "CDK_EOAPI_STAC_" | ||
|
||
|
||
class eoRasterSettings(pydantic.BaseSettings): | ||
|
@@ -73,6 +73,7 @@ class eoRasterSettings(pydantic.BaseSettings): | |
"CPL_VSIL_CURL_ALLOWED_EXTENSIONS": ".tif,.TIF,.tiff", | ||
"GDAL_CACHEMAX": "200", # 200 mb | ||
"GDAL_DISABLE_READDIR_ON_OPEN": "EMPTY_DIR", | ||
"GDAL_INGESTED_BYTES_AT_OPEN": "32768", | ||
"GDAL_HTTP_MERGE_CONSECUTIVE_RANGES": "YES", | ||
"GDAL_HTTP_MULTIPLEX": "YES", | ||
"GDAL_HTTP_VERSION": "2", | ||
|
@@ -99,7 +100,7 @@ class Config: | |
"""model config""" | ||
|
||
env_file = "deployment/.env" | ||
env_prefix = "EOAPI_RASTER_" | ||
env_prefix = "CDK_EOAPI_RASTER_" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to avoid confusion between |
||
|
||
|
||
class eoVectorSettings(pydantic.BaseSettings): | ||
|
@@ -114,7 +115,7 @@ class Config: | |
"""model config""" | ||
|
||
env_file = "deployment/.env" | ||
env_prefix = "EOAPI_VECTOR_" | ||
env_prefix = "CDK_EOAPI_VECTOR_" | ||
|
||
|
||
class eoFeaturesSettings(pydantic.BaseSettings): | ||
|
@@ -129,4 +130,4 @@ class Config: | |
"""model config""" | ||
|
||
env_file = "deployment/.env" | ||
env_prefix = "EOAPI_FEATURES_" | ||
env_prefix = "CDK_EOAPI_FEATURES_" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,15 +190,28 @@ def handler(event, context): | |
register_extensions(cursor=cur) | ||
|
||
dsn = "postgresql://{user}:{password}@{host}:{port}/{dbname}".format( | ||
dbname=user_params.get("dbname", "postgres"), | ||
dbname=user_params["dbname"], | ||
user=user_params["username"], | ||
password=user_params["password"], | ||
host=connection_params["host"], | ||
port=connection_params["port"], | ||
) | ||
|
||
print("Running to PgSTAC migration...") | ||
asyncio.run(run_migration(dsn)) | ||
|
||
print("Adding mosaic index...") | ||
with psycopg.connect( | ||
dsn, | ||
autocommit=True, | ||
options="-c search_path=pgstac,public -c application_name=pgstac", | ||
) as conn: | ||
conn.execute( | ||
sql.SQL( | ||
"CREATE INDEX IF NOT EXISTS searches_mosaic ON searches ((true)) WHERE metadata->>'type'='mosaic';" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default we create an index on search There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's ok to have this here for now, but I think that it would be good to just include this index in pgstac itself and get rid of this in the future as this will add a bit of latency every time you connect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is only used when we create the database! |
||
) | ||
) | ||
|
||
except Exception as e: | ||
print(e) | ||
return send(event, context, "FAILED", {"message": str(e)}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,8 @@ services: | |
# AWS S3 endpoint config | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
# API Config | ||
- EOAPI_RASTER_ENABLE_MOSAIC_SEARCH=TRUE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
depends_on: | ||
- database | ||
command: | ||
|
@@ -155,7 +157,7 @@ services: | |
database: | ||
container_name: eoapi.db | ||
platform: linux/amd64 | ||
image: ghcr.io/stac-utils/pgstac:v0.4.3 | ||
image: ghcr.io/stac-utils/pgstac:v0.4.5 | ||
environment: | ||
- POSTGRES_USER=username | ||
- POSTGRES_PASSWORD=password | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a reasonable default value