Skip to content

This boilerplate is designed as a tutorial for deploying a Flask application with additional services.

Notifications You must be signed in to change notification settings

bryaneadams/boilerplate_application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forthebadge made-with-python forthebadge forthebadge

Boilerplate Application

This boilerplate is designed as a tutorial for deploying a Flask application with additional services.

New to Docker? Go to Getting Started

This application contains the following services:

  1. Flask Application
  2. PostgresSQL
  3. MinIO
  4. Redis
  5. A worker

The default is to use KeyCloak for authentication. I have commented out the decorators for requiring a login here and here. This is to help people new to authentication.

Quick initial comments.

All environment variables used in the deployment are located in the .env file.

To run the tech stack

  • Using prebuilt images docker-compose up

  • Building images docker-compose -f docker-compose-development.yml up

URLs

  1. Application: localhost:5000
  2. MinIO: localhost:9000

Getting started

forthebadge

Docker what is Docker?!

I am assuming if you are new to Docker you are probably using a Windows machine. This is not a bad thing, in fact often at work it is all you get. You will need to install some services to use this repo. I will assume you have a GitHub account (after all you are looking at GitHub) and I will provide you a list of software to install (and recommend others).

Install the following

  1. Install Docker.

Nice to have (assuming you are using Windows, again this is just recommended)

  1. Install Git

Getting started

Now the hard part is out of the way, go ahead and ensure Docker is running. For this I will assume you are using a Windows machine. In the bottom left-hand corner click the windows start button. Type git in the search menu and select Git Bash Git Bash. Once the black window opens, type docker ps and you should get something back that looks like this:

% docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

If you got something that looks like this, then you most likely need to start Docker. In the bottom left-hand corner click the windows start button. Type docker and select Docker Desktop. This will get it running and repeat the step before.

forthebadge

Pulling Docker Images

There are five Docker images used in this techstack. You can pull them using the following commands in any of your favorite OS's

docker pull <image_name>

For this you will need to run this application stack you will need to run the following lines of code:

  • Note if you are going to paste into Git Bash, Shift+Insert is paste.
docker pull statculus/boilerplate_app:latest
docker pull statculus/boilerplate_worker:latest
docker pull bitnami/postgresql:latest
docker pull bitnami/minio:latest
docker pull bitnami/postgresql:latest

It might take a while, but now you will have five images saved locally.

Run the application with its supporting services

Run the following command from the base directory of this repo.

docker-compose up

There will be a bunch of logs appear, but that is normal. After approximately 30 seconds your application will be running.

Visit http://localhost:5000 to see your application. Under Create Form select Create New Form. Type some text and click Submit. Next visit http://localhost:9000 and sign into MinIO. The default Access Key is bryanisawesome and Secret Key is bryanrocks. Under the results bucket you will see a text file with the text you just typed. The name of the file will be dd-mm-yyyy_HH:MM:SS_Bryan_Rocks.txt

forthebadge

Pulling and building at once!

Run the following command from the base directory of this repo:

docker-compose up

If you have not pulled the images already, they will be pulled and start running!

forthebadge

Ready to build them locally?

Run the following command from the base directory of this repo:

docker-compose -f docker-compose-development.yml up

Your images will build locally (might take some time) and then start running.

About

This boilerplate is designed as a tutorial for deploying a Flask application with additional services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published