Dev Environment - Python Flask App API with MongoDB using Docker Compose.
This deploy was used for a humanitarian project by (JUS/UNWOMEN). This project permits that some people reporting sexual harassment on the public service in TIMOR-LESTE. We created a chatbot called ROSA.This Chatbot receives the complaints via API and saves it into a mongodb database for CRUD operations.
Checkout ROSA bot : https://m.me/RosaCFP.
The implementation uses Docker CE and Docker-compose: Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.
https://github.com/paulo-amaral/Install-docker-ce-docker-compose
Install Docker CE:
Install Docker-compose :
https://docs.docker.com/compose/install/
After installing Docker and Docker-compose on your machine, you can go to the project main folder and type:
$docker-composer build
$docker-compose up
Docker-compose will build the containers necessary for your environment. Basically there will be two containers, one with Python, Flask and a few modules and another container with MongoDB bound to the first. The environment structure is as follow:
git clone https://github.com/paulo-amaral/docker-flask-mongodb-API.git
$docker-compose build
$docker-compose up
After deploy, you can use or setup a NGROK - https://ngrok.com/
This handy tool lets you set up a secure tunnel to your localhost, which is a fancy way of saying it opens access to your local API from the internet:
$./ngrok http 8080