Skip to content

Commit

Permalink
Fix veda_auth package, use it in stac and ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
slesaad committed Jul 24, 2024
1 parent 16e56c0 commit 2afe9c4
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 19 deletions.
7 changes: 3 additions & 4 deletions common/auth/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
inst_reqs = [
"cryptography>=42.0.5",
"pyjwt>=2.8.0",
"fastapi",
"fastapi>=0.111.1"
]

print(find_packages())
setup(
name="vedaAuth",
name="veda_auth",
version="0.0.1",
description="",
python_requires=">=3.7",
packages=['src'],
packages=find_packages(),
zip_safe=False,
install_requires=inst_reqs,
include_package_data=True,
Expand Down
5 changes: 0 additions & 5 deletions common/auth/src/__init__.py

This file was deleted.

4 changes: 4 additions & 0 deletions common/auth/veda_auth/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'''
VEDA cognito auth
'''
from veda_auth.main import VedaAuth
File renamed without changes.
4 changes: 3 additions & 1 deletion ingest_api/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ RUN pip install -r /tmp/ingestor/requirements.txt -t /asset --no-binary pydantic
RUN rm -rf /tmp/ingestor
# TODO this is temporary until we use a real packaging system like setup.py or poetry
COPY ingest_api/runtime/src /asset/src
COPY common /asset/common

COPY common/auth /tmp/stac/common/auth
RUN pip install /tmp/stac/common/auth -t /asset

# # Reduce package size and remove useless files
RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[2-3][0-9]//'); cp $f $n; done;
Expand Down
4 changes: 2 additions & 2 deletions ingest_api/runtime/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import AnyHttpUrl, BaseSettings, Field, constr
from pydantic_ssm_settings import AwsSsmSourceConfig

from common.auth import Auth
from veda_auth import VedaAuth

AwsArn = constr(regex=r"^arn:aws:iam::\d{12}:role/.+")

Expand Down Expand Up @@ -66,4 +66,4 @@ def from_ssm(cls, stack: str):
)
)

auth = Auth(settings)
auth = VedaAuth(settings)
3 changes: 2 additions & 1 deletion local/Dockerfile.ingest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ RUN pip install -r /tmp/ingestor/requirements.txt --no-binary pydantic uvicorn
RUN rm -rf /tmp/ingestor
# TODO this is temporary until we use a real packaging system like setup.py or poetry
COPY ingest_api/runtime/src /asset/src
COPY common /asset/common
COPY common/auth /tmp/stac/common/auth
RUN pip install /tmp/stac/common/auth

# # Reduce package size and remove useless files
RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[2-3][0-9]//'); cp $f $n; done;
Expand Down
4 changes: 3 additions & 1 deletion local/Dockerfile.stac
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
RUN pip install boto3

COPY stac_api/runtime /tmp/stac
COPY common /tmp/stac/common

COPY common/auth /tmp/stac/common/auth
RUN pip install /tmp/stac/common/auth
RUN pip install /tmp/stac
RUN rm -rf /tmp/stac

Expand Down
3 changes: 2 additions & 1 deletion stac_api/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM --platform=linux/amd64 public.ecr.aws/sam/build-python3.9:latest
WORKDIR /tmp

COPY stac_api/runtime /tmp/stac
COPY common /tmp/stac/common
COPY common/auth /tmp/stac/common/auth
RUN pip install /tmp/stac/common/auth -t /asset
RUN pip install "mangum>=0.14,<0.15" "plpygis>=0.2.1" /tmp/stac -t /asset --no-binary pydantic
RUN rm -rf /tmp/stac

Expand Down
2 changes: 0 additions & 2 deletions stac_api/runtime/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
"pygeoif<=0.8", # newest release (1.0+ / 09-22-2022) breaks a number of other geo libs
"aws-lambda-powertools>=1.18.0",
"aws_xray_sdk>=2.6.0,<3",
"cryptography>=42.0.5",
"pyjwt>=2.8.0",
"pystac[validation]==1.10.1"
]

Expand Down
4 changes: 2 additions & 2 deletions stac_api/runtime/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from src.config import post_request_model as POSTModel
from src.extension import TiTilerExtension

from common.auth import Auth
from veda_auth import VedaAuth
from fastapi import APIRouter, FastAPI
from fastapi.params import Depends
from fastapi.responses import ORJSONResponse
Expand Down Expand Up @@ -37,7 +37,7 @@

tiles_settings = TilesApiSettings()

auth = Auth(api_settings)
auth = VedaAuth(api_settings)

api = VedaStacApi(
app=FastAPI(
Expand Down

0 comments on commit 2afe9c4

Please sign in to comment.