Divide and map. Now. – the damn project – helps mappers by dividing a big area into smaller squares that people can map together.
damn_server
provides access to the PostGIS database via JSON API. It
is written in Python3 and published under AGPLv3 License.
Report security issues. Send patches to:
git config format.subjectPrefix 'PATCH damn-server'
git config sendemail.to '~qeef/damn-dev@lists.sr.ht'
To develop, you need PostGIS database. You can use damn-deploy:
git clone https://git.sr.ht/~qeef/damn-deploy
cd damn-deploy
sed -i '/POSTGRES_PASSWORD=.*/d' .env
docker-compose -f http.yml up db
Create virtual environment and install dependencies:
python3 -m venv tve
. tve/bin/activate
pip install -r requirements.dev.txt
Set environment variable with the IP address of the damndb
:
export DB_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' damndb)
Run unit tests:
python3 -m unittest discover tests
with coverage:
coverage run --branch --include=damn_server/area.py,damn_server/conf.py,damn_server/db.py,damn_server/list_of.py,damn_server/new.py,damn_server/square.py,damn_server/user.py,damn_upkeep/execute.py,damn_upkeep/generate.py -m unittest discover tests && coverage report --show-missing
Run damn server app:
uvicorn damn_server.api:app --workers 9
Run integration tests (damn server app must be running):
python3 -m unittest tests/integration.py
NOTE: You can prepend python3
or uvicorn
with
PYTHONASYNCIODEBUG=1
to see the async debug info.
NOTE: Use --workers 9
for testing. When developing, use --reload
instead.
Run load tests (damn server app must be running):
pip install -r requirements.loadtest.txt
locust -f tests/mapathon.py -H http://127.0.0.1:8000 -u 1000 -r 10 -t 10m --headless --only-summary
Connect to the database:
psql "postgresql://damnuser:$(cat .env | sed -n 's/^POSTGRES_PASSWORD=\(.\+\)$/\1/p')@$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' damndb)/damndb"
Make documentation:
pip install -r requirements.doc.txt
cd doc && make html
Modules¶
Access PostGIS database via JSON API. |
|
Upkeep procedures to maintain the database and share information. |
|
Test modules. |