Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOIN full node on Ubuntu #1490

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions moin-on-ubuntu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# MOIN Public Blockchain Node

This Microsoft Azure template deploys a single MOIN client which will connect to the public MOIN network.

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

# Template Parameters

When you click the Deploy to Azure icon above, you need to specify the following template parameters:

* `adminUsername`: This is the account for connecting to your MOIN host.
* `adminPassword`: This is your password for the host. Azure requires passwords to have One upper case, one lower case, a special character, and a number.
* `dnsLabelPrefix`: This is used as both the VM name and DNS name of your public IP address. Please ensure an unique name.
* `installMethod`: This tells Azure how to install the software. The default is using the Binaries. You may choose to install from Source, but be advised this method takes substantially longer to complete.
* `vmSize`: This is the size of the VM to use. Recommendations: Use the A series for Binaries installs, and D series for installations from Source.

# Getting Started Tutorial

* Click the `Deploy to Azure` icon above
* Complete the template parameters, choose your resource group, accept the terms and click Create
* Wait about 15 minutes for the VM to spin up and install the software
* Connect to the VM via SSH using the DNS name assigned to your Public IP
* If you wish to launch MOIN run 'moind'
210 changes: 210 additions & 0 deletions moin-on-ubuntu/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"dnsLabelPrefix": {
"type": "string",
"metadata": {
"description": "Hostname assigned to the Public IP, also used as the VM Name. Must be lowercase. It should match with the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$ or it will raise an error."
}
},
"installMethod": {
"type": "string",
"defaultValue": "From_Binaries",
"allowedValues": [
"From_Binaries",
"From_Source"
],
"metadata": {
"description": "Method to install MOIN. From_Binaries: Official binaries + blockchain. From_Source: official MOIN repo on GitHub."
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A1",
"allowedValues": [
"Standard_A1",
"Standard_A2",
"Standard_A3",
"Standard_D1",
"Standard_D2",
"Standard_D3"
],
"metadata": {
"description": "Size of VM"
}
}
},
"variables": {
"imagePublisher": "Canonical",
"imageOffer": "UbuntuServer",
"OSDiskName": "MOINOSDisk",
"imageSKU": "14.04.4-LTS",
"nicName": "MOINNic",
"addressPrefix": "10.0.0.0/16",
"subnetName": "MOINSubnet",
"subnetPrefix": "10.0.0.0/24",
"storageAccountType": "Standard_LRS",
"storageAccountName": "[concat(uniquestring(resourceGroup().id, 'MOIN'))]",
"publicIPAddressName": "MOINPublicIP",
"publicIPAddressType": "Dynamic",
"vmStorageAccountContainerName": "vhds",
"vmName": "[parameters('dnsLabelPrefix')]",
"virtualNetworkName": "MOINVNET",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
"apiVersion": "2015-06-15"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "[variables('apiVersion')]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use raw string API versions instead of variables

"location": "[resourceGroup().location]",
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsLabelPrefix')]"
}
}
},
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "[variables('apiVersion')]",
"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": "[variables('apiVersion')]",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "[variables('imagePublisher')]",
"offer": "[variables('imageOffer')]",
"sku": "[variables('imageSKU')]",
"version": "latest"
},
"osDisk": {
"name": "osdisk",
"vhd": {
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": "true",
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/newuserscript')]",
"location": "[resourceGroup().location]",
"apiVersion": "[variables('apiVersion')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Microsoft.OSTCExtensions",
"type": "CustomScriptForLinux",
"typeHandlerVersion": "1.4",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/moin-on-ubuntu/build_moin.sh"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

],
"commandToExecute": "[concat('sh build_moin.sh ', parameters('installMethod'), ' ', parameters('adminUsername'))]"
}
}
}
]
}
21 changes: 21 additions & 0 deletions moin-on-ubuntu/azuredeploy.parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dnsLabelPrefix": {
"value": "GEN-UNIQUE-11"
},
"adminUsername": {
"value": "azureuser"
},
"adminPassword": {
"value": "GEN-PASSWORD"
},
"installMethod": {
"value": "From_Source"
},
"vmSize": {
"value": "Standard_A1"
}
}
}
64 changes: 64 additions & 0 deletions moin-on-ubuntu/build_moin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
set -x

echo "initializing MOIN installation"

date
ps axjf

AZUREUSER=$2
HOMEDIR="/home/$AZUREUSER"
MOINPATH="$HOMEDIR/.moin"
VMNAME=`hostname`
echo "User: $AZUREUSER"
echo "User home dir: $HOMEDIR"
echo "User MOIN path: $MOINPATH"
echo "vmname: $VMNAME"


if [ $1 = 'From_Source' ]; then
## Compile from Source
sudo apt-get update
sudo apt-get -y install git build-essential libssl-dev libdb-dev libdb++-dev libboost-all-dev libqrencode-dev unzip pwgen
cd /usr/local/src/
sudo git clone https://github.com/MOIN/moin
cd moin/src
sudo make -f makefile.unix

sudo cp moind /usr/bin/moind

else
## Download Binaries
sudo apt-get update
sudo apt-get -y install git build-essential libssl-dev libdb-dev libdb++-dev libboost-all-dev libqrencode-dev unzip pwgen
cd /usr/local/src/
DOWNLOADFILE=$(curl -s https://api.github.com/repos/MOIN/MOIN/releases | grep browser_download_url | grep linux64 | head -n 1 | cut -d '"' -f 4)
DOWNLOADNAME=$(curl -s https://api.github.com/repos/MOIN/MOIN/releases | grep name | grep linux64 | head -n 1 | cut -d '"' -f 4)
sudo wget $DOWNLOADFILE
sudo unzip $DOWNLOADNAME
sudo cp moind /usr/bin/moind
fi

# Create Client Directory
if [ ! -e "$MOINPATH" ]
then
su - $AZUREUSER -c "mkdir $MOINPATH"
fi

# Download Blockchain
su - $AZUREUSER -c "cd $MOINPATH; wget https://github.com/MOIN/blockchain/releases/download/latest/blockchain.zip"
su - $AZUREUSER -c "cd $MOINPATH; unzip blockchain.zip"

# Create configuration File
su - $AZUREUSER -c "touch $MOINPATH/moin.conf"
rpcu=$(pwgen -ncsB 35 1)
rpcp=$(pwgen -ncsB 75 1)
echo "rpcuser="$rpcu"
rpcpassword="$rpcp"
daemon=1" > $MOINPATH/moin.conf

# Start MOIN Client
su - $AZUREUSER -c "moind"

echo "completed MOIN install $$"
exit 0
7 changes: 7 additions & 0 deletions moin-on-ubuntu/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"itemDisplayName": "MOIN on Ubuntu",
"description": "MOIN is a project dedicated to the exploration of cutting-edge decentralized technologies with a peer-to-peer electronic cash system at its core.",
"summary": "Deploy MOIN on Ubuntu to access services running on the blockchain",
"githubUsername": "KingCaper",
"dateUpdated": "2016-03-28"
}