Skip to content

Commit

Permalink
Merge pull request Azure#1491 from bcdev-/nxtblockchain
Browse files Browse the repository at this point in the history
Template for NXT blockchain platform.
  • Loading branch information
gatneil authored Sep 16, 2016
2 parents 1865da2 + b0d9482 commit 5746020
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 0 deletions.
41 changes: 41 additions & 0 deletions nxt-blockchain-ubuntu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<img src="images/nxt.png"/>

# Nxt blockchain platform

<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fnxt-on-ubuntu%2Fazuredeploy.json" target="_blank">
<img src="http://azuredeploy.net/deploybutton.png"/>
</a>

Nxt is an advanced blockchain platform which builds on and improves the basic functionality of pioneering cryptocurrencies such as Bitcoin. Cryptocurrency and financial systems are the first widely used applications of blockchain technology, but the blockchain and its associated technology can be used for much more.

Nxt revolutionises the financial technology, crowdfunding and governance industries by providing not only the groundbreaking Nxt crypto-currency, but also a powerful, modular toolset to build with in any way Nxt users can imagine. Nxt gives users complete freedom to create their own applications.

# Template parameters

When deploying the solution, you need to specify the following template parameters:

* `adminUsername`: Username for the Ubuntu VM.
* `adminPassword`: Password for the Ubuntu VM. Azure requires passwords to have One upper case, one lower case, a special character, and a number.
* `hostname`: A public DNS name for the VM. It must be unique.
* `vmSize`: Size of the VM.
* `limitAPItoLocalhost`: False - public Nxt API and GUI are available from anywhere. True - public Nxt API and GUI are available only from localhost.
* `testnet`: Run Nxt on Testnet. Testnet is useful for testing without any financial risk. Mainnet is required for final deployment. Keep in mind that testnet uses a different API port: `6876`.

# Getting started

* Click on 'Deploy to Azure' icon above.
* Complete the template parameters, choose your resource group, accept the terms and click Create. Please, make sure that options `limitAPItoLocalhost` and `testnet` are set to false.
* Wait about 20 minutes for the VM to spin up.
* Navigate to `http://[vmpublicip]:7876/` to access the Nxt GUI.
* Navitage to `http://[vmpublicip]:7876/test` to access the Nxt API.

# Assistance and Troubleshooting

Please visit following links to learn more:

* [Nxt.org](https://www.nxt.org)
* [Nxt Wiki](https://nxtwiki.org/wiki/Main_Page)
* [Nxt helpdesk](https://nxt.org/helpdesk/)
* [Nxt Slack](https://nxtchat.herokuapp.com/)

<img src="images/nxt_screen.png"/>
221 changes: 221 additions & 0 deletions nxt-blockchain-ubuntu/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"defaultValue": "nxt",
"metadata": {
"description": "Admin user name you will use to log on to the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"minLength": 6,
"metadata": {
"description": "Password for the admin user name."
}
},
"hostname": {
"type": "string",
"metadata": {
"description": "Put a unique DNS Name for the Public IP used to access the Virtual Machine."
}
},
"storageAccountNamePrefix": {
"type": "string",
"maxLength": 10,
"metadata": {
"description": "Name prefix of the Storage Account"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D1_V2",
"allowedValues": [
"Standard_D1_V2",
"Standard_D2_V2",
"Standard_D3_V2"
],
"metadata": {
"description": "Size of VM"
}
},
"limitAPItoLocalhost": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Limit API access to localhost [true] or to everyone [false]. Can be changed later in /etc/nxt/nxt.properties."
}
},
"testnet": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Run NXT on Testnet. Testnet is useful for testing without any financial risk. Mainnet is required for final deployment."
}
},
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located."
},
"defaultValue": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/nxt-blockchain-ubuntu/"
}
},
"variables": {
"lowerCaseDNSName": "[toLower(parameters('hostname'))]",
"imagePublisher": "Canonical",
"imageOffer": "UbuntuServer",
"OSDiskName": "osdiskforlinuxsimple",
"newStorageAccountName": "[replace(replace(tolower(concat(parameters('storageAccountNamePrefix'), uniquestring(resourceGroup().id))), '-',''),'.','')]",
"nicName": "VMNic",
"addressPrefix": "10.0.0.0/16",
"subnetName": "subnet",
"subnetPrefix": "10.0.0.0/24",
"storageAccountType": "Standard_LRS",
"publicIPAddressName": "publicIP",
"publicIPAddressType": "Dynamic",
"ubuntuOSVersion": "16.04.0-LTS",
"vmStorageAccountContainerName": "vhds",
"vmName": "[parameters('hostname')]",
"vmSize": "[parameters('vmSize')]",
"virtualNetworkName": "NXTvnet",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
},
"resources": [
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('newStorageAccountName')]",
"location": "[resourceGroup().location]",
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[variables('lowerCaseDNSName')]"
}
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[resourceGroup().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-06-15",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('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": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('ubuntuOSVersion')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk",
"vhd": {
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('newStorageAccountName')), '2015-06-15').primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/nxtdeployscript')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Microsoft.OSTCExtensions",
"type": "CustomScriptForLinux",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[concat(parameters('_artifactsLocation'), '/', 'install_nxt.sh')]"
],
"commandToExecute": "[concat('bash install_nxt.sh ', parameters('limitAPItoLocalhost'), ' ', parameters('testnet'))]"
}
}
}
]
}
27 changes: 27 additions & 0 deletions nxt-blockchain-ubuntu/azuredeploy.parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"value": "nxt"
},
"adminPassword": {
"value": "GEN-PASSWORD"
},
"hostname": {
"value": "nxtHostname"
},
"storageAccountNamePrefix": {
"value": "storage"
},
"vmSize": {
"value": "Standard_D1_V2"
},
"limitAPItoLocalhost": {
"value": false
},
"testnet": {
"value": false
}
}
}
Binary file added nxt-blockchain-ubuntu/images/nxt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nxt-blockchain-ubuntu/images/nxt_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions nxt-blockchain-ubuntu/install_nxt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

apt-add-repository -y ppa:nxtcrypto/nxt > /var/log/nxt_deployment.stdout 2> /var/log/nxt_deployment.stderr
apt-get -y update > /var/log/nxt_deployment.stdout 2> /var/log/nxt_deployment.stderr
apt-get -y dist-upgrade > /var/log/nxt_deployment.stdout 2> /var/log/nxt_deployment.stderr
apt-get -y install nxt unattended-upgrades > /var/log/nxt_deployment.stdout 2> /var/log/nxt_deployment.stderr

if [ $1 == "False" ]
then
echo "nxt.apiServerHost=0.0.0.0" >> /etc/nxt/nxt.properties
echo "nxt.allowedBotHosts=*" >> /etc/nxt/nxt.properties
fi

if [ $2 == "True" ]
then
echo "nxt.isTestnet=true" >> /etc/nxt/nxt.properties
else
apt-get -y install nxt-bootstrap-blockchain > /var/log/nxt_deployment.stdout 2> /var/log/nxt_deployment.stderr
fi

systemctl restart nxt > /var/log/nxt_deployment.stdout 2> /var/log/nxt_deployment.stderr
exit 0

7 changes: 7 additions & 0 deletions nxt-blockchain-ubuntu/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"itemDisplayName": "NXT blockchain platform on Ubuntu",
"description": "Nxt is an open source second generation blockchain that provides tools for a decentralized financial platform",
"summary": "Deploy NXT on Ubuntu to access the power of the NXT blockchain and modular toolset",
"githubUsername": "bcdev-",
"dateUpdated": "2016-03-28"
}

0 comments on commit 5746020

Please sign in to comment.