Remove lean mode
This commit is contained in:
parent
59f074cb28
commit
ac90d50239
|
@ -192,8 +192,6 @@ docker-compose run --rm api alembic upgrade head
|
||||||
|
|
||||||
## Import OpenStreetMap data
|
## Import OpenStreetMap data
|
||||||
|
|
||||||
**Hint:** This step may be skipped if you are using [Lean mode](./docs/lean-mode.md).
|
|
||||||
|
|
||||||
You need to import road information from OpenStreetMap for the portal to work.
|
You need to import road information from OpenStreetMap for the portal to work.
|
||||||
This information is stored in your PostgreSQL database and used when processing
|
This information is stored in your PostgreSQL database and used when processing
|
||||||
tracks (instead of querying the Overpass API), as well as for vector tile
|
tracks (instead of querying the Overpass API), as well as for vector tile
|
||||||
|
|
|
@ -4,7 +4,6 @@ DEBUG = True
|
||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
AUTO_RELOAD = True
|
AUTO_RELOAD = True
|
||||||
SECRET = "!!!!!!!!!!!!CHANGE ME!!!!!!!!!!!!"
|
SECRET = "!!!!!!!!!!!!CHANGE ME!!!!!!!!!!!!"
|
||||||
LEAN_MODE = False
|
|
||||||
POSTGRES_URL = "postgresql+asyncpg://obs:obs@postgres/obs"
|
POSTGRES_URL = "postgresql+asyncpg://obs:obs@postgres/obs"
|
||||||
POSTGRES_POOL_SIZE = 20
|
POSTGRES_POOL_SIZE = 20
|
||||||
POSTGRES_MAX_OVERFLOW = 2 * POSTGRES_POOL_SIZE
|
POSTGRES_MAX_OVERFLOW = 2 * POSTGRES_POOL_SIZE
|
||||||
|
|
|
@ -7,11 +7,6 @@ DEBUG = False
|
||||||
VERBOSE = DEBUG
|
VERBOSE = DEBUG
|
||||||
AUTO_RELOAD = DEBUG
|
AUTO_RELOAD = DEBUG
|
||||||
|
|
||||||
# Turn on lean mode to simplify the setup. Lots of features will be
|
|
||||||
# unavailable, but you will not need to manage OpenStreetMap data. Please make
|
|
||||||
# sure to configure the OBS_FACE_CACHE_DIR correctly for lean mode.
|
|
||||||
LEAN_MODE = False
|
|
||||||
|
|
||||||
# Required to encrypt or sign sessions, cookies, tokens, etc.
|
# Required to encrypt or sign sessions, cookies, tokens, etc.
|
||||||
SECRET = "!!!<<<CHANGEME>>>!!!"
|
SECRET = "!!!<<<CHANGEME>>>!!!"
|
||||||
|
|
||||||
|
|
|
@ -320,9 +320,7 @@ from .routes import (
|
||||||
exports,
|
exports,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not app.config.LEAN_MODE:
|
|
||||||
from .routes import tiles, mapdetails
|
from .routes import tiles, mapdetails
|
||||||
|
|
||||||
from .routes import frontend
|
from .routes import frontend
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ from obs.face.filter import (
|
||||||
RequiredFieldsFilter,
|
RequiredFieldsFilter,
|
||||||
)
|
)
|
||||||
|
|
||||||
from obs.face.osm import DataSource, DatabaseTileSource, OverpassTileSource
|
from obs.face.osm import DataSource, DatabaseTileSource
|
||||||
|
|
||||||
from obs.api.db import OvertakingEvent, RoadUsage, Track, UserDevice, make_session
|
from obs.api.db import OvertakingEvent, RoadUsage, Track, UserDevice, make_session
|
||||||
from obs.api.app import app
|
from obs.api.app import app
|
||||||
|
@ -39,12 +39,7 @@ def get_data_source():
|
||||||
mode, the OverpassTileSource is used to fetch data on demand. In normal
|
mode, the OverpassTileSource is used to fetch data on demand. In normal
|
||||||
mode, the roads database is used.
|
mode, the roads database is used.
|
||||||
"""
|
"""
|
||||||
if app.config.LEAN_MODE:
|
return DataSource(DatabaseTileSource())
|
||||||
tile_source = OverpassTileSource(cache_dir=app.config.OBS_FACE_CACHE_DIR)
|
|
||||||
else:
|
|
||||||
tile_source = DatabaseTileSource()
|
|
||||||
|
|
||||||
return DataSource(tile_source)
|
|
||||||
|
|
||||||
|
|
||||||
async def process_tracks_loop(delay):
|
async def process_tracks_loop(delay):
|
||||||
|
|
|
@ -14,10 +14,7 @@ if app.config.FRONTEND_CONFIG:
|
||||||
**req.app.config.FRONTEND_CONFIG,
|
**req.app.config.FRONTEND_CONFIG,
|
||||||
"apiUrl": f"{req.ctx.api_url}/api",
|
"apiUrl": f"{req.ctx.api_url}/api",
|
||||||
"loginUrl": f"{req.ctx.api_url}/login",
|
"loginUrl": f"{req.ctx.api_url}/login",
|
||||||
"obsMapSource": (
|
"obsMapSource": {
|
||||||
None
|
|
||||||
if app.config.LEAN_MODE
|
|
||||||
else {
|
|
||||||
"type": "vector",
|
"type": "vector",
|
||||||
"tiles": [
|
"tiles": [
|
||||||
req.ctx.api_url
|
req.ctx.api_url
|
||||||
|
@ -28,8 +25,7 @@ if app.config.FRONTEND_CONFIG:
|
||||||
],
|
],
|
||||||
"minzoom": 0,
|
"minzoom": 0,
|
||||||
"maxzoom": 14,
|
"maxzoom": 14,
|
||||||
}
|
},
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json(result)
|
return response.json(result)
|
||||||
|
|
|
@ -7,11 +7,6 @@ DEBUG = False
|
||||||
VERBOSE = DEBUG
|
VERBOSE = DEBUG
|
||||||
AUTO_RELOAD = DEBUG
|
AUTO_RELOAD = DEBUG
|
||||||
|
|
||||||
# Turn on lean mode to simplify the setup. Lots of features will be
|
|
||||||
# unavailable, but you will not need to manage OpenStreetMap data. Please make
|
|
||||||
# sure to configure the OBS_FACE_CACHE_DIR correctly for lean mode.
|
|
||||||
LEAN_MODE = False
|
|
||||||
|
|
||||||
# Required to encrypt or sign sessions, cookies, tokens, etc.
|
# Required to encrypt or sign sessions, cookies, tokens, etc.
|
||||||
# SECRET = "!!!<<<CHANGEME>>>!!!"
|
# SECRET = "!!!<<<CHANGEME>>>!!!"
|
||||||
|
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
# Lean mode
|
|
||||||
|
|
||||||
The application can be configured in "lean mode" through the `LEAN_MODE`
|
|
||||||
setting in `config.py`. A lean installation is easier to set up, as a few steps
|
|
||||||
can be skipped. However, the performance of the application will degrade in
|
|
||||||
lean mode, and lots of advanced features will not be available.
|
|
||||||
|
|
||||||
Lean mode is meant as an entrypoint to get started with collecting data,
|
|
||||||
without the hassle of importing and maintaining OpenStreetMap data.
|
|
||||||
|
|
||||||
## Disabled features in lean mode
|
|
||||||
|
|
||||||
* No map tiles are generated.
|
|
||||||
* The frontend will not show an overview map, only per-track maps.
|
|
||||||
* The `roads` database table is not used, neither for processing tracks, nor
|
|
||||||
for generating map tiles.
|
|
||||||
* The API will not generate auxiliary information for display on the
|
|
||||||
(nonexistent) map, such as per-road statistics.
|
|
||||||
|
|
||||||
## Switch to/from lean mode
|
|
||||||
|
|
||||||
To enable lean mode, set the following in your `config.py` (or in
|
|
||||||
`config.overrides.py`, especially in development setups):
|
|
||||||
|
|
||||||
```python
|
|
||||||
LEAN_MODE = True
|
|
||||||
```
|
|
||||||
|
|
||||||
To disable lean mode, set it to `False` instead.
|
|
||||||
|
|
||||||
For lean mode, it is important that the config variable `OBS_FACE_CACHE_DIR` is
|
|
||||||
properly set, or that you are happy with its default value of using
|
|
||||||
`$DATA_DIR/obs-face-cache`.
|
|
||||||
|
|
||||||
When turning off lean mode, make sure to fill your `roads` table properly, as
|
|
||||||
otherwise the track processing will not work. When turning on lean mode, you
|
|
||||||
may truncate the `roads` table to save space, but you don't need to, it simply
|
|
||||||
becomes unused.
|
|
||||||
|
|
||||||
## Benefits
|
|
||||||
|
|
||||||
* When using lean mode, you can skip the import of OpenStreetMap data during
|
|
||||||
setup, and you also do not need to keep it updated.
|
|
||||||
* People can already start uploading data and the data is also processed,
|
|
||||||
giving you as a maintainer more time to set up the full application, if you
|
|
||||||
want to.
|
|
||||||
|
|
||||||
## Drawbacks
|
|
||||||
|
|
||||||
* Lean mode is less performant when processing tracks.
|
|
||||||
* Lean mode track processing depends on the Overpass API data source, which may
|
|
||||||
be slow, unavailable, or rate limiting the requests, so processing may fail.
|
|
||||||
We use caching to prevent some issues, but as we depend on a third party
|
|
||||||
service here that is accessed for free and that generates a lot of server
|
|
||||||
load, we really can't ask for much. If you frequently run into issues, the
|
|
||||||
best bet is to manage OSM data yourself and turn off lean mode.
|
|
||||||
* Of course some features are missing.
|
|
Loading…
Reference in a new issue