Compare commits

...

39 Commits

Author SHA1 Message Date
nicolas.dorier
7f65cb68a0
fix multi crypto params 2019-09-22 23:09:28 +09:00
nicolas.dorier
617290ced3
Revert "Remove additional crypto (bugged)"
This reverts commit fa19371e8b.
2019-09-22 23:08:32 +09:00
nicolas.dorier
73d9e1085e
Use production certs by default 2019-09-22 22:54:55 +09:00
nicolas.dorier
fa19371e8b
Remove additional crypto (bugged) 2019-09-22 22:53:30 +09:00
nicolas.dorier
f7d96a8574
Deploy in /root and use the new ssh deployment 2019-09-22 22:29:34 +09:00
Nicolas Dorier
ba8522b892
Update azure-entrypoint.sh 2019-08-25 12:34:56 +09:00
Nicolas Dorier
e18d6796cf
Merge pull request #4 from andrasfuchs/master
Add DASH to the supported crypto list
2019-08-01 00:00:14 +09:00
Andras Fuchs
c54f11e1ea Switched the tabs to spaces to conform to the original format 2019-07-30 20:09:58 +02:00
Andras Fuchs
22a5c6128f Reversed the testing specific URLs to the original repo 2019-07-30 20:06:03 +02:00
Andras Fuchs
72f2b15ab0 Temporarily replace the raw URL to the script to test the new settings 2019-07-30 19:58:13 +02:00
Andras Fuchs
185ecc59c9 Updated the parameter passing for the 2+ crypto support 2019-07-30 16:39:41 +02:00
Andras Fuchs
c0b39a2b1d Changed the template version to 1.1 2019-07-30 14:31:28 +02:00
Andras Fuchs
b76f132a3e Added support for more than 2 cryptos 2019-07-30 14:08:23 +02:00
Andras Fuchs
1ecd572f61 Added DASH to the list of supported cryptos 2019-07-30 14:03:40 +02:00
nicolas.dorier
2bb2f9d878 add doge and mona 2018-12-01 22:16:02 +09:00
Nicolas Dorier
29674d6cae
Merge pull request #3 from HashHubTokyo/pr-add-button-for-armviz
Add the button linked to `armviz.io`.
2018-09-07 14:12:16 +09:00
Masaki Muranaka
95134cd3af Add the button linked to armviz.io. 2018-09-07 04:53:25 +00:00
nicolas.dorier
cf5b556232 Prune azure node 2018-08-16 18:08:20 +09:00
nicolas.dorier
6adb7dd8a3 Execute ssh or sshd 2018-08-16 18:07:26 +09:00
nicolas.dorier
584d383dda Better output 2018-08-13 12:18:28 +09:00
nicolas.dorier
165233f3da Remove temp user 2018-08-13 12:13:58 +09:00
nicolas.dorier
b8af1e1cee Fix password issue 2018-08-13 11:58:46 +09:00
nicolas.dorier
5317449473 Allow custom SSH Key, remove the need for SSH user/password 2018-08-13 11:49:41 +09:00
nicolas.dorier
e8c8cf8976 fix, if not altcoin, then LN implementation argument would shift as BTCPAY_CRYPTO2 2018-07-25 13:44:07 +09:00
nicolas.dorier
c31f096d99 add viacoin support 2018-07-20 22:56:05 +09:00
nicolas.dorier
dac3633ec9 add lnd 2018-07-11 18:19:06 +09:00
nicolas.dorier
0642100042 Fix typo 2018-06-24 20:18:55 +09:00
nicolas.dorier
e7b13c0cb6 add groestlcoin to list of supported crypto 2018-06-24 13:42:31 +09:00
nicolas.dorier
73e233ff5c Allow default notifcation email 2018-06-19 02:37:44 +09:00
nicolas.dorier
cf18296a49 Update description notifcationemail 2018-06-19 01:43:10 +09:00
nicolas.dorier
aabb0d882c notification email mandatory 2018-06-19 01:42:00 +09:00
nicolas.dorier
42f7a309d6 Add ftc support 2018-06-18 23:50:02 +09:00
nicolas.dorier
af50691af4 Add button deploy 2018-05-20 13:04:26 +09:00
nicolas.dorier
6c9855241a Use new deployment system 2018-05-20 12:50:16 +09:00
nicolas.dorier
a5306cd641 remove /etc/environment for entrypoint.sh 2018-05-10 19:07:45 +09:00
nicolas.dorier
d91e26f33b remove /etc/environment 2018-05-10 17:37:48 +09:00
nicolas.dorier
6f2211c8f4 Add proper support for 18.04 2018-05-02 02:24:31 +09:00
nicolas.dorier
3be5379cf9 add 18.04 ubuntu and remove none LTS version 2018-04-29 12:57:11 +09:00
nicolas.dorier
1888337408 default ubuntu to 16.04.0 2018-04-29 12:49:56 +09:00
8 changed files with 252 additions and 517 deletions

235
README.md
View File

@ -2,236 +2,19 @@
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:
[![Visualize](http://armviz.io/visualizebutton.png)](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:
[![Deploy to Azure](https://azuredeploy.net/deploybutton.svg)](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:
[![BTCPay - One Click Setup](http://img.youtube.com/vi/Bxs95BdEMHY/mqdefault.jpg)](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).
It must be noted that even if this repository's goal is to make deployment on Azure easy, you can use it on your own VM, see [Running without Azure](#running-without-azure).
---
# Deploy via Microsoft Azure Portal
Click on this button and follow instructions:
[![Deploy to Azure](https://azuredeploy.net/deploybutton.svg)](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
```
# How to update the btcpay-* tools
```
sudo su -
cd $DOWNLOAD_ROOT
if [ ! -d "btcpayserver-azure" ]; then
git clone https://github.com/btcpayserver/btcpayserver-azure
fi
cd btcpayserver-azure
git pull
cp *.sh ..
```
# 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
```
# Running without Azure <a name="running-without-azure" />
You can run `entrypoint.sh` without Azure, on your own Linux machine:
1. Make sure your VM has enough RAM (3GB at least for BTC only, 4GB for BTC+LTC)
2. Configure your DNS record (eg. btcpay.example.com)
3. Make sure it point to this VM (A record or CNAME record)
4. Make sure port 80 and 443 are open
5. Run the following script
```
# Configure your DNS record (eg. btcpay.example.com)
# Make sure it point to this VM and that port 80 and 443 are open
# Clone the repository
git clone https://github.com/btcpayserver/btcpayserver-azure/
# Enter into this folder
cd btcpayserver-azure
export AZURE_DNS=btcpay.example.com
export NBITCOIN_NETWORK=mainnet
export LETSENCRYPT_EMAIL=admin@example.com
export BTCPAY_DOCKER_REPO=https://github.com/btcpayserver/btcpayserver-docker/
export BTCPAY_DOCKER_REPO_BRANCH=master
export LIGHTNING_ALIAS="my-node"
export USE_BTC=True
export USE_LTC=True
export USE_CLIGHTNING=True
export ACME_CA_URI=https://acme-v01.api.letsencrypt.org/directory
. ./entrypoint.sh
```
You can then browse https://btcpay.example.com/ and enjoy your new node and all commands documented here (like `btcpay-update.sh`) and on the [btcpay-docker](https://github.com/btcpayserver/btcpayserver-docker) repository.

50
azure-entrypoint.sh Executable file
View File

@ -0,0 +1,50 @@
#!/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 &

View File

@ -1,23 +1,17 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"contentVersion": "1.1.0.0",
"parameters": {
"adminUsername": {
"sshKey": {
"type": "string",
"defaultValue": "btcpayserver",
"defaultValue": "",
"metadata": {
"description": "The name of the SSH user."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "The name of the SSH password."
"description": "SSH Key which will be granted access to the VM (optional)"
}
},
"notificationEmail": {
"type": "string",
"defaultValue": "yourname@example.com",
"defaultValue": "me@example.com",
"metadata": {
"description": "Email used by Let's encrypt to notify you about certificate expiration (optional)"
}
@ -38,28 +32,190 @@
],
"defaultValue": "mainnet",
"metadata": {
"description": "Choose nainnet for production, or testnet for testing"
"description": "Choose mainnet for production, or testnet for testing"
}
},
"acceptBTC": {
"type": "bool",
"defaultValue": true,
"supportedCrypto1": {
"type": "string",
"allowedValues": [
"",
"btc",
"ltc",
"dash",
"grs",
"btg",
"ftc",
"via",
"doge",
"mona"
],
"defaultValue": "btc",
"metadata": {
"description": "Accept Bitcoin"
"description": "Choose a crypto currency to support"
}
},
"acceptLTC": {
"type": "bool",
"defaultValue": false,
"supportedCrypto2": {
"type": "string",
"allowedValues": [
"",
"btc",
"ltc",
"dash",
"grs",
"btg",
"ftc",
"via",
"doge",
"mona"
],
"defaultValue": "",
"metadata": {
"description": "Accept Litecoin"
"description": "Choose a second crypto currency to support"
}
},
"internalCLightning": {
"type": "bool",
"defaultValue": false,
"supportedCrypto3": {
"type": "string",
"allowedValues": [
"",
"btc",
"ltc",
"dash",
"grs",
"btg",
"ftc",
"via",
"doge",
"mona"
],
"defaultValue": "",
"metadata": {
"description": "Support internal clightning node (beta)"
"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": {
@ -71,14 +227,14 @@
},
"ubuntuOSVersion": {
"type": "string",
"defaultValue": "14.04.4-LTS",
"defaultValue": "16.04.0-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",
"15.10",
"16.04.0-LTS"
"16.04.0-LTS",
"18.04-LTS"
]
},
"repository": {
@ -90,7 +246,7 @@
},
"branch": {
"type": "string",
"defaultValue": "stable",
"defaultValue": "master",
"metadata": {
"description": "The branch from the GIT repository to use"
}
@ -285,8 +441,8 @@
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
"adminUsername": "temp",
"adminPassword": "[concat(uniqueString(resourceGroup().id), 'aA5@')]"
},
"storageProfile": {
"imageReference": {
@ -329,27 +485,20 @@
"autoUpgradeMinorVersion": true,
"settings":
{
"fileUris" : ["https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/master/entrypoint.sh",
"https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/master/changedomain.sh",
"https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/master/btcpay-restart.sh",
"https://raw.githubusercontent.com/btcpayserver/btcpayserver-azure/master/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('lightningNodeAlias'), '\" ', parameters('acceptBTC'), ' ', parameters('acceptLTC'), ' ', parameters('internalCLightning'))]"
"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'),'\"')]"
}
}
}
],
"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', ' ', parameters('adminUsername'), '@', reference(concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName')), '2016-03-30').dnsSettings.fqdn)]"
"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"
},
"server-url" : {
"type": "string",

View File

@ -1,3 +0,0 @@
cd "`dirname $BTCPAY_ENV_FILE`"
docker-compose -f $BTCPAY_DOCKER_COMPOSE down
docker-compose -f $BTCPAY_DOCKER_COMPOSE up -d

View File

@ -1,8 +0,0 @@
cd "`dirname $BTCPAY_DOCKER_COMPOSE`"
git pull --force
cd "`dirname $BTCPAY_ENV_FILE`"
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

View File

@ -1,16 +0,0 @@
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" up -d

View File

@ -1,40 +0,0 @@
# 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

View File

@ -1,180 +0,0 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
: "${AZURE_DNS:=$1}"
: "${NBITCOIN_NETWORK:=$2}"
: "${LETSENCRYPT_EMAIL:=$3}"
: "${BTCPAY_DOCKER_REPO:=$4}"
: "${BTCPAY_DOCKER_REPO_BRANCH:=$5}"
: "${LIGHTNING_ALIAS:=$6}"
: "${USE_BTC:=$7}"
: "${USE_LTC:=$8}"
: "${USE_CLIGHTNING:=$9}"
: "${ACME_CA_URI:=https://acme-staging.api.letsencrypt.org/directory}"
DOWNLOAD_ROOT="`pwd`"
echo "
-------SETUP-----------
Parameters passed:
AZURE_DNS:$AZURE_DNS
NBITCOIN_NETWORK:$NBITCOIN_NETWORK
LETSENCRYPT_EMAIL:$LETSENCRYPT_EMAIL
BTCPAY_DOCKER_REPO:$BTCPAY_DOCKER_REPO
BTCPAY_DOCKER_REPO_BRANCH:$BTCPAY_DOCKER_REPO_BRANCH
LIGHTNING_ALIAS:$LIGHTNING_ALIAS
USE_BTC:$USE_BTC
USE_LTC:$USE_LTC
USE_CLIGHTNING:$USE_CLIGHTNING
----------------------
ACME_CA_URI:$ACME_CA_URI
DOWNLOAD_ROOT:$DOWNLOAD_ROOT
----------------------
"
BTCPAY_ENV_FILE="`pwd`/.env"
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 [ "$SUPPORTED_CRYPTO_CURRENCIES" == "" ]; then
SUPPORTED_CRYPTO_CURRENCIES="-btc"
fi
if [ "$USE_CLIGHTNING" == "True" ]; then
SUPPORTED_CRYPTO_CURRENCIES="$SUPPORTED_CRYPTO_CURRENCIES-clightning"
fi
# Remove superflous -
SUPPORTED_CRYPTO_CURRENCIES=`echo $SUPPORTED_CRYPTO_CURRENCIES | sed 's/^-\(.*\)/\1/'`
BTCPAY_HOST="$AZURE_DNS"
BTCPAY_DOCKER_COMPOSE="`pwd`/btcpayserver-docker/Production/docker-compose.$SUPPORTED_CRYPTO_CURRENCIES.yml"
export AZURE_DNS
export BTCPAY_DOCKER_COMPOSE
export DOWNLOAD_ROOT
export BTCPAY_ENV_FILE
# Put the variable in /etc/environment for reboot
cp /etc/environment /etc/environment.bak
echo "
AZURE_DNS=\"$AZURE_DNS\"
BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\"
DOWNLOAD_ROOT=\"$DOWNLOAD_ROOT\"
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\"
export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\"
export DOWNLOAD_ROOT=\"$DOWNLOAD_ROOT\"
export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"" > /etc/profile.d/btcpay-env.sh
chmod +x /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 ..
# Set .env file
touch $BTCPAY_ENV_FILE
echo "
BTCPAY_HOST=$BTCPAY_HOST
ACME_CA_URI=$ACME_CA_URI
NBITCOIN_NETWORK=$NBITCOIN_NETWORK
LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL
LIGHTNING_ALIAS=$LIGHTNING_ALIAS" > $BTCPAY_ENV_FILE
# Schedule for reboot
if [ -d "/etc/systemd/system" ]; then # Use systemd
echo "Adding btcpayserver.service to systemd"
echo "
[Unit]
Description=BTCPayServer service
After=docker.service network-online.target
Requires=docker.service network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd \"\$(dirname \$BTCPAY_ENV_FILE)\" && docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d'
ExecStop=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd \"\$(dirname \$BTCPAY_ENV_FILE)\" && docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" stop'
ExecReload=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd \"\$(dirname \$BTCPAY_ENV_FILE)\" && docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" restart'
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/btcpayserver.service
systemctl daemon-reload
systemctl enable btcpayserver
systemctl start btcpayserver
else # Use upstart
echo "Using upstart"
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
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d
fi
cd "`dirname $BTCPAY_ENV_FILE`"
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 \;