update for new API and imageReference property
Signed-off-by: Andrew Weiss <andrew.weiss@microsoft.com>
This commit is contained in:
Родитель
a891e6204c
Коммит
561d77b00a
|
@ -0,0 +1,223 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"newStorageAccountName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "Name of new Storage Account that will hold VM OS disk"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "East US",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "Azure Region to which template and its resources will be deployed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminUsername": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "Username assigned to new local user on VM"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminPassword": {
|
||||||
|
"type": "securestring",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "Password assigned to new local user on VM"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vmDnsName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "Hostname and Azure DNS name that the VM will be assigned"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dockerPort": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "4243",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "Azure VM Endpoint that will be made available and used by the Docker VM Extension"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"githubClientKey": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "GitHub application client key required by the Drone CI components for synchronizing repositories"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"githubSecret": {
|
||||||
|
"type": "securestring",
|
||||||
|
"metadata": {
|
||||||
|
"Description": "GitHub application client secret required by the Drone CI components for synchronizing repositories"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"nicName": "myVMNic",
|
||||||
|
"addressPrefix": "10.0.0.0/16",
|
||||||
|
"subnetName": "Subnet-1",
|
||||||
|
"subnetPrefix": "10.0.0.0/24",
|
||||||
|
"storageAccountType": "Standard_LRS",
|
||||||
|
"publicIPAddressName": "myPublicIPTest",
|
||||||
|
"publicIPAddressType": "Dynamic",
|
||||||
|
"vmStorageAccountContainerName": "vhds",
|
||||||
|
"vmName": "[parameters('vmDnsName')]",
|
||||||
|
"vmSize": "Standard_A3",
|
||||||
|
"virtualNetworkName": "droneCINET",
|
||||||
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||||
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Storage/storageAccounts",
|
||||||
|
"name": "[parameters('newStorageAccountName')]",
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"properties": {
|
||||||
|
"accountType": "[variables('storageAccountType')]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/publicIPAddresses",
|
||||||
|
"name": "[variables('publicIPAddressName')]",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"properties": {
|
||||||
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||||
|
"dnsSettings": {
|
||||||
|
"domainNameLabel": "[parameters('vmDnsName')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/virtualNetworks",
|
||||||
|
"name": "[variables('virtualNetworkName')]",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"properties": {
|
||||||
|
"addressSpace": {
|
||||||
|
"addressPrefixes": [
|
||||||
|
"[variables('addressPrefix')]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subnets": [
|
||||||
|
{
|
||||||
|
"name": "[variables('subnetName')]",
|
||||||
|
"properties": {
|
||||||
|
"addressPrefix": "[variables('subnetPrefix')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkInterfaces",
|
||||||
|
"name": "[variables('nicName')]",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||||
|
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ipConfigurations": [
|
||||||
|
{
|
||||||
|
"name": "ipconfig1",
|
||||||
|
"properties": {
|
||||||
|
"privateIPAllocationMethod": "Dynamic",
|
||||||
|
"publicIPAddress": {
|
||||||
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||||
|
},
|
||||||
|
"subnet": {
|
||||||
|
"id": "[variables('subnetRef')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"name": "[variables('vmName')]",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
|
||||||
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "[variables('vmSize')]"
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computername": "[variables('vmName')]",
|
||||||
|
"adminUsername": "[parameters('adminUsername')]",
|
||||||
|
"adminPassword": "[parameters('adminPassword')]"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "Canonical",
|
||||||
|
"offer": "UbuntuServer",
|
||||||
|
"sku": "14.04.2-LTS",
|
||||||
|
"version": "latest"
|
||||||
|
},
|
||||||
|
"destinationVhdsContainer": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/')]"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"name": "osdisk",
|
||||||
|
"vhd": {
|
||||||
|
"uri": "[concat('http://', parameters('newStorageAccountName'), '.blob.core.windows.net/vhds/', 'osdisk.vhd')]"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite",
|
||||||
|
"createOption": "FromImage"
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(variables('vmName'),'/DockerExtension')]",
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Compute/virtualMachines/',variables('vmName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"publisher": "MSOpenTech.Extensions",
|
||||||
|
"type": "DockerExtension",
|
||||||
|
"typeHandlerVersion": "0.6",
|
||||||
|
"settings": {
|
||||||
|
"installonly": "true",
|
||||||
|
"dockerport": "[parameters('dockerPort')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(variables('vmName'),'/installDrone')]",
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.OSTCExtensions",
|
||||||
|
"type": "CustomScriptForLinux",
|
||||||
|
"typeHandlerVersion": "1.2",
|
||||||
|
"settings": {
|
||||||
|
"fileUris": [
|
||||||
|
"https://raw.githubusercontent.com/azure/azure-quickstart-templates/master/drone-ubuntu-vm/install_drone.sh"
|
||||||
|
],
|
||||||
|
"commandToExecute": "[concat('sh install_drone.sh ', parameters('githubClientKey'), ' ', parameters('githubSecret'))]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentParameters.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"newStorageAccountName": {
|
||||||
|
"value": "armdronetest01"
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"value": "East US"
|
||||||
|
},
|
||||||
|
"adminUsername": {
|
||||||
|
"value": "myuser"
|
||||||
|
},
|
||||||
|
"adminPassword": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"vmDnsName": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"githubClientKey": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"githubSecret": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# set local variables
|
||||||
|
GITHUB_CLIENT=$1
|
||||||
|
GITHUB_SECRET=$2
|
||||||
|
|
||||||
|
# retrieve latest package updates
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
apt-get install -y linux-image-extra-$(uname -r) libsqlite3-dev
|
||||||
|
|
||||||
|
# configure Docker for AUFS
|
||||||
|
sed -i 's/^#DOCKER_OPTS.*/DOCKER_OPTS="-s aufs"/' /etc/default/docker
|
||||||
|
|
||||||
|
# retrieve and install Drone package
|
||||||
|
wget downloads.drone.io/master/drone.deb
|
||||||
|
dpkg --install drone.deb
|
||||||
|
rm -f drone.deb
|
||||||
|
|
||||||
|
# modify drone.toml
|
||||||
|
echo -e "\n\n[github]" >> /etc/drone/drone.toml
|
||||||
|
echo "client=\"$GITHUB_CLIENT\"" >> /etc/drone/drone.toml
|
||||||
|
echo "secret=\"$GITHUB_SECRET\"" >> /etc/drone/drone.toml
|
||||||
|
echo "open=false" >> /etc/drone/drone.toml
|
||||||
|
echo "\n\n[worker]" >> /etc/drone/drone.toml
|
||||||
|
echo "nodes=[" >> /etc/drone/drone.toml
|
||||||
|
echo " \"unix:///var/run/docker.sock\"," >> /etc/drone/drone.toml
|
||||||
|
echo " \"unix:///var/run/docker.sock\"" >> /etc/drone/drone.toml
|
||||||
|
echo "]" >> /etc/drone/drone.toml
|
||||||
|
|
||||||
|
# restart
|
||||||
|
reboot
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"itemDisplayName": "Drone on Ubuntu VM",
|
||||||
|
"description": "This template provisions an instance of Ubuntu 14.04 LTS with the Docker Extension and Drone CI package.",
|
||||||
|
"summary": "Ubuntu VM template with Drone CI",
|
||||||
|
"githubUsername": "anweiss",
|
||||||
|
"dateUpdated": "2015-04-27"
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Deploy an Ubuntu VM with Drone CI.
|
||||||
|
|
||||||
|
|
||||||
|
| Deploy to Azure | Author | Template Name | Description |
|
||||||
|
|:-----------------|:--------------------------------| :---------------| :---------------|
|
||||||
|
| <a href="https://azuredeploy.net/" target="_blank"><img src="http://azuredeploy.net/deploybutton_small.png"/></a> | [anweiss](https://github.com/anweiss) | [Drone CI on Ubuntu Azure VM](https://github.com/azure/azure-quickstart-templates/tree/master/drone-ubuntu-vm) | This template provisions an Ubuntu Linux VM on Azure and bootstraps it with the latest release of the Drone continuous integration toolset |
|
Загрузка…
Ссылка в новой задаче