move to new repo
This commit is contained in:
Родитель
deba4e6a8c
Коммит
27c0f4aeec
|
@ -0,0 +1,195 @@
|
|||
{
|
||||
"$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 the Storage Account"
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "string",
|
||||
"defaultValue": "West US",
|
||||
"metadata": {
|
||||
"description": "Location of all resources created by this template."
|
||||
}
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Administrator of the VM"
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Administrator of the VM, must satisfy the password requirements"
|
||||
}
|
||||
},
|
||||
"imagePublisher": {
|
||||
"type": "string",
|
||||
"defaultValue": "Canonical",
|
||||
"metadata": {
|
||||
"Description": "Image Publisher"
|
||||
}
|
||||
},
|
||||
"imageOffer": {
|
||||
"type": "string",
|
||||
"defaultValue": "UbuntuServer",
|
||||
"metadata": {
|
||||
"Description": "Image Offer"
|
||||
}
|
||||
},
|
||||
"imageSKU": {
|
||||
"type": "string",
|
||||
"defaultValue": "14.04.2-LTS",
|
||||
"metadata": {
|
||||
"Description": "Image SKU"
|
||||
}
|
||||
},
|
||||
"vmDnsName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "DNS Name for the Public IP. Must be lowercase."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"nicName": "myVMNic",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet-1",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"publicIPAddressName": "myPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmDnsName')]",
|
||||
"vmSize": "Standard_A0",
|
||||
"virtualNetworkName": "MyVNET",
|
||||
"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": "[parameters('imagePublisher')]",
|
||||
"offer": "[parameters('imageOffer')]",
|
||||
"sku" : "[parameters('imageSKU')]",
|
||||
"version":"latest"
|
||||
},
|
||||
"osDisk" : {
|
||||
"name": "osdisk1",
|
||||
"vhd": {
|
||||
"uri": "[[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/','osdisk1spec.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||
"name": "[concat(variables('vmName'),'/newuserscript')]",
|
||||
"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/madhana/azurermtemplates/master/django-app/install_django.sh"
|
||||
],
|
||||
"commandToExecute": "[concat('sh install_django.sh ', parameters('vmDnsName'))]"
|
||||
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"newStorageAccountName": {
|
||||
"value": "uniquestorageaccountname"
|
||||
},
|
||||
"location": {
|
||||
"value": "West US"
|
||||
},
|
||||
"adminUsername": {
|
||||
"value": "username"
|
||||
},
|
||||
"adminPassword": {
|
||||
"value": "strongpassword"
|
||||
},
|
||||
"vmDnsName": {
|
||||
"value": "uniquednsname"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get -y update
|
||||
|
||||
# install Python
|
||||
apt-get -y install python-setuptools
|
||||
|
||||
# install DJango
|
||||
easy_install django
|
||||
|
||||
# install Apache
|
||||
apt-get -y install apache2 libapache2-mod-wsgi
|
||||
|
||||
# create a django app
|
||||
cd /var/www
|
||||
django-admin startproject helloworld
|
||||
|
||||
# Create a new file named views.py in the /var/www/helloworld/helloworld directory. This will contain the view
|
||||
# that renders the "hello world" page
|
||||
echo 'from django.http import HttpResponse
|
||||
def home(request):
|
||||
html = "<html><body>Hello World!</body><html>"
|
||||
return HttpResponse(html)' | tee /var/www/helloworld/helloworld/views.py
|
||||
# Update urls.py
|
||||
echo "from django.conf.urls import patterns, url
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', 'helloworld.views.home', name='home'),
|
||||
)" | tee /var/www/helloworld/helloworld/urls.py
|
||||
|
||||
# Setup Apache
|
||||
echo "<VirtualHost *:80>
|
||||
ServerName $1
|
||||
</VirtualHost>
|
||||
WSGIScriptAlias / /var/www/helloworld/helloworld/wsgi.py
|
||||
WSGIPythonPath /var/www/helloworld" | tee /etc/apache2/sites-available/helloworld.conf
|
||||
|
||||
#enable site
|
||||
a2ensite helloworld
|
||||
|
||||
#restart apache
|
||||
service apache2 reload
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"itemDisplayName": "Deploy a Django app",
|
||||
"description": "This template uses the Azure Linux CustomScript extension to deploy an application. This example creates an Ubuntu VM, does a silent install of Python, Django and Apache, then creates a simple Django app",
|
||||
"summary": "Deploy a Django app",
|
||||
"githubUsername": "madhana",
|
||||
"dateUpdated": "2015-04-10"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
# Deploy a Django app on Ubuntu.
|
||||
|
||||
|
||||
| Deploy to Azure | Author | Template Name | Description |
|
||||
|:-----------------|:--------------------------------| :---------------| :---------------|
|
||||
| <a href="https://azuredeploy.net/" target="_blank"><img src="http://azuredeploy.net/deploybutton_small.png"/></a> | [madhana](https://github.com/madhana) | [Deploy a Python Django app on Ubuntu](https://github.com/azurermtemplates/azurermtemplates/tree/master/deploy-lamp-app) | This template uses the Azure Linux CustomScript extension to deploy a Django application by creating an Ubuntu VM, doing a silent install of Python and Apache, then creating a simple Django application.|
|
||||
|
||||
This template uses the Azure Linux CustomScript extension to deploy an application. This example creates an Ubuntu VM, does a silent install of Python, Apache, then creates a simple Django app.It is essentially the template for the tutorial that can be found here -> http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-python-django-web-app-linux/
|
||||
|
||||
Once the template is deployed, just grab the public IP address of the VM and open it in a browser and you'll see the hello world app running.
|
Загрузка…
Ссылка в новой задаче