This is a Python based Rest API web application for Spatial Data. This project includes CRUD operations for spatial data into Geodjango ORM. Also it includes celery implementation to run asynchronous job to download data of countries from datahub.io and upload it to PostGIS db at every 10 minutes interval. Two replicas of the application are created and load balancing is applied through nginx server.
This section should list any major frameworks/libraries used as follows:
The project uses docker-compose for deployment
docker-compose.yml version 3.9 is used hence make sure you docker-compose is up-to-date
To install latest docker-compose on linux environment use
- docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
To run the project use following steps
-
Build docker images and run docker containers
sudo docker-compose up -d --build
up parameter is to start container, -d is used to run the process in background (daemon mode) and --build is used to build the image if running it for the first time or changes made to dockerfile
-
To stop the container use
sudo docker-compose down
To run unittest cases for Django run the following command
docker exec -it geoapi sh -c "cd /code/geoapp/ && python manage.py test"
Below are urls of the rest apis to test functionalities and view parameters for the api
- Create Country URL
- Get all Countries URL
- Get specific country URL
- Update Country details URL
- Delete Country URL
- Search Country by String URL
- Spatial intersection by Geometry URL
- Spatial intersection by country name URL
If you face the below issues please follow the steps to rectify
- standard_init_linux.go:228: exec user process caused: no such file or directory error on docker windows.
To solve it run the following command. Delete the repo and clone it again
git config --global core.autocrlf false
- permission denied to run .sh file
If you are running a linux based os please run the following commands to make all .sh files executable and then run docker-compose
sudo chmod +x wait-for-it.sh sudo chmod +x startup_service.sh sudo chmod +x start_celery.sh