Parameterize the instance configs out to main yaml file
This commit is contained in:
parent
4632046cf7
commit
ca54c75b59
59
main.btcpay.yaml
Normal file
59
main.btcpay.yaml
Normal file
@ -0,0 +1,59 @@
|
||||
imports:
|
||||
- path: vm.jinja
|
||||
|
||||
resources:
|
||||
- name: deploy-btcpay-vm-with-btcpay-server
|
||||
type: vm.jinja
|
||||
properties:
|
||||
region: asia-northeast1
|
||||
zone: asia-northeast1-b
|
||||
vmtype: custom-1-7680-ext
|
||||
linuxType: ubuntu-1604-lts
|
||||
diskSizeGb: 500
|
||||
startup-script: |
|
||||
#!/bin/bash
|
||||
############ EDIT FIELD END HERE ##############
|
||||
### mandatory settings ###
|
||||
BTCPAY_HOST=btcpaytest8.indiesquare.net
|
||||
NBITCOIN_NETWORK=testnet
|
||||
BTCPAYGEN_CRYPTO1=btc
|
||||
BTCPAYGEN_LIGHTNING=lnd
|
||||
### optional settings (No need to set unless required) ###
|
||||
LETSENCRYPT_EMAIL=
|
||||
LIGHTNING_ALIAS=
|
||||
BTCPAYGEN_CRYPTO2=
|
||||
CUSTOM_SSH_KEY=
|
||||
### default settings(basically no need to change) ###
|
||||
BTCPAY_DOCKER_REPO=https://github.com/btcpayserver/btcpayserver-docker
|
||||
BTCPAY_DOCKER_REPO_BRANCH=master
|
||||
BTCPAYGEN_REVERSEPROXY=nginx
|
||||
ACME_CA_URI:=https://acme-staging.api.letsencrypt.org/directory
|
||||
#prune mode with 100Gb blockchain (1 year long blochchain)
|
||||
BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage"
|
||||
############ EDIT FIELD END HERE ##############
|
||||
### Script below
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
apt-get update 2>error
|
||||
apt-get install -y git 2>error
|
||||
fi
|
||||
# Setup SSH access via private key
|
||||
ssh-keygen -t rsa -f /root/.ssh/id_rsa_btcpay -q -P ""
|
||||
echo "# Key used by BTCPay Server" >> /root/.ssh/authorized_keys
|
||||
cat /root/.ssh/id_rsa_btcpay.pub >> /root/.ssh/authorized_keys
|
||||
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
|
||||
# Configure BTCPAY to have access to SSH
|
||||
BTCPAY_HOST_SSHKEYFILE=/root/.ssh/id_rsa_btcpay
|
||||
# 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 &
|
||||
23
main.yaml
23
main.yaml
@ -1,23 +0,0 @@
|
||||
imports:
|
||||
- path: vm.jinja
|
||||
|
||||
resources:
|
||||
- name: deploy-btcpay-vm-with-btcpay-server
|
||||
type: vm.jinja
|
||||
properties:
|
||||
region: asia-northeast1
|
||||
zone: asia-northeast1-b
|
||||
startup-script: |
|
||||
#!/bin/bash
|
||||
apt-get update
|
||||
apt-get -y install git
|
||||
mkdir /var/BTCPayServer
|
||||
cd /var/BTCPayServer/
|
||||
git clone https://github.com/btcpayserver/btcpayserver-docker
|
||||
cd btcpayserver-docker/
|
||||
export BTCPAY_HOST="btcpayreg1.indiesquare.net"
|
||||
export NBITCOIN_NETWORK="regtest"
|
||||
export BTCPAYGEN_CRYPTO1="btc"
|
||||
export BTCPAYGEN_REVERSEPROXY="nginx"
|
||||
export BTCPAYGEN_LIGHTNING="lnd"
|
||||
. ./btcpay-setup.sh -i
|
||||
10
vm.jinja
10
vm.jinja
@ -8,7 +8,7 @@ resources:
|
||||
name: {{ env["deployment"] }}-vm
|
||||
properties:
|
||||
zone: {{ properties["zone"] }}
|
||||
machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/n1-standard-1
|
||||
machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/{{properties["vmtype"]}}
|
||||
metadata:
|
||||
items:
|
||||
- key: startup-script
|
||||
@ -20,11 +20,11 @@ resources:
|
||||
boot: true
|
||||
autoDelete: true
|
||||
initializeParams:
|
||||
sourceImage: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
diskSizeGb: 500
|
||||
sourceImage: projects/ubuntu-os-cloud/global/images/family/{{properties["linuxType"]}}
|
||||
diskSizeGb: {{properties["diskSizeGb"]}}
|
||||
networkInterfaces:
|
||||
- network: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/global/networks/default
|
||||
accessConfigs:
|
||||
- name: External northeast
|
||||
- name: External
|
||||
type: ONE_TO_ONE_NAT
|
||||
natIP: $(ref.{{ env["deployment"] }}-address.address)
|
||||
natIP: $(ref.{{ env["deployment"] }}-address.address)
|
||||
Loading…
Reference in New Issue
Block a user