|
1 | | -# Team Infrastructure script |
| 1 | +# DevOps OpenHack Deployment |
2 | 2 |
|
3 | | -## Description |
| 3 | +To initiate a deployment, download both the ARM template (`azuredeploy.json`), the bash script (`deploy.sh`), and the `jenkins/` folder to the same directory in a bash shell. |
4 | 4 |
|
5 | | -This script is used to install the Openhack team environment for the DevOps OpenHack. This script will deploy all the necessary resources and configure the environment for a team to participate in the OpenHack. |
| 5 | +You can download these manually or using `git clone`. For example: |
6 | 6 |
|
7 | | -## Pre-requisites |
| 7 | +```sh |
| 8 | +git clone https://github.com/Azure-Samples/openhack-devops-proctor.git |
| 9 | +``` |
8 | 10 |
|
9 | | -The required pre-requisites for installing a team environment are installed as part of proctor VM Setup. The [setup script](https://raw.githubusercontent.com/Azure-Samples/openhack-devops-proctor/master/provision-vm/proctorVMSetup.sh) lists all pre-reqs along with required versions. |
| 11 | +> **Note:** [Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/overview) will be the easiest to use as it has all of the required tooling (az/sqlcmd/bcp/dig/etc.) installed already. |
10 | 12 |
|
11 | | -## Usage |
| 13 | +## Execute Deployment |
12 | 14 |
|
13 | | - `nohup ./setup.sh -i <subscriptionId> -l <resourceGroupLocation> -n <teamName> -e <teamNumber> ><teamName><teamNumber>.out &` |
| 15 | +***You must be logged in to Azure already using `az login`. The deployment script as shown in the example will not perform a login for you.*** |
14 | 16 |
|
15 | | -**NOTE: You must login against the target subscription, if you have not already done so using the azure cli, prior to executing the setup script for a team.** |
| 17 | +To execute a deployment, you can run deploy.sh with a single parameter (`-l` for location). *e.g.* To deploy into `eastus`: |
16 | 18 |
|
17 | | -### Parameters |
| 19 | +```sh |
| 20 | +bash deploy.sh -l eastus |
| 21 | +``` |
18 | 22 |
|
19 | | -- SubscriptionId - id of the subscription to deploy the team infrastructure to |
20 | | -- resourceGroupLocation - Azure region to deploy to. **_Must be a region that supports ACR, AKS, and KeyVault._** |
21 | | -- teamName - name of the team. This value is used for the base name of all of the resources provisioned in Azure. **_Must be all lowercase alphanumeric characters_** |
22 | | -- teamNumber (optional) - specific number for a team to provision. If this is not specified, a random (3 character + 1 number) will be auto-generated. |
| 23 | +> **Note:** Some Azure services are not available in all locations. A list of known locations will need to be built out over time. |
23 | 24 |
|
24 | | -An example command to provision with a random team number: |
| 25 | +### Optional container-based deployment |
25 | 26 |
|
26 | | -`nohup ./setup.sh -i <subscriptionId> -l eastus -n devopsoh >devopoh-random.out &` |
| 27 | +An optional container deployment is available if you wish to create your environment by supplying a username and password to the deployment script. |
27 | 28 |
|
28 | | -An example command to provision with a specific team number: |
| 29 | +> **Note:** This method does not support MFA-enabled logins. Please clone the repository and use the deployment script manually after executing `az login`. |
29 | 30 |
|
30 | | -`nohup ./setup.sh -i <subscriptionId> -l eastus -n devopsoh -e 1 >devopsoh1.out &` |
| 31 | +1. To execute a container deployment, build a container using the [Dockerfile](Dockerfile) located in the [provision-team](/provision-team/) directory. |
31 | 32 |
|
32 | | -**Important** - The specific team number format should be used when provisioning an event with sequential numbers starting at 1 in order for the sentinels in the proctor environment to work properly. For example: |
| 33 | + ```sh |
| 34 | + docker build -f Dockerfile . -t devopsohdeploy:latest |
| 35 | + ``` |
33 | 36 |
|
34 | | -```bash |
35 | | -nohup ./setup.sh -i <subscriptionId> -l eastus -n devopsohseawa -e 1 >devopsohseawa1.out & |
36 | | -nohup ./setup.sh -i <subscriptionId> -l eastus -n devopsohseawa -e 2 >devopsohseawa2.out & |
37 | | -nohup ./setup.sh -i <subscriptionId> -l eastus -n devopsohseawa -e 3 >devopsohseawa3.out & |
38 | | -``` |
| 37 | +2. Run the container, replacing the tokens `<AZURE_USERNAME>`, `<AZURE_PASSWORD>`, and `<LOCATION>` with a username and password that have the required permissions and a location which can accommodate the required resources. |
39 | 38 |
|
40 | | -The `nohup` command prevents the long running script (`setup.sh`) from being aborted when you exit the shell or logout. |
41 | | -The `&` indicates to run the script in the background to not block your current session. |
| 39 | + ```sh |
| 40 | + docker run -i -t devopsohdeploy:latest /bin/bash -c "export PATH="$PATH:/opt/mssql-tools/bin" && cd /deploy && bash deploy.sh -l <LOCATION> -u '<AZURE_USERNAME>' -p '<AZURE_PASSWORD>'" |
| 41 | + ``` |
42 | 42 |
|
43 | | -The standard out of the script is written to the file indicated after the sign `>`. |
44 | | -Use the `tail` command to from the same path where you ran the setup script to monitor in real time what is written to the file: |
| 43 | +## Requirements |
45 | 44 |
|
46 | | -```bash |
47 | | -tail -f devopsoh1.out |
48 | | -``` |
| 45 | +### Software requirements |
| 46 | + |
| 47 | +The current deployment stack requires the following tooling and versions: |
| 48 | + |
| 49 | +- Azure CLI v2.3.0 (or higher) ([Installation instructions](https://docs.microsoft.com/cli/azure/install-azure-cli)) |
| 50 | +- sqlcmd v17.5.0001.2 Linux (or higher) ([Installaton instructions](https://docs.microsoft.com/sql/linux/sql-server-linux-setup-tools)) |
| 51 | + - bcp |
| 52 | +- dig v9.10.3 (or higher) |
| 53 | +- git |
| 54 | + |
| 55 | +### Azure permissions |
| 56 | + |
| 57 | +- You must be a Contributor or an Owner on the subscription where you would like to deploy. |
| 58 | + |
| 59 | + > **Note**: If you are using a custom role, you must have `write` permissions to create all the resources required for this OpenHack. |
| 60 | + |
| 61 | +### Azure resource requirements |
| 62 | + |
| 63 | +| Azure resource | Pricing tier/SKU | Purpose | |
| 64 | +| ------------------------ | ---------------------- | --------------------------------------- | |
| 65 | +| Azure SQL Database | Standard S3: 100 DTUs | mydrivingDB | |
| 66 | +| Azure Container Registry | Basic | Private container registry | |
| 67 | +| Azure Container Instance | 1 CPU core/1.5 GiB RAM | Jenkins container | |
| 68 | +| Azure Key Vault | Standard | Key vault for database secrets | |
| 69 | +| App Service Plan | Standard S2 | App Service Plan for all Azure Web Apps | |
| 70 | +| Azure Container Instance | 1 CPU core/1.5 GiB RAM | Simulator | |
0 commit comments