Skip to content

Commit fc640a1

Browse files
author
Phil Varner
committed
update to python 3.10 and ES 8.x
1 parent cf2b567 commit fc640a1

File tree

11 files changed

+43
-84
lines changed

11 files changed

+43
-84
lines changed

.github/workflows/cicd.yml

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,15 @@ jobs:
1515

1616
services:
1717

18-
elasticsearch_7_svc:
19-
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.1
18+
elasticsearch_8_svc:
19+
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3
2020
env:
21-
node.name: es01
22-
cluster.name: stac-cluster
23-
discovery.type: single-node
24-
network.host: 0.0.0.0
25-
http.port: 9200
26-
ES_JAVA_OPTS: -Xms512m -Xmx512m
21+
ES_JAVA_OPTS: -Xms512m -Xmx1g
22+
volumes:
23+
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
2724
ports:
2825
- 9200:9200
2926

30-
# elasticsearch_8_svc:
31-
# image: docker.elastic.co/elasticsearch/elasticsearch:8.1.0
32-
# env:
33-
# node.name: es01
34-
# cluster.name: stac-cluster
35-
# discovery.type: single-node
36-
# network.host: 0.0.0.0
37-
# http.port: 9200
38-
# ES_JAVA_OPTS: -Xms512m -Xmx512m
39-
# ports:
40-
# - 9200:9200
41-
4227
steps:
4328
- name: Check out repository code
4429
uses: actions/checkout@v3
@@ -47,7 +32,7 @@ jobs:
4732
- name: Setup Python
4833
uses: actions/setup-python@v3
4934
with:
50-
python-version: "3.8"
35+
python-version: "3.10"
5136

5237
- name: Lint code
5338
uses: pre-commit/action@v2.0.3
@@ -60,24 +45,12 @@ jobs:
6045
run: |
6146
pip install ./stac_fastapi/elasticsearch[dev,server]
6247
63-
- name: Run test suite against Elasticsearch 7.x
48+
- name: Run test suite against Elasticsearch 8.x
6449
run: |
6550
cd stac_fastapi/elasticsearch && pipenv run pytest -svvv
6651
env:
6752
ENVIRONMENT: testing
68-
# ES_USER: dev
69-
# ES_PASS: stac
7053
ES_PORT: 9200
7154
ES_HOST: 172.17.0.1
7255
ES_USE_SSL: false
73-
ES_VERIFY_CERTS: false
74-
75-
# - name: Run test suite against Elasticsearch 8.x
76-
# run: |
77-
# cd stac_fastapi/elasticsearch && pipenv run pytest -svvv
78-
# env:
79-
# ENVIRONMENT: testing
80-
# ES_USER: dev
81-
# ES_PASS: stac
82-
# ES_PORT: 9400
83-
# ES_HOST: 172.17.0.1
56+
ES_VERIFY_CERTS: false

.pre-commit-config.yaml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,32 @@
11
repos:
22
- repo: https://github.com/PyCQA/isort
3-
rev: 5.8.0
3+
rev: 5.10.1
44
hooks:
55
- id: isort
6-
language_version: python3.8
76
- repo: https://github.com/psf/black
8-
rev: 20.8b1
7+
rev: 22.3.0
98
hooks:
109
- id: black
1110
args: [ '--safe' ]
12-
language_version: python3.8
1311
- repo: https://gitlab.com/pycqa/flake8
1412
rev: 3.9.0
1513
hooks:
1614
- id: flake8
17-
language_version: python3.8
1815
args: [
1916
# E501 let black handle all line length decisions
2017
# W503 black conflicts with "line break before operator" rule
2118
# E203 black conflicts with "whitespace before ':'" rule
2219
'--ignore=E501,W503,E203,C901' ]
23-
- repo: https://github.com/chewse/pre-commit-mirrors-pydocstyle
24-
# 2.1.1
25-
rev: v2.1.1
26-
hooks:
27-
- id: pydocstyle
28-
language_version: python3.8
29-
exclude: '.*(test|alembic|scripts).*'
30-
args: [
31-
# Check for docstring presence only
32-
'--select=D1',
33-
34-
]
35-
# Don't require docstrings for tests
36-
# '--match=(?!test).*\.py']
3720
# -
3821
# repo: https://github.com/pre-commit/mirrors-mypy
3922
# rev: v0.770
4023
# hooks:
4124
# - id: mypy
42-
# language_version: python3.8
4325
# args: [--no-strict-optional, --ignore-missing-imports]
4426
- repo: https://github.com/PyCQA/pydocstyle
45-
rev: 6.0.0
27+
rev: 6.1.1
4628
hooks:
4729
- id: pydocstyle
48-
language_version: python3.8
4930
exclude: '.*(test|alembic|scripts).*'
5031
#args: [
5132
# Don't require docstrings for tests

Dockerfile.deploy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8-slim
1+
FROM python:3.10-slim
22

33
RUN apt-get update && \
44
apt-get -y upgrade && \

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8-slim
1+
FROM python:3.10-slim
22

33

44
# update apt pkgs, and install build-essential for ciso8601

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ file named `.env` in the same directory you run docker-compose from:
4444
ELASTICSEARCH_VERSION=7.12.0
4545
```
4646

47-
TBD: how to run this with 8.x with a password enabled and TLS.
47+
### Generate a keystore and cert
48+
49+
```shell
50+
docker-compose -f docker-compose.setup.yml run --rm keystore
51+
docker-compose -f docker-compose.setup.yml run --rm certs
52+
```
53+
54+
4855

4956
To create a new Collection:
5057

docker-compose.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: '3.9'
22

33
services:
44
app-elasticsearch:
@@ -16,8 +16,6 @@ services:
1616
- WEB_CONCURRENCY=10
1717
- ES_HOST=172.17.0.1
1818
- ES_PORT=9200
19-
# - ES_USER=dev
20-
# - ES_PASS=stac
2119
- ES_USE_SSL=false
2220
- ES_VERIFY_CERTS=false
2321
ports:
@@ -33,13 +31,10 @@ services:
3331

3432
elasticsearch:
3533
container_name: es-container
36-
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.17.1}
34+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.1.3}
3735
environment:
38-
node.name: es01
39-
cluster.name: stac-cluster
40-
discovery.type: single-node
41-
network.host: 0.0.0.0
42-
http.port: 9200
4336
ES_JAVA_OPTS: -Xms512m -Xmx1g
37+
volumes:
38+
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
4439
ports:
4540
- "9200:9200"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Cluster Settings
2+
cluster.name: stac-cluster
3+
node.name: es01
4+
network.host: 0.0.0.0
5+
transport.host: 0.0.0.0
6+
discovery.type: single-node
7+
http.port: 9200
8+
9+
## License
10+
xpack.license.self_generated.type: basic
11+
12+
# Security
13+
xpack.security.enabled: false
14+
xpack.security.transport.ssl.enabled: false

stac_fastapi/elasticsearch/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"stac-fastapi.types==2.3.0",
1414
"stac-fastapi.api==2.3.0",
1515
"stac-fastapi.extensions==2.3.0",
16-
"fastapi-utils",
1716
"elasticsearch[async]==7.17.2",
1817
"elasticsearch-dsl==7.4.0",
1918
"pystac[validation]",
@@ -47,6 +46,8 @@
4746
"Intended Audience :: Information Technology",
4847
"Intended Audience :: Science/Research",
4948
"Programming Language :: Python :: 3.8",
49+
"Programming Language :: Python :: 3.9",
50+
"Programming Language :: Python :: 3.10",
5051
"License :: OSI Approved :: MIT License",
5152
],
5253
url="https://github.com/stac-utils/stac-fastapi-elasticsearch",

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Any, Dict, Set
44

55
from elasticsearch import AsyncElasticsearch, Elasticsearch
6-
76
from stac_fastapi.types.config import ApiSettings
87

98

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union
66

77
import attr
8-
import elasticsearch
9-
from elasticsearch import helpers
108
from elasticsearch_dsl import Q, Search
119
from geojson_pydantic.geometries import (
1210
GeometryCollection,
@@ -18,6 +16,8 @@
1816
Polygon,
1917
)
2018

19+
import elasticsearch
20+
from elasticsearch import helpers
2121
from stac_fastapi.elasticsearch import serializers
2222
from stac_fastapi.elasticsearch.config import AsyncElasticsearchSettings
2323
from stac_fastapi.elasticsearch.config import (

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/session.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
"""database session management."""
22
import logging
3-
from contextlib import contextmanager
43

54
import attr
6-
from fastapi_utils.session import FastAPISessionMaker as _FastAPISessionMaker
75

86
logger = logging.getLogger(__name__)
97

108

11-
class FastAPISessionMaker(_FastAPISessionMaker):
12-
"""FastAPISessionMaker."""
13-
14-
@contextmanager
15-
def context_session(self):
16-
"""Override base method to include exception handling."""
17-
...
18-
19-
209
@attr.s
2110
class Session:
2211
"""Database session management."""

0 commit comments

Comments
 (0)