This is a boilerplate RESTful app based on Flask + SQLAlchemy with gunicorn, Nginx and Docker.
$ cd boilerplate_flask_sqlalchemy/
$ pip install -U pipenv # If you don't have pipenv, checkout https://pipenv.readthedocs.io/en/latest/#install-pipenv-today
$ export PIPENV_VENV_IN_PROJECT=1 # Let the virtual environment and packages to be installed in the project
$ pipenv install # Install required packages
$ pipenv shell # Activate the virtual environment
$(.venv) flask create-db # Initialize database
$(.venv) gunicorn --workers 1 --bind 0.0.0.0:8901 app:app # Launch the app
$ curl -i http://0.0.0.0:8901/product
$ pipenv install --dev # Install dev-packages like pytest
$ git config core.hooksPath hooks # Set hooks for `git commit` and `git push`
$ cp .env_example .env # Create a copy of dotenv file for configurations
- Install docker and docker-compose
- Build docker image:
$ docker-compose build
To edit a tag of the docker image, edit
image
from thedocker-compose.yml
- Launch:
$ docker-compose up -d
- Refer to Heroku Deployment
- Create new docker image from CircleCi
- Push the image to the Container Registry (eg. DockerHub)
- Assess your server and install dependencies like docker and docker-compose
- Pull the image created and run:
$ docker run -p 80:80 -d <IMAGE ID>
To build the documentation, simply run
$ cd docs/
$ . ./collect_and_build.sh
Documentation page will automatically open up!
Swagger UI is used for this documentation. The configuration can be found at swagger.yml
.
To see the documentation, run the app and simply go to
http://{YOUR_HOST}:{YOUR_PORT}/ui
See LICENSE