-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* replace yapf with black & flake8 * fix tests with newer valhalla:latest image * update dependencies * jeez.. weird bug in flask-restx, needed to install stuff from git * edit the action workflow
- Loading branch information
Showing
45 changed files
with
1,548 additions
and
1,485 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,11 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-yapf | ||
rev: v0.30.0 # Use the sha / tag you want to point at | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: yapf | ||
- id: black | ||
language_version: python3 | ||
args: [routing_packager_app, tests] | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 4.0.1 # pick a git hash / tag to point to | ||
hooks: | ||
- id: flake8 |
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#--- BEGIN Usual Python stuff --- | ||
FROM python:3.9-slim-buster | ||
FROM python:3.10-slim-bullseye | ||
LABEL [email protected] | ||
|
||
# Install poetry | ||
|
@@ -21,14 +21,17 @@ RUN apt-get update -y > /dev/null && \ | |
RUN apt-get update -y > /dev/null && \ | ||
apt-get install -y --fix-missing \ | ||
software-properties-common \ | ||
gnupg-agent \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
lsb-release \ | ||
nano \ | ||
jq \ | ||
cron -o APT::Immediate-Configure=0 > /dev/null && \ | ||
# install docker & osmium | ||
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \ | ||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \ | ||
add-apt-repository 'deb http://ftp.debian.org/debian sid main' && \ | ||
apt-get update -y > /dev/null && \ | ||
apt-get install -y docker-ce docker-ce-cli containerd.io osmium-tool osmctools > /dev/null && \ | ||
systemctl enable docker | ||
|
This file contains 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 |
---|---|---|
|
@@ -3,60 +3,62 @@ | |
from distutils.util import strtobool | ||
|
||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
load_dotenv(os.path.join(basedir, '.env')) | ||
load_dotenv(os.path.join(basedir, ".env")) | ||
|
||
|
||
def _get_list_var(var): | ||
out = [] | ||
if var: | ||
out.extend(var.split(',')) | ||
out.extend(var.split(",")) | ||
|
||
return out | ||
|
||
|
||
class BaseConfig(object): | ||
### FLASK ### | ||
SECRET_KEY = os.getenv( | ||
'SECRET_KEY' | ||
) or '<MMs8?u_;rTt>;LarIGI&FjWhKNSe=%3|W;=DFDqOdx+~-rBS+K=p8#t#9E+;{e$' | ||
SECRET_KEY = ( | ||
os.getenv("SECRET_KEY") or "<MMs8?u_;rTt>;LarIGI&FjWhKNSe=%3|W;=DFDqOdx+~-rBS+K=p8#t#9E+;{e$" | ||
) | ||
ERROR_INCLUDE_MESSAGE = False # No default "message" field in error responses | ||
RESTX_MASK_SWAGGER = False # No default MASK header in Swagger | ||
SQLALCHEMY_TRACK_MODIFICATIONS = False | ||
|
||
### APP ### | ||
ADMIN_EMAIL = os.getenv('ADMIN_EMAIL') or '[email protected]' | ||
ADMIN_PASS = os.getenv('ADMIN_PASSWORD') or 'admin' | ||
ADMIN_EMAIL = os.getenv("ADMIN_EMAIL") or "[email protected]" | ||
ADMIN_PASS = os.getenv("ADMIN_PASSWORD") or "admin" | ||
|
||
DATA_DIR = os.getenv('DATA_DIR') or os.path.join(basedir, 'data') | ||
DATA_DIR = os.getenv("DATA_DIR") or os.path.join(basedir, "data") | ||
# if we're inside a docker container, we need to reference the fixed directory instead | ||
# Watch out for CI, also runs within docker | ||
if os.path.isdir('/app/data') and not os.getenv('CI', None): | ||
DATA_DIR = '/app/data' | ||
if os.path.isdir("/app/data") and not os.getenv("CI", None): | ||
DATA_DIR = "/app/data" | ||
|
||
ENABLED_PROVIDERS = _get_list_var(os.getenv('ENABLED_PROVIDERS')) or ['osm'] | ||
ENABLED_ROUTERS = _get_list_var(os.getenv('ENABLED_ROUTERS')) or ['valhalla'] | ||
VALHALLA_IMAGE = os.getenv('VALHALLA_IMAGE') or 'gisops/valhalla:latest' | ||
OSRM_IMAGE = os.getenv('OSRM_IMAGE') or 'osrm/osrm-backend:latest' | ||
ORS_IMAGE = os.getenv('ORS_IMAGE') or 'openrouteservice/openrouteservice:latest' | ||
GRAPHHOPPER_IMAGE = os.getenv('GRAPHHOPPER_IMAGE') or 'graphhopper/graphhopper:latest' | ||
ENABLED_PROVIDERS = _get_list_var(os.getenv("ENABLED_PROVIDERS")) or ["osm"] | ||
ENABLED_ROUTERS = _get_list_var(os.getenv("ENABLED_ROUTERS")) or ["valhalla"] | ||
VALHALLA_IMAGE = os.getenv("VALHALLA_IMAGE") or "gisops/valhalla:latest" | ||
OSRM_IMAGE = os.getenv("OSRM_IMAGE") or "osrm/osrm-backend:latest" | ||
ORS_IMAGE = os.getenv("ORS_IMAGE") or "openrouteservice/openrouteservice:latest" | ||
GRAPHHOPPER_IMAGE = os.getenv("GRAPHHOPPER_IMAGE") or "graphhopper/graphhopper:latest" | ||
|
||
### DATABASES ### | ||
POSTGRES_HOST = os.getenv('POSTGRES_HOST') or 'localhost' | ||
POSTGRES_PORT = int(os.getenv('POSTGRES_PORT', int())) or 5432 | ||
POSTGRES_DB = os.getenv('POSTGRES_DB') or 'gis' | ||
POSTGRES_USER = os.getenv('POSTGRES_USER') or 'docker' | ||
POSTGRES_PASS = os.getenv('POSTGRES_PASS') or 'docker' | ||
SQLALCHEMY_DATABASE_URI = os.getenv('POSTGRES_URL') or \ | ||
f'postgresql://{POSTGRES_USER}:{POSTGRES_PASS}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}' | ||
REDIS_URL = os.getenv('REDIS_URL') or f'redis://localhost:6379/0' | ||
POSTGRES_HOST = os.getenv("POSTGRES_HOST") or "localhost" | ||
POSTGRES_PORT = int(os.getenv("POSTGRES_PORT", int())) or 5432 | ||
POSTGRES_DB = os.getenv("POSTGRES_DB") or "gis" | ||
POSTGRES_USER = os.getenv("POSTGRES_USER") or "docker" | ||
POSTGRES_PASS = os.getenv("POSTGRES_PASS") or "docker" | ||
SQLALCHEMY_DATABASE_URI = ( | ||
os.getenv("POSTGRES_URL") | ||
or f"postgresql://{POSTGRES_USER}:{POSTGRES_PASS}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}" | ||
) | ||
REDIS_URL = os.getenv("REDIS_URL") or "redis://localhost:6379/0" | ||
|
||
### SMTP ### | ||
SMTP_HOST = os.getenv('SMTP_HOST') or 'localhost' | ||
SMTP_PORT = int(os.getenv('SMTP_PORT', int())) or 1025 | ||
SMTP_FROM = os.getenv('SMTP_FROM') or '[email protected]' | ||
SMTP_USER = os.getenv('SMTP_USER') | ||
SMTP_PASS = os.getenv('SMTP_PASS') | ||
SMTP_SECURE = bool(strtobool(os.getenv('SMTP_SECURE', 'False'))) or False | ||
SMTP_HOST = os.getenv("SMTP_HOST") or "localhost" | ||
SMTP_PORT = int(os.getenv("SMTP_PORT", int())) or 1025 | ||
SMTP_FROM = os.getenv("SMTP_FROM") or "[email protected]" | ||
SMTP_USER = os.getenv("SMTP_USER") | ||
SMTP_PASS = os.getenv("SMTP_PASS") | ||
SMTP_SECURE = bool(strtobool(os.getenv("SMTP_SECURE", "False"))) or False | ||
|
||
|
||
class DevConfig(BaseConfig): | ||
|
@@ -71,22 +73,24 @@ class TestingConfig(BaseConfig): | |
TESTING = True | ||
FLASK_DEBUG = 0 | ||
|
||
POSTGRES_HOST = os.getenv('POSTGRES_HOST') or 'localhost' | ||
POSTGRES_PORT = os.getenv('POSTGRES_PORT') or '5432' | ||
POSTGRES_DB_TEST = os.getenv('POSTGRES_DB_TEST') or 'gis_test' | ||
POSTGRES_USER = os.getenv('POSTGRES_USER') or 'admin' | ||
POSTGRES_PASS = os.getenv('POSTGRES_PASS') or 'admin' | ||
POSTGRES_HOST = os.getenv("POSTGRES_HOST") or "localhost" | ||
POSTGRES_PORT = os.getenv("POSTGRES_PORT") or "5432" | ||
POSTGRES_DB_TEST = os.getenv("POSTGRES_DB_TEST") or "gis_test" | ||
POSTGRES_USER = os.getenv("POSTGRES_USER") or "admin" | ||
POSTGRES_PASS = os.getenv("POSTGRES_PASS") or "admin" | ||
|
||
SQLALCHEMY_DATABASE_URI = os.getenv('POSTGRES_TEST_URL') or \ | ||
f'postgresql://{POSTGRES_USER}:{POSTGRES_PASS}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB_TEST}' | ||
SQLALCHEMY_DATABASE_URI = ( | ||
os.getenv("POSTGRES_TEST_URL") | ||
or f"postgresql://{POSTGRES_USER}:{POSTGRES_PASS}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB_TEST}" | ||
) | ||
|
||
DATA_DIR = os.path.join(basedir, 'tests', 'data') | ||
OSM_PBF_PATH = os.path.join(basedir, 'tests', 'data', 'andorra-200827.osm.pbf') | ||
TOMTOM_PBF_PATH = os.path.join(basedir, 'tests', 'data', 'liechtenstein-201109.tomtom.pbf') | ||
HERE_PBF_PATH = os.path.join(basedir, 'tests', 'data', 'liechtenstein-201109.here.pbf') | ||
DATA_DIR = os.path.join(basedir, "tests", "data") | ||
OSM_PBF_PATH = os.path.join(basedir, "tests", "data", "andorra-200827.osm.pbf") | ||
TOMTOM_PBF_PATH = os.path.join(basedir, "tests", "data", "liechtenstein-201109.tomtom.pbf") | ||
HERE_PBF_PATH = os.path.join(basedir, "tests", "data", "liechtenstein-201109.here.pbf") | ||
|
||
ENABLED_ROUTERS = _get_list_var('valhalla') | ||
ENABLED_PROVIDERS = _get_list_var('osm,tomtom,here') | ||
ENABLED_ROUTERS = _get_list_var("valhalla") | ||
ENABLED_PROVIDERS = _get_list_var("osm,tomtom,here") | ||
|
||
ADMIN_EMAIL = '[email protected]' | ||
ADMIN_PASS = 'admin' | ||
ADMIN_EMAIL = "[email protected]" | ||
ADMIN_PASS = "admin" |
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
bind = "0.0.0.0:5000" | ||
# Generally we recommend (2 x $num_cores) + 1 as the number of workers to start off with | ||
workers = 5 | ||
worker_class = 'gevent' | ||
worker_class = "gevent" | ||
worker_connections = 10 | ||
timeout = 30 | ||
keepalive = 2 |
This file contains 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
Oops, something went wrong.