Skip to content

Commit c31ae43

Browse files
author
Phil Varner
committed
Revert "update to python 3.10 and ES 8.x"
This reverts commit fc640a1.
1 parent fc640a1 commit c31ae43

File tree

11 files changed

+84
-43
lines changed

11 files changed

+84
-43
lines changed

.github/workflows/cicd.yml

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

1616
services:
1717

18-
elasticsearch_8_svc:
19-
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3
18+
elasticsearch_7_svc:
19+
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.1
2020
env:
21-
ES_JAVA_OPTS: -Xms512m -Xmx1g
22-
volumes:
23-
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
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
2427
ports:
2528
- 9200:9200
2629

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+
2742
steps:
2843
- name: Check out repository code
2944
uses: actions/checkout@v3
@@ -32,7 +47,7 @@ jobs:
3247
- name: Setup Python
3348
uses: actions/setup-python@v3
3449
with:
35-
python-version: "3.10"
50+
python-version: "3.8"
3651

3752
- name: Lint code
3853
uses: pre-commit/action@v2.0.3
@@ -45,12 +60,24 @@ jobs:
4560
run: |
4661
pip install ./stac_fastapi/elasticsearch[dev,server]
4762
48-
- name: Run test suite against Elasticsearch 8.x
63+
- name: Run test suite against Elasticsearch 7.x
4964
run: |
5065
cd stac_fastapi/elasticsearch && pipenv run pytest -svvv
5166
env:
5267
ENVIRONMENT: testing
68+
# ES_USER: dev
69+
# ES_PASS: stac
5370
ES_PORT: 9200
5471
ES_HOST: 172.17.0.1
5572
ES_USE_SSL: false
56-
ES_VERIFY_CERTS: 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

.pre-commit-config.yaml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,51 @@
11
repos:
22
- repo: https://github.com/PyCQA/isort
3-
rev: 5.10.1
3+
rev: 5.8.0
44
hooks:
55
- id: isort
6+
language_version: python3.8
67
- repo: https://github.com/psf/black
7-
rev: 22.3.0
8+
rev: 20.8b1
89
hooks:
910
- id: black
1011
args: [ '--safe' ]
12+
language_version: python3.8
1113
- repo: https://gitlab.com/pycqa/flake8
1214
rev: 3.9.0
1315
hooks:
1416
- id: flake8
17+
language_version: python3.8
1518
args: [
1619
# E501 let black handle all line length decisions
1720
# W503 black conflicts with "line break before operator" rule
1821
# E203 black conflicts with "whitespace before ':'" rule
1922
'--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']
2037
# -
2138
# repo: https://github.com/pre-commit/mirrors-mypy
2239
# rev: v0.770
2340
# hooks:
2441
# - id: mypy
42+
# language_version: python3.8
2543
# args: [--no-strict-optional, --ignore-missing-imports]
2644
- repo: https://github.com/PyCQA/pydocstyle
27-
rev: 6.1.1
45+
rev: 6.0.0
2846
hooks:
2947
- id: pydocstyle
48+
language_version: python3.8
3049
exclude: '.*(test|alembic|scripts).*'
3150
#args: [
3251
# 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.10-slim
1+
FROM python:3.8-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.10-slim
1+
FROM python:3.8-slim
22

33

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

README.md

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

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-
47+
TBD: how to run this with 8.x with a password enabled and TLS.
5548

5649
To create a new Collection:
5750

docker-compose.yml

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

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

3234
elasticsearch:
3335
container_name: es-container
34-
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-8.1.3}
36+
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.17.1}
3537
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
3643
ES_JAVA_OPTS: -Xms512m -Xmx1g
37-
volumes:
38-
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
3944
ports:
4045
- "9200:9200"

elasticsearch/config/elasticsearch.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

stac_fastapi/elasticsearch/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"stac-fastapi.types==2.3.0",
1414
"stac-fastapi.api==2.3.0",
1515
"stac-fastapi.extensions==2.3.0",
16+
"fastapi-utils",
1617
"elasticsearch[async]==7.17.2",
1718
"elasticsearch-dsl==7.4.0",
1819
"pystac[validation]",
@@ -46,8 +47,6 @@
4647
"Intended Audience :: Information Technology",
4748
"Intended Audience :: Science/Research",
4849
"Programming Language :: Python :: 3.8",
49-
"Programming Language :: Python :: 3.9",
50-
"Programming Language :: Python :: 3.10",
5150
"License :: OSI Approved :: MIT License",
5251
],
5352
url="https://github.com/stac-utils/stac-fastapi-elasticsearch",

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/config.py

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

55
from elasticsearch import AsyncElasticsearch, Elasticsearch
6+
67
from stac_fastapi.types.config import ApiSettings
78

89

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

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

77
import attr
8+
import elasticsearch
9+
from elasticsearch import helpers
810
from elasticsearch_dsl import Q, Search
911
from geojson_pydantic.geometries import (
1012
GeometryCollection,
@@ -16,8 +18,6 @@
1618
Polygon,
1719
)
1820

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
"""database session management."""
22
import logging
3+
from contextlib import contextmanager
34

45
import attr
6+
from fastapi_utils.session import FastAPISessionMaker as _FastAPISessionMaker
57

68
logger = logging.getLogger(__name__)
79

810

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+
920
@attr.s
1021
class Session:
1122
"""Database session management."""

0 commit comments

Comments
 (0)