foundationdb/packaging/docker/samples/python
Pierre Zemb be2b97a0e9
Fix python sample using docker-compose
2019-12-14 15:25:33 +01:00
..
app Fix python sample using docker-compose 2019-12-14 15:25:33 +01:00
.env Fix python sample using docker-compose 2019-12-14 15:25:33 +01:00
README.md Fix python sample using docker-compose 2019-12-14 15:25:33 +01:00
docker-compose.yml Fix python sample using docker-compose 2019-12-14 15:25:33 +01:00

README.md

Python sample using docker-compose

This contains a sample docker-compose.yaml to run a simple Python application running with FoundationDB as a storage backend.

All variables are located in .env file.

Start the Python demo

docker-compose up -d

This will start:

  • 1 coordinator,
  • 2 fdbservers,
  • 1 Flask application.

The Flask application can be accessed using curl:

# retrieve counter
curl http://0.0.0.0:5000/counter # 0

# increment counter
curl -X POST http://0.0.0.0:5000/counter/increment # 1
curl -X POST http://0.0.0.0:5000/counter/increment # 2

# retrieve counter
curl http://0.0.0.0:5000/counter # 2

Access the FoundationDB cluster

If you want to access the cluster from your machine, here's a cluster file ready for you:

echo "docker:docker@127.0.0.1:4500" > docker.cluster
FDB_CLUSTER_FILE=./docker.cluster fdbcli

Stop the Python demo

docker-compose down