Putting together the monolithic design

This monolithic design is excellent and should be the kind of result you would aim for in your first development iteration. Everything should be built of course through TDD, as explained in Chapter 3, ;Coding, Testing, and Documenting - The Virtuous Cycle.

It's a short and clean implementation on the top of a relational database that can be deployed with a PostgreSQL or MySQLServer. Thanks to the SQLAlchemy abstractions, a local version can run with SQLite 3 and facilitate your day-to-day work and your tests.

To build this app, we've used the following extensions and library:

  • Flask-SQLAlchemy and SQLAlchemy: These are used for the Model
  • Flask-WTF and WTForms: These are used for all the forms
  • Celery and Redis: These are used for background processes and periodic tasks
  • Flask-Login: This is used for managing authentication and authorization

The overall design looks like the following diagram:

A typical deployment will group the Flask app with one Redis and one Celery instance on the same server and serve requests through a web server such as Apache or nginx. The database can be located on the same server, or on a dedicated server.

The server can spawn several Flask processes and Celery processes to raise the number of requests and users it can handle.

When this deployment is not sufficient to serve the load, the first change that comes to mind is to add other application servers and dedicated servers for the database server and the Redis broker.

The third step, if needed, will be to have more Redis and PostgreSQL instances, and some thoughts will be required on the best approach because you will need to set up replication and maybe sharding strategies.

When an application reaches that third step, solutions out of the box, such as ;Amazon SQS and Amazon RDS, might be a good fit, as we'll see in Chapter 11, Deploying on AWS.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset