This tutorial walks you through developing and deploying a multi-region web application built on CockroachDB, using Flask, SQLAlchemy, CockroachDB Cloud, and Google Cloud Platform services.
CockroachDB versions v21.1 and above support new multi-region capabilities, with different SQL syntax.
For the latest version of the application and database schema built on v21.1 multi-region features, see the movr-flask
repository.
For the latest version of the tutorial, see the v21.1 docs.
The following sections make up the tutorial:
- MovR: An Example Multi-Region Use-Case
- Create a Multi-Region Database Schema
- Set Up a Virtual Environment for Developing Multi-Region Applications
- Develop a Multi-Region Web Application
- Deploy a Multi-Region Web Application
Throughout the tutorial, we reference the source code for an example web application for the fictional vehicle-sharing company MovR. The source code for this application is open source and available on GitHub, in the movr-flask
repository . The code is well-commented, with docstrings defined at the beginning of each class and function definition.
The repo's README also includes instructions on debugging and deploying the application using Google Cloud services. Those instructions are reproduced in Setting Up a Virtual Environment for Developing Multi-Region Applications and Deploying a Multi-Region Web Application.