Compare commits
No commits in common. "master" and "lnsupport" have entirely different histories.
181
README.md
181
README.md
@ -2,19 +2,182 @@
|
||||
|
||||
Instructions to deploy BTCPay Server in [production environment](https://github.com/btcpayserver/btcpayserver-docker/tree/master/Production) hosted in Microsoft Azure.
|
||||
|
||||
You can click on this button to view what will be deployed by your deployment:
|
||||
|
||||
[](http://armviz.io/#?load=https%3A%2F%2Fraw.githubusercontent.com%2Fbtcpayserver%2Fbtcpayserver-azure%2Fmaster%2Fazuredeploy.json)
|
||||
|
||||
The following instructions assume you have [Microsoft Azure](https://azure.microsoft.com/) subscription.
|
||||
|
||||
You can click on this button to deploy BTCPayServer:
|
||||
|
||||
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fbtcpayserver%2Fbtcpayserver-azure%2Fmaster%2Fazuredeploy.json)
|
||||
|
||||
You can see our video for an overview:
|
||||
|
||||
[](http://www.youtube.com/watch?v=Bxs95BdEMHY "BTCPay - One Click Setup")
|
||||
|
||||
You can find more details about the tooling install in the Virtual Machine in [the tooling section of BTCPayServer-Docker repository](https://github.com/btcpayserver/btcpayserver-docker/blob/master/README.md#tooling).
|
||||
# Deploy via Microsoft Azure Portal
|
||||
|
||||
Click on this button and follow instructions:
|
||||
|
||||
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fbtcpayserver%2Fbtcpayserver-azure%2Fmaster%2Fazuredeploy.json)
|
||||
|
||||
# Deploy with PowerShell
|
||||
|
||||
## Step 1: Download and install Azure PowerShell
|
||||
|
||||
You can do it by [using PowerShell command line](https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-5.0.0) or manually via [Web Platform Installer or MSI](https://docs.microsoft.com/en-us/powershell/azure/other-install?view=azurermps-5.0.0).
|
||||
|
||||
## Step 2: Authenticate to Azure
|
||||
|
||||
In PowerShell, you first need to authenticate to azure:
|
||||
|
||||
```
|
||||
# This will popup a windows to authenticate to azure
|
||||
Login-AzureRmAccount
|
||||
```
|
||||
|
||||
If you have multiple subscriptions, select the one you want:
|
||||
|
||||
```
|
||||
# List your subscriptions
|
||||
Get-AzureRmSubscription
|
||||
|
||||
# Select the one you want
|
||||
Get-AzureRmSubscription –SubscriptionId "your subscription" | Select-AzureRmSubscription
|
||||
```
|
||||
|
||||
## Step 3: Run the deployment
|
||||
|
||||
Create a new BTCPay Server instance:
|
||||
|
||||
```
|
||||
.\deployOnAzure.ps1 -ResourceGroupName "myawesomebtcpay" -Network "mainnet"
|
||||
```
|
||||
|
||||
Valid Network values are:
|
||||
|
||||
* mainnet
|
||||
* testnet
|
||||
* regtest
|
||||
|
||||
For ResourceGroupName, use only alphabetic lower case.
|
||||
|
||||
This might take around 5 minutes.
|
||||
|
||||
It will print you the DNS name of your server `myawesomebtcpay.southcentralus.cloudapp.azure.com`, you can browse to it to enjoy your BTCPay instance.
|
||||
|
||||
# Deploy on Linux
|
||||
|
||||
TODO: Write shell scripts using [Az tool](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-ssh-secured-vm-from-template), [other link](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-deploy-cli), [other link](https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/azure-resource-manager/resource-group-template-deploy-cli.md), [best link](http://markheath.net/post/deploying-arm-templates-azure-cli).
|
||||
|
||||
# How to change the domain name
|
||||
|
||||
By default, you will have a domain name assigned ending with `xxx.cloudapp.azure.com`. Because Let's Encrypt does not allow us to get HTTPS certificate for the `azure.com` domain, you need your own domain.
|
||||
|
||||
Then, add a CNAME record in your name server pointing to `xxx.cloudapp.azure.com`.
|
||||
|
||||
Connect then with SSH to your VM and run
|
||||
|
||||
```
|
||||
sudo su -
|
||||
changedomain.sh blah.example.com
|
||||
```
|
||||
|
||||
This will change the settings of BTCPay and NGinx to use your domain. Upon restart, a new certificate for your domain will be requested by Let's encrypt.
|
||||
|
||||
# How to update BTCPay
|
||||
|
||||
Just pull the latest changes of the docker-compose and restart the docker service.
|
||||
|
||||
```
|
||||
sudo su -
|
||||
btcpay-update.sh
|
||||
```
|
||||
|
||||
# How to restart BTCPay
|
||||
|
||||
Reboot docker:
|
||||
|
||||
```
|
||||
sudo su -
|
||||
btcpay-restart.sh
|
||||
```
|
||||
|
||||
Or reboot the server:
|
||||
|
||||
```
|
||||
sudo su -
|
||||
reboot
|
||||
```
|
||||
|
||||
# Under the hood
|
||||
|
||||
Here are the step on provisioning done by Azure (so you can do it yourelf):
|
||||
|
||||
* Azure provision a new virtual machine
|
||||
* Then copy all the sh files of this repository inside the new virtual machine
|
||||
* Azure then execute `entrypoint.sh` passing the following arguments taken from the wizard:
|
||||
1. The initial DNS name
|
||||
2. The network (mainnet, testnet, regtest)
|
||||
3. Let's encrypt email
|
||||
4. Supported crypto currencies separated by '-'
|
||||
5. Docker repository url used for fetching the docker-compose
|
||||
6. The branch of this repository
|
||||
* `entrypoint.sh` does the following actions:
|
||||
1. Copy the parameters inside `/etc/environment` and `/etc/profile.d/btcpay-env.sh` so they can be accessed via environment variable globally
|
||||
2. Add also those parameters in the `.env` file which will be used by the `docker-compose`
|
||||
3. Install `docker-compose` and `git`
|
||||
4. Clone the `btcpayserver-docker` repository
|
||||
5. Configure upstart in `/etc/init/start_containers.conf` to start `docker-compose` if the machine reboot
|
||||
6. Start `docker-compose` in the directory of the `.env` as working directory
|
||||
7. Create symbolic links to `/usr/bin` to the other `btcpay-*.sh` utility scripts
|
||||
|
||||
Example of `/etc/environment`:
|
||||
|
||||
```
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
|
||||
AZURE_DNS="dwoiqdwqb.westeurope.cloudapp.azure.com"
|
||||
BTCPAY_DOCKER_COMPOSE="/var/lib/waagent/custom-script/download/0/btcpayserver-docker/Production/docker-compose.btc-ltc.yml"
|
||||
BTCPAY_ENV_FILE="/var/lib/waagent/custom-script/download/0/.env"
|
||||
DOWNLOAD_ROOT="/var/lib/waagent/custom-script/download/0"
|
||||
```
|
||||
|
||||
Example of `/etc/profile.d/btcpay-env.sh`:
|
||||
|
||||
```
|
||||
export AZURE_DNS="dwoiqdwqb.westeurope.cloudapp.azure.com"
|
||||
export BTCPAY_DOCKER_COMPOSE="/var/lib/waagent/custom-script/download/0/btcpayserver-docker/Production/docker-compose.btc-ltc.yml"
|
||||
export DOWNLOAD_ROOT="/var/lib/waagent/custom-script/download/0"
|
||||
export BTCPAY_ENV_FILE="/var/lib/waagent/custom-script/download/0/.env"
|
||||
```
|
||||
|
||||
Example of `.env` file:
|
||||
|
||||
```
|
||||
BTCPAY_HOST=test-btc-ltc.forkbitpay.ninja
|
||||
ACME_CA_URI=https://acme-v01.api.letsencrypt.org/directory
|
||||
NBITCOIN_NETWORK=testnet
|
||||
LETSENCRYPT_EMAIL=me@example.com
|
||||
```
|
||||
|
||||
Example of `/etc/init/start_containers.conf` file:
|
||||
|
||||
```
|
||||
# File is saved under /etc/init/start_containers.conf
|
||||
# After file is modified, update config with : $ initctl reload-configuration
|
||||
|
||||
description "Start containers (see http://askubuntu.com/a/22105 and http://askubuntu.com/questions/612928/how-to-run-docker-compose-at-bootup)"
|
||||
|
||||
start on filesystem and started docker
|
||||
stop on runlevel [!2345]
|
||||
|
||||
# if you want it to automatically restart if it crashes, leave the next line in
|
||||
# respawn # might cause over charge
|
||||
|
||||
script
|
||||
. /etc/profile.d/btcpay-env.sh
|
||||
cd "`dirname $BTCPAY_ENV_FILE`"
|
||||
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d
|
||||
end script
|
||||
```
|
||||
|
||||
Note that `AZURE_DNS` is not really used anywhere except for debugging purpose.
|
||||
When you want to start/stop docker, for the environment variables in `.env` to be taken into account, you need to start from its folder:
|
||||
|
||||
```
|
||||
cd "`dirname $BTCPAY_ENV_FILE`"
|
||||
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up
|
||||
```
|
||||
@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
apt-get update 2>error
|
||||
apt-get install -y git 2>error
|
||||
fi
|
||||
|
||||
: "${BTCPAY_HOST:=$1}"
|
||||
: "${NBITCOIN_NETWORK:=$2}"
|
||||
: "${LETSENCRYPT_EMAIL:=$3}"
|
||||
: "${BTCPAY_DOCKER_REPO:=$4}"
|
||||
: "${BTCPAY_DOCKER_REPO_BRANCH:=$5}"
|
||||
: "${LIGHTNING_ALIAS:=$6}"
|
||||
: "${BTCPAYGEN_CRYPTO1:=$7}"
|
||||
: "${BTCPAYGEN_CRYPTO2:=$8}"
|
||||
: "${BTCPAYGEN_CRYPTO3:=$9}"
|
||||
: "${BTCPAYGEN_CRYPTO4:=${10}}"
|
||||
: "${BTCPAYGEN_CRYPTO5:=${11}}"
|
||||
: "${BTCPAYGEN_CRYPTO6:=${12}}"
|
||||
: "${BTCPAYGEN_CRYPTO7:=${13}}"
|
||||
: "${BTCPAYGEN_CRYPTO8:=${14}}"
|
||||
: "${BTCPAYGEN_CRYPTO9:=${15}}"
|
||||
: "${BTCPAYGEN_LIGHTNING:=${16}}"
|
||||
: "${BTCPAYGEN_REVERSEPROXY:=nginx}"
|
||||
|
||||
CUSTOM_SSH_KEY="${17}"
|
||||
BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage"
|
||||
|
||||
if [[ "$CUSTOM_SSH_KEY" ]]; then
|
||||
echo "" >> /root/.ssh/authorized_keys
|
||||
echo "# User key" >> /root/.ssh/authorized_keys
|
||||
echo "$CUSTOM_SSH_KEY" >> /root/.ssh/authorized_keys
|
||||
echo "Custom SSH Key added to /root/.ssh/authorized_keys"
|
||||
fi
|
||||
sed -i -e '/^PasswordAuthentication / s/ .*/ no/' /etc/ssh/sshd_config
|
||||
userdel -r -f temp
|
||||
|
||||
cd /root
|
||||
# Configure BTCPAY to have access to SSH
|
||||
BTCPAY_ENABLE_SSH=true
|
||||
|
||||
# Clone btcpayserver-docker
|
||||
git clone $BTCPAY_DOCKER_REPO
|
||||
cd btcpayserver-docker
|
||||
git checkout $BTCPAY_DOCKER_REPO_BRANCH
|
||||
|
||||
. ./btcpay-setup.sh -i
|
||||
|
||||
[ -x "$(command -v /etc/init.d/sshd)" ] && nohup /etc/init.d/sshd restart &
|
||||
[ -x "$(command -v /etc/init.d/ssh)" ] && nohup /etc/init.d/ssh restart &
|
||||
272
azuredeploy.json
272
azuredeploy.json
@ -1,17 +1,23 @@
|
||||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.1.0.0",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"sshKey": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"defaultValue": "",
|
||||
"defaultValue": "btcpayserver",
|
||||
"metadata": {
|
||||
"description": "SSH Key which will be granted access to the VM (optional)"
|
||||
"description": "The name of the SSH user."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "The name of the SSH password."
|
||||
}
|
||||
},
|
||||
"notificationEmail": {
|
||||
"type": "string",
|
||||
"defaultValue": "me@example.com",
|
||||
"defaultValue": "yourname@example.com",
|
||||
"metadata": {
|
||||
"description": "Email used by Let's encrypt to notify you about certificate expiration (optional)"
|
||||
}
|
||||
@ -32,209 +38,40 @@
|
||||
],
|
||||
"defaultValue": "mainnet",
|
||||
"metadata": {
|
||||
"description": "Choose mainnet for production, or testnet for testing"
|
||||
"description": "Choose nainnet for production, or testnet for testing"
|
||||
}
|
||||
},
|
||||
"supportedCrypto1": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "btc",
|
||||
"acceptBTC": {
|
||||
"type": "bool",
|
||||
"defaultValue": true,
|
||||
"metadata": {
|
||||
"description": "Choose a crypto currency to support"
|
||||
"description": "Accept Bitcoin"
|
||||
}
|
||||
},
|
||||
"supportedCrypto2": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"acceptLTC": {
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"metadata": {
|
||||
"description": "Choose a second crypto currency to support"
|
||||
"description": "Accept Litecoin"
|
||||
}
|
||||
},
|
||||
"supportedCrypto3": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"internalCLightning": {
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"metadata": {
|
||||
"description": "Choose a third crypto currency to support"
|
||||
}
|
||||
},
|
||||
"supportedCrypto4": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a fourth crypto currency to support"
|
||||
}
|
||||
},
|
||||
"supportedCrypto5": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a fifth crypto currency to support"
|
||||
}
|
||||
},
|
||||
"supportedCrypto6": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a sixth crypto currency to support"
|
||||
}
|
||||
},
|
||||
"supportedCrypto7": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a seventh crypto currency to support"
|
||||
}
|
||||
},
|
||||
"supportedCrypto8": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a eigth crypto currency to support"
|
||||
}
|
||||
},
|
||||
"supportedCrypto9": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"btc",
|
||||
"ltc",
|
||||
"dash",
|
||||
"grs",
|
||||
"btg",
|
||||
"ftc",
|
||||
"via",
|
||||
"doge",
|
||||
"mona"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a nineth crypto currency to support"
|
||||
}
|
||||
},
|
||||
"lightningNetworkImplementation": {
|
||||
"type": "string",
|
||||
"allowedValues": [
|
||||
"",
|
||||
"clightning",
|
||||
"lnd"
|
||||
],
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Choose a lightning network implementation"
|
||||
}
|
||||
},
|
||||
"lightningNodeAlias": {
|
||||
"type": "string",
|
||||
"defaultValue": "",
|
||||
"metadata": {
|
||||
"description": "Public alias of your lightning node (Optional)"
|
||||
"description": "Support internal clightning node (beta)"
|
||||
}
|
||||
},
|
||||
"ubuntuOSVersion": {
|
||||
"type": "string",
|
||||
"defaultValue": "16.04.0-LTS",
|
||||
"defaultValue": "14.04.4-LTS",
|
||||
"metadata": {
|
||||
"description": "The Ubuntu version for deploying the Docker containers. This will pick a fully patched image of this given Ubuntu version. Allowed values: 14.04.4-LTS, 15.10, 16.04.0-LTS"
|
||||
},
|
||||
"allowedValues": [
|
||||
"14.04.4-LTS",
|
||||
"16.04.0-LTS",
|
||||
"18.04-LTS"
|
||||
"15.10",
|
||||
"16.04.0-LTS"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
@ -246,7 +83,7 @@
|
||||
},
|
||||
"branch": {
|
||||
"type": "string",
|
||||
"defaultValue": "master",
|
||||
"defaultValue": "stable",
|
||||
"metadata": {
|
||||
"description": "The branch from the GIT repository to use"
|
||||
}
|
||||
@ -394,34 +231,6 @@
|
||||
"priority": 102,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "LightningBTC",
|
||||
"properties": {
|
||||
"description": "Allow inbound Lighning Network access (BTC)",
|
||||
"protocol": "Tcp",
|
||||
"sourcePortRange": "*",
|
||||
"destinationPortRange": "9735",
|
||||
"sourceAddressPrefix": "Internet",
|
||||
"destinationAddressPrefix": "*",
|
||||
"access": "Allow",
|
||||
"priority": 103,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "LightningLTC",
|
||||
"properties": {
|
||||
"description": "Allow inbound Lighning Network access (LTC)",
|
||||
"protocol": "Tcp",
|
||||
"sourcePortRange": "*",
|
||||
"destinationPortRange": "9736",
|
||||
"sourceAddressPrefix": "Internet",
|
||||
"destinationAddressPrefix": "*",
|
||||
"access": "Allow",
|
||||
"priority": 104,
|
||||
"direction": "Inbound"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -441,8 +250,8 @@
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[variables('vmName')]",
|
||||
"adminUsername": "temp",
|
||||
"adminPassword": "[concat(uniqueString(resourceGroup().id), 'aA5@')]"
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
@ -485,20 +294,27 @@
|
||||
"autoUpgradeMinorVersion": true,
|
||||
"settings":
|
||||
{
|
||||
"fileUris" : ["https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/master/azure-entrypoint.sh"],
|
||||
"commandToExecute" : "[concat('./azure-entrypoint.sh ', reference(concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName')), '2016-03-30').dnsSettings.fqdn, ' \"', parameters('network'), '\" \"', parameters('notificationEmail'), '\" \"', parameters('repository'), '\" \"', parameters('branch'), '\" \"', parameters('lightningNodeAlias'), '\" \"', parameters('supportedCrypto1'), '\" \"', parameters('supportedCrypto2'), '\" \"', parameters('supportedCrypto3'), '\" \"', parameters('supportedCrypto4'), '\" \"', parameters('supportedCrypto5'), '\" \"', parameters('supportedCrypto6'), '\" \"', parameters('supportedCrypto7'), '\" \"', parameters('supportedCrypto8'), '\" \"', parameters('supportedCrypto9'), '\" \"', parameters('lightningNetworkImplementation'), '\" \"', parameters('sshKey'),'\"')]"
|
||||
"fileUris" : ["https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/lnsupport/entrypoint.sh",
|
||||
"https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/lnsupport/changedomain.sh",
|
||||
"https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/lnsupport/btcpay-restart.sh",
|
||||
"https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/lnsupport/btcpay-update.sh"],
|
||||
"commandToExecute" : "[concat('./entrypoint.sh ', reference(concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName')), '2016-03-30').dnsSettings.fqdn, ' ', parameters('network'), ' ', parameters('notificationEmail'), ' ', parameters('repository'), ' ', parameters('branch'), ' ', parameters('acceptBTC'), ' ', parameters('acceptLTC'), ' ', parameters('internalCLightning'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"ssh-username" : {
|
||||
"type": "string",
|
||||
"value": "[parameters('adminUsername')]"
|
||||
},
|
||||
"server-azure-dns" : {
|
||||
"type": "string",
|
||||
"value": "[reference(concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName')), '2016-03-30').dnsSettings.fqdn]"
|
||||
},
|
||||
"ssh-commandline" : {
|
||||
"type": "string",
|
||||
"value": "[concat('ssh', ' root@', reference(concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName')), '2016-03-30').dnsSettings.fqdn)]"
|
||||
},
|
||||
"ssh-help" : {
|
||||
"type": "string",
|
||||
"value": "If you did not set a SSH Key, please connect to your BTCPay instance, register the administration account and go to Server Settings / Services / SSH to get more information"
|
||||
"value": "[concat('ssh', ' ', parameters('adminUsername'), '@', reference(concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName')), '2016-03-30').dnsSettings.fqdn)]"
|
||||
},
|
||||
"server-url" : {
|
||||
"type": "string",
|
||||
|
||||
3
btcpay-restart.sh
Normal file
3
btcpay-restart.sh
Normal file
@ -0,0 +1,3 @@
|
||||
cd "`dirname $BTCPAY_ENV_FILE`"
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE down
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE up -d
|
||||
9
btcpay-update.sh
Normal file
9
btcpay-update.sh
Normal file
@ -0,0 +1,9 @@
|
||||
cd "`dirname $BTCPAY_DOCKER_COMPOSE`"
|
||||
git pull
|
||||
cd "`dirname $BTCPAY_ENV_FILE`"
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE down
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE up -d
|
||||
|
||||
cd btcpayserver-docker
|
||||
find `pwd` -name "*.sh" -exec chmod +x {} \; 2>/dev/null
|
||||
find `pwd` -name "*.sh" -exec ln -s {} /usr/bin \; 2>/dev/null
|
||||
17
changedomain.sh
Normal file
17
changedomain.sh
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
export NEW_HOST="$1"
|
||||
export OLD_HOST=`cat $BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_HOST=\(.*\)$/\1/p'`
|
||||
echo "Changing domain from \"$OLD_HOST\" to \"$NEW_HOST\""
|
||||
|
||||
export BTCPAY_HOST="$NEW_HOST"
|
||||
export ACME_CA_URI="https://acme-v01.api.letsencrypt.org/directory"
|
||||
|
||||
# Modify environment file
|
||||
sed -i '/^BTCPAY_HOST/d' $BTCPAY_ENV_FILE
|
||||
sed -i '/^ACME_CA_URI/d' $BTCPAY_ENV_FILE
|
||||
echo "BTCPAY_HOST=$BTCPAY_HOST" >> $BTCPAY_ENV_FILE
|
||||
echo "ACME_CA_URI=$ACME_CA_URI" >> $BTCPAY_ENV_FILE
|
||||
|
||||
cd "`dirname $BTCPAY_ENV_FILE`"
|
||||
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" down
|
||||
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d
|
||||
40
deployOnAzure.ps1
Normal file
40
deployOnAzure.ps1
Normal file
@ -0,0 +1,40 @@
|
||||
# This
|
||||
# Assume your ran logged to azure with
|
||||
# Login-AzureRmAccount
|
||||
# Then you selected your subscript with
|
||||
# Get-AzureRmSubscription –SubscriptionName "your subscription" | Select-AzureRmSubscription
|
||||
param([String]$ResourceGroupName, [String]$Network)
|
||||
|
||||
$rg = $ResourceGroupName
|
||||
|
||||
$usr = ([char[]]([char]'a'..[char]'z') + ([char[]]([char]'A'..[char]'Z')) + 0..9 | Sort-Object {Get-Random})[0..8] -join ''
|
||||
$pass = ([char[]]([char]'a'..[char]'z') + ([char[]]([char]'A'..[char]'Z')) + 0..9 | Sort-Object {Get-Random})[0..16] -join ''
|
||||
$pass = $pass + 'aB1' # So we satisfy 100% sure the password requirements
|
||||
|
||||
$parameters = `
|
||||
@{"adminUsername" = $usr;`
|
||||
"adminPassword" = $pass;`
|
||||
"network" = $Network;
|
||||
}
|
||||
|
||||
New-AzureRmResourceGroup -Name $rg -Location "South Central US"
|
||||
New-AzureRmResourceGroupDeployment -ResourceGroupName $rg -TemplateFile "azuredeploy.json" -TemplateParameterObject $parameters
|
||||
|
||||
|
||||
$site = (Get-AzureRmPublicIpAddress -ResourceGroupName $rg).DnsSettings.Fqdn
|
||||
|
||||
$cmd = "ssh $usr@$site"
|
||||
|
||||
$temp += "BTCPay server on Network: $Network`n"
|
||||
$temp = "Username: $usr`n"
|
||||
$temp += "Password: $pass`n"
|
||||
$temp += "Machine address: $site`n"
|
||||
$temp += "Command line: $cmd`n`n"
|
||||
|
||||
$temp += "Your BTCPay server instance will be available shortly on: https://$site/ with a staging certificate from Let's Encrypt!`n"
|
||||
$temp += "Your next steps are:`n"
|
||||
$temp += "`t1. Add the following DNS record to your domain server: `"your-domain.com. CNAME $site.`"`n"
|
||||
$temp += "`t2. Connect via SSH to this virtual machine, and run `". ./changedomain your-domain.com`"`n"
|
||||
$temp += "You will then have a fully HTTPS configured access to your own BTCPay Server instance"
|
||||
|
||||
Write-Host $temp
|
||||
136
entrypoint.sh
Normal file
136
entrypoint.sh
Normal file
@ -0,0 +1,136 @@
|
||||
#!/bin/bash
|
||||
|
||||
# It is running as root
|
||||
export AZURE_DNS="$1"
|
||||
export NBITCOIN_NETWORK="$2"
|
||||
export LETSENCRYPT_EMAIL="$3"
|
||||
export BTCPAY_DOCKER_REPO="$4"
|
||||
export BTCPAY_DOCKER_REPO_BRANCH="$5"
|
||||
export USE_BTC="$6"
|
||||
export USE_LTC="$7"
|
||||
export USE_CLIGHTNING="$8"
|
||||
|
||||
echo ""
|
||||
echo "-------SETUP-----------"
|
||||
echo "Parameters passed:"
|
||||
echo "AZURE_DNS:$AZURE_DNS"
|
||||
echo "NBITCOIN_NETWORK:$NBITCOIN_NETWORK"
|
||||
echo "LETSENCRYPT_EMAIL:$LETSENCRYPT_EMAIL"
|
||||
echo "BTCPAY_DOCKER_REPO:$BTCPAY_DOCKER_REPO"
|
||||
echo "BTCPAY_DOCKER_REPO_BRANCH:$BTCPAY_DOCKER_REPO_BRANCH"
|
||||
echo "USE_BTC:$USE_BTC"
|
||||
echo "USE_LTC:$USE_LTC"
|
||||
echo "USE_CLIGHTNING:$USE_CLIGHTNING"
|
||||
echo "----------------------"
|
||||
echo ""
|
||||
|
||||
export DOWNLOAD_ROOT="`pwd`"
|
||||
export BTCPAY_ENV_FILE="`pwd`/.env"
|
||||
export SUPPORTED_CRYPTO_CURRENCIES=""
|
||||
|
||||
if [ "$USE_BTC" == "True" ]; then
|
||||
SUPPORTED_CRYPTO_CURRENCIES="$SUPPORTED_CRYPTO_CURRENCIES-btc"
|
||||
fi
|
||||
|
||||
if [ "$USE_LTC" == "True" ]; then
|
||||
SUPPORTED_CRYPTO_CURRENCIES="$SUPPORTED_CRYPTO_CURRENCIES-ltc"
|
||||
fi
|
||||
|
||||
if [ "$USE_CLIGHTNING" == "True" ]; then
|
||||
SUPPORTED_CRYPTO_CURRENCIES="$SUPPORTED_CRYPTO_CURRENCIES-clightning"
|
||||
fi
|
||||
|
||||
if [ "$SUPPORTED_CRYPTO_CURRENCIES" == "" ]; then
|
||||
SUPPORTED_CRYPTO_CURRENCIES="-btc"
|
||||
fi
|
||||
|
||||
# Remove superflous -
|
||||
SUPPORTED_CRYPTO_CURRENCIES=`echo $SUPPORTED_CRYPTO_CURRENCIES | sed 's/^-\(.*\)/\1/'`
|
||||
|
||||
export BTCPAY_HOST="$AZURE_DNS"
|
||||
export BTCPAY_DOCKER_COMPOSE="`pwd`/btcpayserver-docker/Production/docker-compose.$SUPPORTED_CRYPTO_CURRENCIES.yml"
|
||||
export ACME_CA_URI="https://acme-staging.api.letsencrypt.org/directory"
|
||||
|
||||
echo "DNS NAME: $AZURE_DNS"
|
||||
|
||||
# Put the variable in /etc/environment for reboot
|
||||
cp /etc/environment /etc/environment.bak
|
||||
echo "AZURE_DNS=\"$AZURE_DNS\"" >> /etc/environment
|
||||
echo "BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\"" >> /etc/environment
|
||||
echo "DOWNLOAD_ROOT=\"$DOWNLOAD_ROOT\"" >> /etc/environment
|
||||
echo "BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"" >> /etc/environment
|
||||
|
||||
|
||||
# Put the variable in /etc/profile.d when a user log interactively
|
||||
touch "/etc/profile.d/btcpay-env.sh"
|
||||
echo "export AZURE_DNS=\"$AZURE_DNS\"" >> /etc/profile.d/btcpay-env.sh
|
||||
echo "export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\"" >> /etc/profile.d/btcpay-env.sh
|
||||
echo "export DOWNLOAD_ROOT=\"$DOWNLOAD_ROOT\"" >> /etc/profile.d/btcpay-env.sh
|
||||
echo "export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"" >> /etc/profile.d/btcpay-env.sh
|
||||
|
||||
# Install docker (https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#set-up-the-repository) and docker-compose
|
||||
apt-get update 2>error
|
||||
apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
software-properties-common \
|
||||
2>error
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
|
||||
add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
|
||||
apt-get update
|
||||
apt-get install -y docker-ce
|
||||
|
||||
# Install docker-compose
|
||||
curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
# Clone btcpayserver-docker
|
||||
git clone $BTCPAY_DOCKER_REPO
|
||||
cd btcpayserver-docker
|
||||
git checkout $BTCPAY_DOCKER_REPO_BRANCH
|
||||
cd ..
|
||||
|
||||
# Schedule for reboot
|
||||
|
||||
echo "
|
||||
# File is saved under /etc/init/start_containers.conf
|
||||
# After file is modified, update config with : $ initctl reload-configuration
|
||||
|
||||
description \"Start containers (see http://askubuntu.com/a/22105 and http://askubuntu.com/questions/612928/how-to-run-docker-compose-at-bootup)\"
|
||||
|
||||
start on filesystem and started docker
|
||||
stop on runlevel [!2345]
|
||||
|
||||
# if you want it to automatically restart if it crashes, leave the next line in
|
||||
# respawn # might cause over charge
|
||||
|
||||
script
|
||||
. /etc/profile.d/btcpay-env.sh
|
||||
cd \"`dirname \$BTCPAY_ENV_FILE`\"
|
||||
docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d
|
||||
end script" > /etc/init/start_containers.conf
|
||||
|
||||
initctl reload-configuration
|
||||
|
||||
# Set .env file
|
||||
touch $BTCPAY_ENV_FILE
|
||||
echo "BTCPAY_HOST=$BTCPAY_HOST" >> $BTCPAY_ENV_FILE
|
||||
echo "ACME_CA_URI=$ACME_CA_URI" >> $BTCPAY_ENV_FILE
|
||||
echo "NBITCOIN_NETWORK=$NBITCOIN_NETWORK" >> $BTCPAY_ENV_FILE
|
||||
echo "LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL" >> $BTCPAY_ENV_FILE
|
||||
|
||||
cd "`dirname $BTCPAY_ENV_FILE`"
|
||||
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d
|
||||
|
||||
find `pwd` -name "*.sh" -exec chmod +x {} \;
|
||||
find `pwd` -name "*.sh" -exec ln -s {} /usr/bin \;
|
||||
find `pwd`/btcpayserver-docker -name "*.sh" -exec chmod +x {} \;
|
||||
find `pwd`/btcpayserver-docker -name "*.sh" -exec ln -s {} /usr/bin \;
|
||||
Loading…
Reference in New Issue
Block a user