Skip to content

EN : Import and deploy an API for search in french enterprises using python and docker. / FR : Importation et déploiement de l'API de recherche d'entreprises INSEE, avec python et docker

Notifications You must be signed in to change notification settings

stouch/annuaire-entreprises-fr-docker

Repository files navigation

Requirements

  • docker
  • docker-compose
  • python3
  • pip3

Presentation

Data import

API

Installation

MacOS prerequisites

To make work the request SSL downloads:

ln -s /etc/ssl/* /Library/Frameworks/Python.framework/Versions/Current/etc/openssl/

Start databases

This elasticsearch db will store all the enterprise data in a persistent local storage (./.esdata).

mkdir ./.esdata
# chown the ./.esdata, make sure that docker will be able to write in it.

# Feel free to:
# - Adjust the 8g RAM heap size (docker-compose.yml) to at least 14g
# - Choose a specific location for your elastic data (needs at least 70GB) instead of .esdata
nano docker-compose.yml
docker compose up -d elasticsearch

Start redis:

# - You can choose specific location for redis data
# - Adjust memory parameter to at least 14gb
nano docker-compose.yml
docker compose up -d redis

Import data:

  • Source data import (downloads + sqlite indexation):
    • (8 CPU + 16GB RAM, 70GB high-speed disk for sqlite data): About 4h
  • Elastic indexation: (16 CPU + 32GB RAM, 70GB high-speed disk):
    • (16 CPU + 32GB RAM, 70GB high-speed disk for elastic data): About 7h
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt

cp .env.sample .env
nano .env # Choose the DATA_DIR for import data

#python3 import.py # Executes both import and elastic indexation \/
nohup python import.py > output.log 2>&1 &

Usage

aio proxy hosts the python search API:

docker compose up -d http-proxy

Then you can fetch the API: http://localhost:4500/search?q=Carrefour+chalon+sur+saone

About

EN : Import and deploy an API for search in french enterprises using python and docker. / FR : Importation et déploiement de l'API de recherche d'entreprises INSEE, avec python et docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages