Skip to content

Commit

Permalink
feat: stac-server
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Apr 29, 2024
1 parent 9aa3652 commit 48ca5fd
Show file tree
Hide file tree
Showing 36 changed files with 14,414 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ updates:
directory: "/stac"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/pgstac"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/stac-api"
schedule:
Expand All @@ -20,6 +24,10 @@ updates:
directory: "/stac-cli"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/stac-server"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/stac-validate"
schedule:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
- "-p stac -p stac-api -F geo"
- "-p stac-async"
- "-p stac-cli --no-default-features"
- "-p stac-server --no-default-features"
- "-p stac-server --no-default-features axum"
- "-p stac-server --no-default-features memory-item-search"
- "-p stac-server"
- "-p stac-validate"
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -115,3 +119,45 @@ jobs:
sudo apt-get install libgdal-dev
- name: Doc
run: cargo doc --all-features
validate-stac-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install stac-api-validator
run: pip install -r scripts/requirements.txt
- name: Validate
run: scripts/validate-stac-server
validate-stac-server-pgstac:
runs-on: ubuntu-latest
services:
pgstac:
image: ghcr.io/stac-utils/pgstac:v0.8.5
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: postgis
PGUSER: username
PGPASSWORD: password
PGDATABASE: postgis
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install stac-api-validator
run: pip install -r scripts/requirements.txt
- name: Validate
run: scripts/validate-stac-server --pgstac
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ members = [
"stac-api",
"stac-async",
"stac-cli",
"stac-server",
"stac-validate",
]
default-members = [
"stac",
"stac-api",
"stac-async",
"stac-cli",
"stac-server",
"stac-validate",
]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Command Line Interface (CLI) and Rust libraries for the [SpatioTemporal Asset Ca
- Use [stac-cli](./stac-cli/README.md) to query a STAC API, create and validate STAC items, and do other awesome stuff on the command line.
- Use the core [stac](./stac/README.md) library to incorporate STAC data structures (`Item`, `Catalog`, and `Collection`) in another Rust application.
- Use [stac-async](./stac-async/README.md) to build an application that uses async Rust via [tokio](https://tokio.rs/).
- Use [stac-server](./stac-server/README.md) to serve a STAC API

## Crates

Expand All @@ -18,10 +19,11 @@ This monorepo contains several crates:
| ----- | ---- | --------- |
| [stac](./stac/README.md) | Core data structures and synchronous I/O | [![docs.rs](https://img.shields.io/docsrs/stac?style=flat-square)](https://docs.rs/stac/latest/stac/) <br> [![Crates.io](https://img.shields.io/crates/v/stac?style=flat-square)](https://crates.io/crates/stac) |
| [pgstac](./pgstac/README.md) | Bindings for [pgstac](https://github.com/stac-utils/pgstac) | [![docs.rs](https://img.shields.io/docsrs/pgstac?style=flat-square)](https://docs.rs/pgstac/latest/pgstac/) <br> [![Crates.io](https://img.shields.io/crates/v/pgstac?style=flat-square)](https://crates.io/crates/pgstac) |
| [stac-validate](./stac-validate/README.md) | Validate STAC data structures with [jsonschema](https://json-schema.org/) | [![docs.rs](https://img.shields.io/docsrs/stac-validate?style=flat-square)](https://docs.rs/stac-validate/latest/stac-validate/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-validate?style=flat-square)](https://crates.io/crates/stac-validate) |
| [stac-api](./stac-api/README.md) | Data structures for the [STAC API](https://github.com/radiantearth/stac-api-spec) specification | [![docs.rs](https://img.shields.io/docsrs/stac-api?style=flat-square)](https://docs.rs/stac-api/latest/stac_api/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-api?style=flat-square)](https://crates.io/crates/stac-api) |
| [stac-async](./stac-async/README.md) | Asynchronous I/O with [tokio](https://tokio.rs/) | [![docs.rs](https://img.shields.io/docsrs/stac-async?style=flat-square)](https://docs.rs/stac-async/latest/stac_async/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-async?style=flat-square)](https://crates.io/crates/stac-async) |
| [stac-cli](./stac-cli/README.md)| Command line interface | [![docs.rs](https://img.shields.io/docsrs/stac-cli?style=flat-square)](https://docs.rs/stac-cli/latest/stac_cli/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-cli?style=flat-square)](https://crates.io/crates/stac-cli) |
| [stac-server](./stac-server/README.md)| STAC API server with multiple backends | [![docs.rs](https://img.shields.io/docsrs/stac-server?style=flat-square)](https://docs.rs/stac-server/latest/stac_server/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-server?style=flat-square)](https://crates.io/crates/stac-server) |
| [stac-validate](./stac-validate/README.md) | Validate STAC data structures with [jsonschema](https://json-schema.org/) | [![docs.rs](https://img.shields.io/docsrs/stac-validate?style=flat-square)](https://docs.rs/stac-validate/latest/stac-validate/) <br> [![Crates.io](https://img.shields.io/crates/v/stac-validate?style=flat-square)](https://crates.io/crates/stac-validate) |

## Development

Expand Down
1 change: 1 addition & 0 deletions scripts/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stac-api-validator @ git+https://github.com/stac-utils/stac-api-validator@24dd3f27174e5c85f28a44c84ad584a2d344e6cc
80 changes: 80 additions & 0 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This file was autogenerated by uv via the following command:
# uv pip compile scripts/requirements.in
attrs==23.2.0
# via
# jsonschema
# referencing
certifi==2024.2.2
# via
# requests
# stac-api-validator
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via
# stac-api-validator
# stac-check
# stac-validator
deepdiff==6.7.1
# via stac-api-validator
idna==3.7
# via requests
jsonschema==4.21.1
# via
# pystac
# stac-api-validator
# stac-check
# stac-validator
jsonschema-specifications==2023.12.1
# via jsonschema
more-itertools==8.14.0
# via stac-api-validator
numpy==1.26.4
# via shapely
ordered-set==4.1.0
# via deepdiff
orjson==3.10.1
# via pystac
pystac==1.10.0
# via
# pystac-client
# stac-api-validator
pystac-client==0.7.7
# via stac-api-validator
python-dateutil==2.9.0.post0
# via
# pystac
# pystac-client
python-dotenv==1.0.1
# via stac-check
pyyaml==6.0.1
# via
# stac-api-validator
# stac-check
referencing==0.35.0
# via
# jsonschema
# jsonschema-specifications
requests==2.31.0
# via
# pystac-client
# stac-api-validator
# stac-check
# stac-validator
rpds-py==0.18.0
# via
# jsonschema
# referencing
shapely==2.0.4
# via stac-api-validator
six==1.16.0
# via python-dateutil
stac-api-validator @ git+https://github.com/stac-utils/stac-api-validator@24dd3f27174e5c85f28a44c84ad584a2d344e6cc
stac-check==1.3.3
# via stac-api-validator
stac-validator==3.3.2
# via
# stac-api-validator
# stac-check
urllib3==2.2.1
# via requests
34 changes: 34 additions & 0 deletions scripts/validate-stac-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env sh

set -e

args="stac-server/data/sentinel-2/*"
build_args="--no-default-features"

if [ $# -eq 1 ]; then
if [ "$1" = "--pgstac" ]; then
args="$args --pgstac postgres://username:password@localhost/postgis"
build_args="$build_args -F pgstac"
else
echo "Unknown argument: $1"
exit 1
fi
fi

cargo build -p stac-cli $build_args
cargo run $build_args -- serve $args &
server_pid=$!
echo "server_pid=$server_pid"
set +e
scripts/wait-for-it.sh localhost:7822 && \
stac-api-validator \
--root-url http://localhost:7822 \
--conformance core \
--conformance features \
--conformance item-search \
--collection sentinel-2-c1-l2a \
--geometry '{"type":"Point","coordinates":[-105.07,40.08]}'
status=$?
set -e
kill $server_pid
exit $status
Loading

0 comments on commit 48ca5fd

Please sign in to comment.