Skip to content

Commit b360423

Browse files
committed
first pass
1 parent be114d9 commit b360423

File tree

6 files changed

+164
-0
lines changed

6 files changed

+164
-0
lines changed

Dockerfile.docs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM python:3.8-slim
2+
3+
# build-essential is required to build a wheel for ciso8601
4+
RUN apt update && apt install -y build-essential
5+
6+
RUN python -m pip install --upgrade pip
7+
RUN python -m pip install mkdocs mkdocs-material pdocs
8+
9+
COPY . /opt/src
10+
11+
WORKDIR /opt/src
12+
13+
RUN python -m pip install \
14+
stac_fastapi/api \
15+
stac_fastapi/types \
16+
stac_fastapi/elasticsearch
17+
18+
CMD ["pdocs", \
19+
"as_markdown", \
20+
"--output_dir", \
21+
"docs/elasticsearch/", \
22+
"--exclude_source", \
23+
"--overwrite", \
24+
"stac_fastapi.elasticsearch"]

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,13 @@ install-es: pybase-install
104104
.PHONY: install-os
105105
install-os: pybase-install
106106
pip install -e ./stac_fastapi/opensearch[dev,server]
107+
108+
.PHONY: docs-image
109+
docs-image:
110+
docker-compose -f docker-compose.docs.yml \
111+
build
112+
113+
.PHONY: docs
114+
docs: docs-image
115+
docker-compose -f docker-compose.docs.yml \
116+
run docs

docker-compose.docs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
3+
services:
4+
docs:
5+
container_name: stac-fastapi-docs-dev
6+
build:
7+
context: .
8+
dockerfile: Dockerfile.docs
9+
platform: linux/amd64
10+
environment:
11+
- POSTGRES_USER=username
12+
- POSTGRES_PASS=password
13+
- POSTGRES_DBNAME=postgis
14+
- POSTGRES_HOST_READER=database
15+
- POSTGRES_HOST_WRITER=database
16+
- POSTGRES_PORT=5432
17+
volumes:
18+
- .:/opt/src

docs/mkdocs.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
site_name: stac-fastapi-elasticsearch-opensearch
2+
site_description: STAC FastAPI.
3+
4+
# Repository
5+
repo_name: "stac-utils/stac-fastapi-elasticsearch-opensearch"
6+
repo_url: "https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch"
7+
edit_uri: "blob/main/docs/src/"
8+
9+
docs_dir: 'src'
10+
site_dir: 'build'
11+
12+
# Social links
13+
extra:
14+
social:
15+
- icon: "fontawesome/brands/github"
16+
link: "https://github.com/stac-utils"
17+
18+
# Layout
19+
nav:
20+
- Home: "index.md"
21+
- Tips and Tricks: tips-and-tricks.md
22+
- ELASTICSEARCH:
23+
- packages: elasticsearch/stac_fastapi/index.md
24+
- stac_fastapi.elasticsearch:
25+
- module: elasticsearch/stac_fastapi/elasticsearch/index.md
26+
- app: elasticsearch/stac_fastapi/elasticsearch/app.md
27+
- config: elasticsearch/stac_fastapi/elasticsearch/config.md
28+
- database_logic: elasticsearch/stac_fastapi/elasticsearch/database_logic.md
29+
- version: elasticsearch/stac_fastapi/elasticsearch/version.md
30+
- Development - Contributing: "contributing.md"
31+
- Release Notes: "release-notes.md"
32+
33+
plugins:
34+
- search
35+
36+
# Theme
37+
theme:
38+
icon:
39+
logo: "material/home"
40+
repo: "fontawesome/brands/github"
41+
name: "material"
42+
language: "en"
43+
font:
44+
text: "Nunito Sans"
45+
code: "Fira Code"
46+
47+
extra_css:
48+
- stylesheets/extra.css
49+
50+
# These extensions are chosen to be a superset of Pandoc's Markdown.
51+
# This way, I can write in Pandoc's Markdown and have it be supported here.
52+
# https://pandoc.org/MANUAL.html
53+
markdown_extensions:
54+
- admonition
55+
- attr_list
56+
- codehilite:
57+
guess_lang: false
58+
- def_list
59+
- footnotes
60+
- pymdownx.arithmatex
61+
- pymdownx.betterem
62+
- pymdownx.caret:
63+
insert: false
64+
- pymdownx.details
65+
- pymdownx.emoji
66+
- pymdownx.escapeall:
67+
hardbreak: true
68+
nbsp: true
69+
- pymdownx.magiclink:
70+
hide_protocol: true
71+
repo_url_shortener: true
72+
- pymdownx.smartsymbols
73+
- pymdownx.superfences
74+
- pymdownx.tasklist:
75+
custom_checkbox: true
76+
- pymdownx.tilde
77+
- toc:
78+
permalink: true

docs/src/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../CHANGELOG.md

docs/src/tips-and-tricks.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Tips and Tricks
2+
3+
This page contains a few 'tips and tricks' for getting **stac-fastapi** working in various situations.
4+
5+
## Get stac-fastapi working with CORS
6+
7+
CORS (Cross-Origin Resource Sharing) support may be required to use stac-fastapi in certain situations.
8+
For example, if you are running [stac-browser](https://github.com/radiantearth/stac-browser) to browse the STAC catalog created by **stac-fastapi**, then you will need to enable CORS support.
9+
To do this, edit your backend's `app.py` and add the following import:
10+
11+
```python
12+
from fastapi.middleware.cors import CORSMiddleware
13+
```
14+
15+
and then edit the `api = StacApi(...` call to add the following parameter:
16+
17+
```python
18+
middlewares=[lambda app: CORSMiddleware(app, allow_origins=["*"])]
19+
```
20+
21+
If needed, you can edit the `allow_origins` parameter to only allow CORS requests from specific origins.
22+
23+
## Enable the Context extension
24+
25+
The Context STAC extension provides information on the number of items matched and returned from a STAC search.
26+
This is required by various other STAC-related tools, such as the pystac command-line client.
27+
To enable the extension, edit your backend's `app.py` and add the following import:
28+
29+
```python
30+
from stac_fastapi.extensions.core.context import ContextExtension
31+
```
32+
33+
and then edit the `api = StacApi(...` call to add `ContextExtension()` to the list given as the `extensions` parameter.

0 commit comments

Comments
 (0)