Standard Flask project API and Database using tools and best practices.
- Python 3.6
- Flask
- SQLAlchemy
- Marshmallow
- Dynaconf
- Blueprint
- Gunicorn
- Pipenv
- Docker
- Docker-Compose
- Gelf Logger
- Flake8
- Sentry
- Prometheus
- Swagger
- Unit-Tests
- Integration-Tests
To run this project locally, you need to install pyenv and pipenv in order to create the Python virtual environments This project use Python 3.6
If you don't have python 3.6 installed, run
pyenv install 3.6.9
Pipenv will use python 3.6.9 just instaled
make install
To activate this project's virtualenv, run pipenv shell.
make shell
Just run the command
make run/docker-compose
Just run the command
make run/docker-compose-structure
Before, check if mysql is running correctly
docker ps
Just run the command
make run/local
Before, check if mysql is running correctly
docker ps
Just run the command
make run/docker
Just run the command
make lint
Just run the command
make test
Just run the command
make run/docker-compose-structure
make test/integration
To learn more about Docker Swarm, visit https://prometheus.io This project is configured to run with docker swarm. First configure docker swarm Create Docker Swarm node
docker swarm init --advertise-addr [your-localhost-ip-v4]
Create and initialize stack
docker stack deploy --compose-file="docker-compose.yml" py-api
Docker Swarm configuration is defined in deploy
configuration in docker-compose.yml file
Just run the command
find . -type f -exec sed -i "s/py-api/yourprojectname/g" {} +
To learn more about Prometheus, visit https://prometheus.io To access local metrics, access: http://localhost:5000/metrics Or http://your-ipv4-ip:5000/metrics
To learn more about Sentry, visit https://sentry.io Create a free Sentry account Passing as application arguments the Sentry DSN
export SENTRY_DSN=YOUR-SENTRY-DSN
Just don't commit directly on master, push a branch and Pull Request.