Skip to content

Commit

Permalink
Add Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Feb 22, 2023
1 parent ad7ce15 commit ee3bc1b
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data
*.osm.pbf
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.11-bullseye

RUN apt-get update && \
apt-get install -y \
gdal-bin \
parallel \
postgresql-client \
python3-virtualenv

WORKDIR /opt/imposm
RUN wget https://github.com/omniscale/imposm3/releases/download/v0.11.1/imposm-0.11.1-linux-x86-64.tar.gz && \
tar -xvzf imposm-0.11.1-linux-x86-64.tar.gz && \
ln -s /opt/imposm/imposm-0.11.1-linux-x86-64/imposm /usr/bin/imposm

WORKDIR /opt/bano

ADD requirements.txt .
RUN pip install -r requirements.txt
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,43 @@ load_osm_france_db.sh http://download.openstreetmap.fr/extracts/europe/france/fr
Pour connaître les commandes du module bano : `bano --help`.

Quasiment toutes les options sont utilisées dans le script `cron_bano`.

## Docker

### Configuration
Il ne faut pas modifier le fichier de configuration pour l'exécution avec docker. Pour changer le chemin ou sont stocké les données ajuster le volume data dans `docker-compose`.

```
# Créer l'espace de travail
docker-compose run --rm tools ./arborescence.sh
```

### Initialisation
```
# Démarre Postgres et attend un peu avant de l'utiliser
docker-compose up -d postgres && sleep 5
# Créer les bases de données
docker-compose run --rm tools ./init_base.sh
```

Si besoin de se connecter sur la base de données :
```
docker-compose exec -u postgres postgres psql
```

```
# Charger les données OSM
docker-compose run --rm tools ./load_osm_france_db.sh http://download.openstreetmap.fr/extracts/europe/france/franche_comte/territoire_de_belfort.osm.pbf
# Charger les autres données
docker-compose run --rm tools ./load_fantoir.sh
docker-compose run --rm tools ./load_COG.sh
docker-compose run --rm tools ./load_codes_postaux.sh
docker-compose run --rm tools ./update_cadastre_adresses.sh
docker-compose run --rm tools ./update_table_infos_communes.sh
docker-compose run --rm tools bash -c "source config && python -m bano update_code_cadastre"
### Mise à jour
```
docker-compose run --rm tools ./cron_bano.sh
```
3 changes: 3 additions & 0 deletions bano/bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,6 @@ def main():
import ipdb

ipdb.set_trace()

if __name__ == "__main__":
main()
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.3'

services:
postgres:
image: postgis/postgis:13-3.3-alpine
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_HOST_AUTH_METHOD=trust
ports:
- 5432:5432

tools:
build: .
volumes:
- .:/opt/bano
- ./data:/data
environment:
# Postgres
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
# BANO
- SRC_DIR=/opt/bano
- DATA_DIR=/data/bano
- DOWNLOAD_DIR=/data/download
- IMPOSM_CACHE_DIR=/data/bano_imposm_cache
- EXPORT_SAS_DIR=/data/export_sas
- EXPORT_WEB_DIR=/data/export
- TMP_DIR=/data/tmp
- LANG=C

0 comments on commit ee3bc1b

Please sign in to comment.