movie-db-java-on-azure/deployment/README.md

6.8 KiB

Development Environment Setup

The following instructions contain the required steps to install the necessary utilities and setup your development environment in order to run the sample application which is detailed in the parent README file.

The steps to setup your development environment are broken into two sections:

STEP 1 - Install the required developer utilities for your operating system by following the instructions in below sections:

If you are using a MacOS system

  1. Install the Azure CLI by using the instructions at https://docs.microsoft.com/en-us/cli/azure/install-azure-cli.

  2. Install kubectl by running below command:

    sudo az acs kubernetes install-cli
    
  3. Install Homebrew from https://brew.sh/.

  4. Install jq using Homebrew:

    brew install jq
    
  5. Install gettext using Homebrew:

    brew install gettext
    brew link --force gettext
    
  6. Install maven using Homebrew:

    brew install maven
    

If you are using a Linux system

  1. Install the Azure CLI by using the instructions at https://docs.microsoft.com/en-us/cli/azure/install-azure-cli.

  2. Install the Kubernetes CLI (kubectl) by using the instructions at https://kubernetes.io/docs/getting-started-guides/ubuntu/:

    az acs kubernetes install-cli --install-location .
    sudo mv kubectl /usr/local/bin/kubectl
    
  3. Install jq by using the instructions at https://stedolan.github.io/jq/download/:

    sudo apt-get install jq
    
  4. Install Maven:

    sudo apt-get install maven
    

If you are using a Windows system

  1. Install python (preferably 3.6). In the python setup wizard, check pip during the Optional Features step.

  2. Install Azure CLI by running below command:

    pip install azure-cli
    

    NOTES:

    • We run Azure resource provisioning script in Git Bash. To smoothly run Azure CLI commands in Git Bash, Azure CLI has to be installed via pip.
    • The Azure CLI installed via MSI insatller doesn't work well in Git Bash.
  3. Install kubectl by running below Azure CLI command with administrator privilege:

    az acs kubernetes install-cli
    
  4. Install Chocolatey.

  5. Install Maven using Chocolatey:

    choco install Maven
    
  6. Install jq using Chocolatey:

    choco install jq
    

STEP 2 - Clone the sample application and customize it for your environment

  1. Open https://github.com/Microsoft/movie-app-java-on-azure in a web browser and create a private fork of the sample application.

  2. Open a console window and clone your forked repo on your local system:

    git clone https://github.com/<your-github-id>/movie-app-java-on-azure
    
  3. Open the ~/deployment/config.json in a text editor:

    a. Locate the following configuration settings, and modify the value of the GITHUB_REPO_OWNER key/value pair with your GitHub account name:

    "repo": [
       {
          "comment": "GitHub account name.",
          "key": "GITHUB_REPO_OWNER",
          "value": "<your-github-id>"
       },
       {
          "comment": "GitHub repository name.",
          "key": "GITHUB_REPO_NAME",
          "value": "movie-app-java-on-azure"
       }
    ],
    

    b. Locate the following configuration settings, and modify the value of the GROUP_SUFFIX key/value pair with a unique ID; for example "123456":

    "optional": [
       {
          "comment": "Optional resource group suffix to avoid naming conflict.",
          "key": "GROUP_SUFFIX",
          "value": "<some-random-suffix>"
       }
    ]
    

    c. Save and close the ~/deployment/config.json file. Suggest to commit these changes to GitHub so that it won't be lost.

  4. Login to your Azure account and specify which subscription to use:

    az login
    az account set --subscription "<your-azure-subscription>"
    

    NOTES:

    • You can use either a subscription name or id when specifying which subscription to use.
    • To obtain a list of your subscriptions, type az account list.
  5. Setup environment variables for passwords.

       export MYSQL_PASSWORD=<your-mysql-admin-password>
       export JENKINS_PASSWORD=<your-jenkins-password>
    

    NOTES:

    • MYSQL_PASSWORD will be used to create a MySQL database in Azure, which must meet password complexity requirements; for example, you should use a mixture of uppercase letters, lowercase letters, numbers, and punctuation.
    • The default MySQL admin username is AzureUser; you can change it in ~/deployment/config.json.
    • JENKINS_PASSWORD will be used to deploy a Jenkins cluster in ACS; the Jenkins admin username is jenkins.