Develop and Deploy a Multi-Region Web Application

Warning:
This version of CockroachDB is no longer supported. For more details, see the Release Support Policy.

This tutorial walks you through developing and deploying a multi-region web application built on CockroachDB, using Flask, SQLAlchemy, CockroachCloud, and Google Cloud Platform services.

Note:

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:

  1. MovR: An Example Multi-Region Use-Case
  2. Create a Multi-Region Database Schema
  3. Set Up a Virtual Environment for Developing Multi-Region Applications
  4. Develop a Multi-Region Web Application
  5. 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.

Tip:

For a live demo of the deployed MovR Flask application, see https://movr.cloud.

Note that the backend for the live demo uses a newer version of the application, built on the multi-region syntax introduced in v21.1. This newer application is also deployed using a simplified, serverless workflow. For more details, see the movr-flask repository's README.

YesYes NoNo