-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloud_config_proxy.yaml
188 lines (178 loc) · 5.77 KB
/
cloud_config_proxy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#cloud-config
################################################################################################
# EXOSCALE USERDATA TEMPLATE PawCloud-XMR
#===============================================================================================
#
# Insert this into UserData when you make a new instance. You only need one xmr proxy for
# pawcloud-xmr-proxy. Your nodes should go into an instance pool, the node template is
# configured for you to automatically point at the head proxy node.
#
# Virtual machine settings:
#
# Hostname: pawcloud-proxy
# OS: Ubuntu 20.04 LTS
# Instance Type: Small 2 vCPU | GB 2 x 2198 MHz
# Disk: 10 GB
#
# These settings will need to be adjusted after the VM warms up:
#
# Private Network: pawcloud (if you don't have one, make one)
# Private Network Type: Managed
# Private Network IP: 10.0.0.2
#
# Please note that warm up time on the proxy can take up to 30 minutes, as your xmr-node-proxy
# is being built from source against the VM's kernel (for speed). The trade off is worth the
# performance benefit, as we are compiling against RedHat virtio/virtio-net modules here.
#
################################################################################################
# Networking configuration - This makes the settings in the dash have no effect on cloud-init inside the vm
# which is really what we want to do (i.e.: stop ourselfs from f**king things up!)
preserve_hostname: false
hostname: pawcloud-proxy
manage_resolv_conf: true
resolv_conf:
nameservers: ['8.8.4.4', '8.8.8.8']
searchdomains:
- ns1.pawcloud.com
- ns2.pawcloud.com
domain: pawcloud.com
options:
rotate: true
timeout: 1
# Group and user configuration - I haven't had success modifying the default ubuntu user, it
# seems to make exoscale's dash go BORK along with the ssh.
# So we are just appending our app user.
groups:
- ubuntu [root,sys]
- cloud-users
users:
- default
- name: nodeproxy
gecos: PawCloud XMR Proxy User
home: /home/nodeproxy
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
primary_group: nodeproxy
groups: cloud-users
plain_text_passwd: 'pawcloud-proxy1'
ssh_import_id: None
lock_passwd: false
# Filesystem configuration - Basic growpart configuration for bigger instances.
growpart:
mode: auto
devices: ["/"]
ignore_growroot_disabled: false
# Files to write - Netplan configuration and installation scripts for runcmd.
write_files:
- path: /etc/netplan/20-eth0_custom.yaml
content: |
network:
version: 2
ethernets:
eth0:
match:
name: eth0
set-name: eth0
dhcp4: true
nameservers:
search: [ns1.local, ns2.local]
addresses: [8.8.8.8, 8.8.4.4]
- path: /etc/netplan/21-eth1_custom.yaml
content: |
network:
version: 2
ethernets:
eth1:
match:
name: eth1
set-name: eth1
dhcp4: false
addresses: [10.0.0.2/24]
- path: /home/nodeproxy/00_install-proxy.sh
content: |
#!/bin/bash
{
. ~/.bashrc
curl -L https://raw.githubusercontent.com/loopyd/xmr-node-proxy/master/install.sh | bash
} > ~/install-log.txt
full_path=$(realpath $0)
rm -f "$full_path"
- path: /home/nodeproxy/01_install-proxy.sh
content: |
#!/bin/bash
source ~/.profile
chmod u+x ~/.nvm/nvm.sh
source ~/.nvm/nvm.sh
{
cd ~/xmr-node-proxy
tee ./config.json >/dev/null <<'EOF'
{
"pools": [
{
"hostname": "pool.supportxmr.com",
"port": 3333,
"ssl": false,
"allowSelfSignedSSL": false,
"share": 100,
"username": "46Z4T9pKPPv82ixGexhGZW9rmMHzPyLnU9ozhewcp8EbC2QagMtz2BKdiqTCx9wo1AiVbEt8R6w1J4ad8W6NpDzRJCxQUMG",
"password": "proxy:[email protected]",
"keepAlive": true,
"coin": "xmr",
"default": true
}
],
"listeningPorts": [
{
"port": 8443,
"ssl": true,
"diff": 1000,
"coin": "xmr"
},
{
"port": 3333,
"ssl": false,
"diff": 1000,
"coin": "xmr"
},
{
"port": 5555,
"ssl": false,
"diff": 5000,
"coin": "xmr"
},
{
"port": 7777,
"ssl": false,
"diff": 10000,
"coin": "xmr"
}
],
"bindAddress": "10.0.0.2",
"daemonAddress": "127.0.0.1:18081",
"coinSettings": {
"xmr":{
"minDiff": 100,
"maxDiff": 300000,
"shareTargetTime": 15
}
}
}
EOF
pm2 start ./proxy.js --name=proxy --log-date-format="YYYY-MM-DD HH:mm Z"
pm2 save
} >> ~/install-log.txt
full_path=$(realpath $0)
rm -f $full_path
# Package manager - Make sure we have the most recent security updates.
apt_update: true
apt_upgrade: true
apt_reboot_if_required: true
# Commands to run - *Darude - Sandstorm plays* This space intentionally left blank.
runcmd:
- [ netplan, apply ]
- [ sh, -xc, "cp /etc/skel/.* /home/nodeproxy" ]
- [ sh, -xc, "chown -R nodeproxy:nodeproxy /home/nodeproxy" ]
- [ sh, -xc, "chmod +x /home/nodeproxy/00_install-proxy.sh" ]
- [ sh, -xc, "chmod +x /home/nodeproxy/01_install-proxy.sh" ]
- [ su, -c, /home/nodeproxy/00_install-proxy.sh, -s, /bin/bash, nodeproxy ]
- [ su, -, nodeproxy, -c, "~/01_install-proxy.sh" ]