-
Notifications
You must be signed in to change notification settings - Fork 24
Adding route dependencies module. #251
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
Merged
Merged
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
5ee3c2d
Adding route dependencies module.
rhysrevans3 10d621e
Fixing pre-commit errors.
rhysrevans3 bb04359
Merge branch 'main' into route_dependencies
jonhealy1 c2c12bd
Adding to opensearch.
rhysrevans3 7b8ef5a
Adding testing.
rhysrevans3 aedf077
Merge branch 'main' into route_dependencies
jonhealy1 6a36f6b
Allow route dependencies to be passed as a variable for testing.
rhysrevans3 19b97f6
Merge branch 'route_dependencies' of github.com:rhysrevans3/stac-fast…
rhysrevans3 211d04d
Removing context extension.
rhysrevans3 8c14390
Allowing fuctions or class dependencies.
rhysrevans3 4b90d15
Updating test conf.
rhysrevans3 6891357
Fix for import error.
rhysrevans3 d718601
Add test directory to sys path for import.
rhysrevans3 a1d3929
Fix for sys path import.
rhysrevans3 65d367c
Add test dir to sys path.
rhysrevans3 53f17f8
Switching tests to use collections endpoint for rd tests.
rhysrevans3 51de3bf
Switch from post to get on test_authenticated.
rhysrevans3 ffd3912
Removing unneeded length check.
rhysrevans3 bde4b3c
Adding docker compose file and readme help for route dependencies.
rhysrevans3 bd29dcd
Merge branch 'main' of github.com:stac-utils/stac-fastapi-elasticsear…
rhysrevans3 cc1a30e
Adding to changelog.
rhysrevans3 caa45dd
Merge branch 'main' into route_dependencies
jonhealy1 fb931bc
Moving basic auth to route dependencies.
rhysrevans3 c08d25c
Merge branch 'route_dependencies' of github.com:rhysrevans3/stac-fast…
rhysrevans3 b689275
Removing basic_auth copy.
rhysrevans3 370b401
Adding route that aren't lists.
rhysrevans3 6a7308e
Adding schema validation to route dependencies.
rhysrevans3 a88f04c
pre-commit.
rhysrevans3 b5231f4
Merge branch 'main' of github.com:stac-utils/stac-fastapi-elasticsear…
rhysrevans3 deba511
Adding jsonschema install.
rhysrevans3 e9bba36
Fixing schema.
rhysrevans3 87a2294
Add docker file example for route_dependencies.json.
rhysrevans3 9617d39
Merge branch 'main' of github.com:stac-utils/stac-fastapi-elasticsear…
rhysrevans3 01b0af5
Adding Oauth2 example.
rhysrevans3 f9314d9
Updating changelog and opensearch auth in compose files.
rhysrevans3 4ab9d48
Update CHANGELOG.md
jonhealy1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
version: '3.9' | ||
|
||
services: | ||
app-elasticsearch: | ||
container_name: stac-fastapi-es | ||
image: stac-utils/stac-fastapi-es | ||
restart: always | ||
build: | ||
context: . | ||
dockerfile: dockerfiles/Dockerfile.dev.es | ||
environment: | ||
- STAC_FASTAPI_TITLE=stac-fastapi-elasticsearch | ||
- STAC_FASTAPI_DESCRIPTION=A STAC FastAPI with an Elasticsearch backend | ||
- STAC_FASTAPI_VERSION=3.0.0a1 | ||
- APP_HOST=0.0.0.0 | ||
- APP_PORT=8080 | ||
- RELOAD=true | ||
- ENVIRONMENT=local | ||
- WEB_CONCURRENCY=10 | ||
- ES_HOST=elasticsearch | ||
- ES_PORT=9200 | ||
- ES_USE_SSL=false | ||
- ES_VERIFY_CERTS=false | ||
- BACKEND=elasticsearch | ||
- STAC_FASTAPI_ROUTE_DEPENDENCIES=/app/route_dependencies/route_dependencies.json | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- ./stac_fastapi:/app/stac_fastapi | ||
- ./examples/route_dependencies:/app/route_dependencies | ||
- ./scripts:/app/scripts | ||
- ./esdata:/usr/share/elasticsearch/data | ||
depends_on: | ||
- elasticsearch | ||
command: | ||
bash -c "./scripts/wait-for-it-es.sh es-container:9200 && python -m stac_fastapi.elasticsearch.app" | ||
|
||
app-opensearch: | ||
container_name: stac-fastapi-os | ||
image: stac-utils/stac-fastapi-os | ||
restart: always | ||
build: | ||
context: . | ||
dockerfile: dockerfiles/Dockerfile.dev.os | ||
environment: | ||
- STAC_FASTAPI_TITLE=stac-fastapi-opensearch | ||
- STAC_FASTAPI_DESCRIPTION=A STAC FastAPI with an Opensearch backend | ||
- STAC_FASTAPI_VERSION=2.1 | ||
- APP_HOST=0.0.0.0 | ||
- APP_PORT=8082 | ||
- RELOAD=true | ||
- ENVIRONMENT=local | ||
- WEB_CONCURRENCY=10 | ||
- ES_HOST=opensearch | ||
- ES_PORT=9202 | ||
- ES_USE_SSL=false | ||
- ES_VERIFY_CERTS=false | ||
- BACKEND=opensearch | ||
- BASIC_AUTH={"users":[{"username":"admin","password":"admin","permissions":"*"},{"username":"reader","password":"reader","permissions":[{"path":"/","method":["GET"]},{"path":"/conformance","method":["GET"]},{"path":"/collections/{collection_id}/items/{item_id}","method":["GET"]},{"path":"/search","method":["GET","POST"]},{"path":"/collections","method":["GET"]},{"path":"/collections/{collection_id}","method":["GET"]},{"path":"/collections/{collection_id}/items","method":["GET"]},{"path":"/queryables","method":["GET"]},{"path":"/queryables/collections/{collection_id}/queryables","method":["GET"]},{"path":"/_mgmt/ping","method":["GET"]}]}]} | ||
rhysrevans3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ports: | ||
- "8082:8082" | ||
volumes: | ||
- ./stac_fastapi:/app/stac_fastapi | ||
- ./scripts:/app/scripts | ||
- ./osdata:/usr/share/opensearch/data | ||
depends_on: | ||
- opensearch | ||
command: | ||
bash -c "./scripts/wait-for-it-es.sh os-container:9202 && python -m stac_fastapi.opensearch.app" | ||
|
||
elasticsearch: | ||
container_name: es-container | ||
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.11.0} | ||
hostname: elasticsearch | ||
environment: | ||
ES_JAVA_OPTS: -Xms512m -Xmx1g | ||
volumes: | ||
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml | ||
- ./elasticsearch/snapshots:/usr/share/elasticsearch/snapshots | ||
ports: | ||
- "9200:9200" | ||
|
||
opensearch: | ||
container_name: os-container | ||
image: opensearchproject/opensearch:${OPENSEARCH_VERSION:-2.11.1} | ||
hostname: opensearch | ||
environment: | ||
- discovery.type=single-node | ||
- plugins.security.disabled=true | ||
- OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m | ||
volumes: | ||
- ./opensearch/config/opensearch.yml:/usr/share/opensearch/config/opensearch.yml | ||
- ./opensearch/snapshots:/usr/share/opensearch/snapshots | ||
ports: | ||
- "9202:9202" | ||
|
||
postgres: | ||
image: postgres:15 | ||
container_name: postgres | ||
hostname: keycloakdb | ||
environment: | ||
- POSTGRES_DB=keycloak | ||
- POSTGRES_USER=keycloak | ||
- POSTGRES_PASSWORD=password | ||
volumes: | ||
- postgres:/var/lib/postgresql/data | ||
|
||
keycloak: | ||
jonhealy1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
image: quay.io/keycloak/keycloak:25.0.0 | ||
container_name: keycloak | ||
ports: | ||
- 8083:8083 | ||
environment: | ||
- KEYCLOAK_IMPORT=/tmp/keycloak-realm.json | ||
- KEYCLOAK_ADMIN=admin | ||
- KEYCLOAK_ADMIN_PASSWORD=admin | ||
- KC_HTTP_PORT=8083 | ||
- KC_DB=postgres | ||
- KC_DB_URL=jdbc:postgresql://keycloakdb:5432/keycloak | ||
- KC_DB_USERNAME=keycloak | ||
- KC_DB_PASSWORD=password | ||
volumes: | ||
- ./example/route_dependencies/stac-realm.json:/opt/keycloak/data/import | ||
command: start-dev --import-realm | ||
depends_on: | ||
- postgres | ||
|
||
volumes: | ||
postgres: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[ | ||
{ | ||
"routes": [ | ||
{ | ||
"method": "*", | ||
"path": "*" | ||
} | ||
], | ||
"dependencies": [ | ||
{ | ||
"method": "fastapi.security.OAuth2PasswordBearer", | ||
"kwargs": { | ||
"tokenUrl": "http://keycloak:8083/auth/realms/stac/protocol/openid-connect/token" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"routes": [ | ||
{ | ||
"path": "/collections/{collection_id}/items/{item_id}", | ||
"method": "GET" | ||
}, | ||
{ | ||
"path": "/search", | ||
"method": [ | ||
"GET", | ||
"POST" | ||
] | ||
}, | ||
{ | ||
"path": "/collections", | ||
"method": "GET" | ||
} | ||
], | ||
"dependencies": [ | ||
{ | ||
"method": "stac_fastapi.core.basic_auth.BasicAuth", | ||
"kwargs": { | ||
"credentials": [ | ||
{ | ||
"username": "reader", | ||
"password": "reader" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.