Project Jackson uses Traffic Manager to route a specific URL to the correct region. In order to create these endpoints, the endpoint_deploy.json
needs to be run. To do this, run:
az group deployment create --template-file infrastructure/global-resoruces/endpoint_deploy.json --resource-group your-resource-group --parameters traffic_manager_endpoints=app1,app2 traffic_manager_endpoint_locations=eastus,westus
with your-resource-group
as the name of the resource group you are creating the global resources in, app1 being the target for an endpoint that correlates to the azure region specified by the first parameter in the traffic_manager_endpoint_locations
parameter. For example, app1
is created in eastus
and app2
is created in westus
.
Project Jackson uses a CosmosDB instance enabled with the MongoDB API and an Azure Container Registry to push and pull images. These are global resources and should be deployed independently of application infrastructure. Deploy your own using the button below, which uses the included ARM template.
Note: This is optional, but is a good way to injest some sample data without needing to manually create it.
In this section we'll explain how to populate the CosmosDB instance that was created above with sample data.
- Install the latest Azure CLI
- Install MongoDB:
- Windows: Install MongoDB Community Edition on Windows
- MacOS: From a command line, run
brew install mongodb
- Linux: From command line, run
apt-get install mongodb
- Open a shell in the project root directory (the next steps depend on this)
- Locate the provisioned CosmosDB instance in the Azure Portal
- Open the Cosmos Connection String blade
- Make sure the Cosmos DB resource is already created as described above
- From Bash command line, run
load_env.sh
. This will write/load any needed variables to thevars.env
fileRESOURCE_GROUP
- the Azure resource group nameCOSMOSDB_NAME
- the CosmosDB collection name (which is case sensitive)COSMOSDB_PASSWORD
- the CosmosDB's password (needed for when you load the data into Cosmos)
- Load
vars.env
into your environment or the VM where the app is being built locallysource vars.env
- or in your chosen IDE, set your environment variables within your project
- NB: there will also be a DB_NAME and DB_CONNSTR for the Spring application (see the database section below in Application Configuration)
- Switch into the project
data
directory:cd data
- Log into Azure:
az login
- If you have multiple subscriptions, confirm that the project subscription is active:
az account show
az account set --subscription <subscription name/ID>
- Open a Bash command line
- Download and prepare the required IMDb data files:
data/getdata.sh
- Before starting to import data make sure the step
Set up your environment variables
is completed. - Import the data into Cosmos collections
data/importdata.sh
- Copy the Cosmos DB connection string from the "Connection String" blade
- Start the MongoDB CLI with this command:
mongo <connection string>
- Begin executing MongoDB commands, such as:
use moviesdb
show collections
db.titles.count()
db.titles.find ({primaryTitle: "Casablanca"})