diff --git a/content/post/deploying-django-with-docker-and-ansible.md b/content/post/deploying-django-with-docker-and-ansible.md index 7cf0480..b8e5d4d 100644 --- a/content/post/deploying-django-with-docker-and-ansible.md +++ b/content/post/deploying-django-with-docker-and-ansible.md @@ -3,6 +3,7 @@ title: "Deploying a django app with docker, ansible and traefik" date: 2023-07-24T22:10:10+02:00 draft: false image: "uploads/docker-ansible-django-traefik/django_docker_ansible_traefik.png" +image_alt: "Graphic showing the Django, Docker, Ansible and Traefik logo" categrories: ['English'] tags: ['MASH', 'django', 'ilmo', 'ansible', 'traefik', 'docker'] --- diff --git a/content/post/django-geocoding/index.md b/content/post/django-geocoding/index.md index 74a9512..df03935 100644 --- a/content/post/django-geocoding/index.md +++ b/content/post/django-geocoding/index.md @@ -11,13 +11,13 @@ tags: ['django', 'geocoding', 'nominatim', 'OpenStreetMap', 'osm', 'traefik', 'm Geocoding is the process of translating a text input like `Ungewitterweg, Berlin` into a location with longitude and latitude such as `52.544022/13.147589`. So whenever you search in OpenStreetMap or Google Maps for a location, it does exactly that (and sometimes more, but we don't focus on that now). -For a pet project of mine ([notfellchen.org](https://notfellchen.org)) I wanted to do exactly that: When a animal is added there to be adopted, the user must input a location. That is geocoded and saved. When another user visits the site, that wants to adopt a pet in their area, they input their location and it will search for all animals in a specific radius. +For a pet project of mine ([notfellchen.org](https://notfellchen.org)) I wanted to do exactly that: When a animal is added there to be adopted, the user must input a location that is geocoded and saved with it's coordinates. When another user visits the site, that wants to adopt a pet in their area, they input their location and it will search for all animals in a specific radius. -So lets get started! +How is that done? I'll show you! # Nominatim -Nominatim is a software that uses OpenStreetMap data for geocoding. It can also do the reverse, find an address for any location on the planet. It is used for the geocoding on [OpenStreetMap](https://openstreetmap.org), so quite production-ready. We could use the public API (while obeying the [usage policy](https://operations.osmfoundation.org/policies/nominatim/)) but it's nicer to have our own instance, so we don't stress the resources of a donation funded organization and to improve user privacy. +Nominatim is a software that uses OpenStreetMap data for geocoding. It can also do the reverse, find an address for any location on the planet. It is used for the geocoding on [OpenStreetMap](https://openstreetmap.org), so it's quite production-ready. We could use the public API (while obeying the [usage policy](https://operations.osmfoundation.org/policies/nominatim/)) but it's nicer to have our own instance, so we don't stress the resources of a donation funded organization and to improve user privacy. Nominatim works by importing geodate from a [PBF](https://wiki.openstreetmap.org/wiki/PBF_Format)-file into a postgres database. This database will later be queried to provide location data. The process is described below. @@ -36,7 +36,8 @@ It bundles nominatim together with the database postgres. I usually prefere to h * import process (described later) will not slow the database for other services * it's easier to nuke everything if things go wrong -The following environment variables will be used +The following environment variables will be used to configure the container + * `PBF_URL`: The URL from where to download the PBF file that contains the geodate we will import. They can be obtained from [Geofabrik](https://download.geofabrik.de/). It is highly recommended to first download the file to a local server and then set this URL to that server so that the ressources from Geofabrik are not affected if something goes wrong. Feel free to use the pre-set URL for germany while it works if you want to test around. * `REPLICATION_URL`: Where to get updates from. For example Geofabrik's update for the Europe extract are available at `https://download.geofabrik.de/europe-updates/` Other places at Geofabrik follow the pattern `https://download.geofabrik.de/$CONTINENT/$COUNTRY-updates/` * `POSTGRES_` Postgres tuning data, the current setting allows imports on a ressource constrained system. See [postgres tuning docs](https://github.com/mediagis/nominatim-docker/tree/master/4.4#postgresql-tuning) for more info @@ -125,10 +126,11 @@ Now we are ready to go! Before you type `docker-compose up -d` let me explain wh 3. Import the PBF file into the database. Here you are most likely to run into errors because of ressource constraints 4. Start the Nominatim server -If you are ready, lets go: `docker-compose up -d`. Monitor what nominatim is doing with `docker logs -f nominatim` and make a cup of tea. This might take a while. +If you are ready, lets go: `docker-compose up -d`. Monitor what nominatim is doing with `docker logs -f nominatim` and make a cup of tea. This will take a while (proably several hours). ## Testing -You can try your server by visiting the domain. Use `/?q=CITYNAME` to see an actual search result. + +You can test your server by visiting the domain. Try `/?q=CITYNAME` to see an actual search result. Example: `https://geocoding.example.org/?q=tuebingen`