mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-05-17 11:20:22 +00:00
add more configurations; add statistics webserver
This commit is contained in:
parent
9d692d5194
commit
8eb780a8b5
|
@ -1 +1,2 @@
|
|||
**/build
|
||||
**/docker-compose
|
||||
|
|
|
@ -34,9 +34,9 @@ docker compose up
|
|||
|
||||
#### Optional
|
||||
* Open ports 18080 (Monero p2p port) and 37889 (P2Pool p2p port) or 37888 (P2Pool-mini p2p port) in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine
|
||||
* An XMRig CPU miner is included by default, but you can connect additional miners to this same p2pool node using port 3333
|
||||
* An XMRig CPU miner is included by default, but you can connect additional miners to this same p2pool node using port 3333 (or alternate if configured) when you set it as "exposed" in the configuration
|
||||
* Configure your kernel for maximum mining performance: [XMRig RandomX Optimization Guide](https://xmrig.com/docs/miner/randomx-optimization-guide)
|
||||
* Small miners can mine on p2pool-mini by editing the .env file
|
||||
* Many optional configurations and customizations are available by running './configure'
|
||||
|
||||
|
||||
#### Other usefull commands
|
||||
|
@ -45,6 +45,7 @@ docker compose up
|
|||
* You can see logs when running in the background for with the "docker logs" command: ```docker logs -f p2pool-xmrig``` or ```docker logs -f p2pool-p2pool``` or ```docker logs -f p2pool-monero```
|
||||
* You can pause mining with: ```docker compose pause xmrig``` and resume mining with: ```docker compose unpause xmrig```
|
||||
* You can disable mining with: ```docker compose stop xmrig``` and re-enable mining with: ```docker compose start xmrig```
|
||||
* You can view your Server Statistics using a web browser if you enabled that feature in the configuration at: http://localhost:3380 (or alternate port as configured)
|
||||
|
||||
|
||||
#### Uninstall
|
||||
|
|
|
@ -1,172 +1,224 @@
|
|||
#!/bin/env python3
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
from jinja2 import Template
|
||||
import npyscreen
|
||||
|
||||
|
||||
def load_default_config():
|
||||
# Read defaults
|
||||
with open("defaults") as defaults_file:
|
||||
defaults = json.load(defaults_file)
|
||||
return defaults
|
||||
|
||||
|
||||
def load_current_config():
|
||||
# Read current config
|
||||
with open("/docker-compose/current_config") as current_config:
|
||||
config = json.load(current_config)
|
||||
return config
|
||||
|
||||
|
||||
##
|
||||
# Help text in a box at the bottom of the screen
|
||||
class HelpBox(npyscreen.BoxTitle):
|
||||
class HelpBoxBase(npyscreen.BoxTitle):
|
||||
def splitlines(self):
|
||||
all_help = []
|
||||
for fld, msg in self.help_msgs.items():
|
||||
if fld[-1] != ":":
|
||||
fld += ":"
|
||||
message = [m.lstrip() for m in msg if m != ""]
|
||||
helpline = f"{fld:<28}{'. '.join(message)}"
|
||||
all_help.append(helpline)
|
||||
all_help.append("")
|
||||
return all_help
|
||||
|
||||
def display_help_message(self, field):
|
||||
if field == "Configure Monero Node":
|
||||
self.set_values(
|
||||
[
|
||||
"Configure and run a Monero Node",
|
||||
"",
|
||||
"Note: You must either configure a local node or specify a public node",
|
||||
]
|
||||
)
|
||||
elif field == "Configure XMRig CPU Miner":
|
||||
self.set_values(
|
||||
[
|
||||
"Configure and run an XMRig CPU Miner",
|
||||
"",
|
||||
"Note: You must either configure am XMRig CPU Miner or expose the",
|
||||
" P2Pool stratum port and connect an external miner, or both",
|
||||
]
|
||||
)
|
||||
elif field == "Wallet Address:":
|
||||
self.set_values(
|
||||
[
|
||||
"Your monero wallet address for receiving mining reqards",
|
||||
"",
|
||||
"Note: You have to use a primary wallet address for mining",
|
||||
" Subaddresses and integrated addresses are not supported!",
|
||||
]
|
||||
)
|
||||
elif field == "P2Pool Sidechain:":
|
||||
self.set_values(
|
||||
[
|
||||
"Which P2Pool sidechain to mine on",
|
||||
" use main for faster miners",
|
||||
" use mini for slower miners",
|
||||
]
|
||||
)
|
||||
elif field == "Expose Stratum Port":
|
||||
self.set_values(
|
||||
[
|
||||
"Expose the P2Pool stratum port to your network so external miners",
|
||||
"can connect",
|
||||
"Note: You may choose to open this port in your hosts firewall and/or",
|
||||
" router to allow miners outside your network to connect",
|
||||
]
|
||||
)
|
||||
elif field == "Stratum Port:":
|
||||
self.set_values(
|
||||
[
|
||||
"Port number to expose P2Pool stratum to your network to allow",
|
||||
"external miners to connect",
|
||||
]
|
||||
)
|
||||
elif field == "P2Pool Log Level:":
|
||||
self.set_values(["Verbosity of the log; (Less) 0 - 6 (More)"])
|
||||
elif field == "Enable Autodiff":
|
||||
self.set_values(
|
||||
["Use automatic difficulty adjustment for miners connected to stratum"]
|
||||
)
|
||||
elif field == "Additional P2Pool Options:":
|
||||
self.set_values(
|
||||
[
|
||||
"Additional options to pass to p2pool commandline",
|
||||
"",
|
||||
"Note: Advanced - Only add options if you know what you are doing",
|
||||
" See ouput of 'p2pool --help' for available options",
|
||||
]
|
||||
)
|
||||
elif field == "Monero Version:":
|
||||
self.set_values(
|
||||
[
|
||||
"Version of Monero to build; 'latest' for the most recent release",
|
||||
"",
|
||||
"Note: Must be v0.17.3.0 or later for p2pool support",
|
||||
" See: https://github.com/monero-project/monero/tags",
|
||||
]
|
||||
)
|
||||
elif field == "Prune Blockchain":
|
||||
self.set_values(
|
||||
["Prune the Monero node to limit the size of the blockchain on disk"]
|
||||
)
|
||||
elif field == "Monero Log Level:":
|
||||
self.set_values(["Verbosity of the log; (Less) 0 - 4 (More)"])
|
||||
elif field == "Additional monerod Options:":
|
||||
self.set_values(
|
||||
[
|
||||
"Additional options to pass to monerod commandline",
|
||||
"",
|
||||
"Note: Advanced - Only add options if you know what you are doing",
|
||||
" See 'https://monerodocs.org/interacting/monerod-reference/'",
|
||||
]
|
||||
)
|
||||
elif field == "Public Node:":
|
||||
self.set_values(
|
||||
[
|
||||
"Public Monero Node to Use",
|
||||
"",
|
||||
"Note: The public node must have both Monero RPC and zmq-pub ports",
|
||||
" available",
|
||||
]
|
||||
)
|
||||
elif field == "Node Login:":
|
||||
self.set_values(
|
||||
[
|
||||
"Specify username[:password] required to connect to public monero",
|
||||
"node RPC API (if required)"
|
||||
]
|
||||
)
|
||||
elif field == "Username:":
|
||||
self.set_values(["Set a username for the miner"])
|
||||
elif field == "Use Fixed Difficulty":
|
||||
self.set_values(
|
||||
[
|
||||
"Used a fixed minig difficulty",
|
||||
"",
|
||||
"Note: Allows you to see XMRig submitting shares below P2Pool threshold",
|
||||
]
|
||||
)
|
||||
elif field == "Fixed Difficulty:":
|
||||
self.set_values(
|
||||
[
|
||||
"Set a fixed mining difficulty",
|
||||
"",
|
||||
"Note: Allows you to see XMRig submitting shares below P2Pool threshold",
|
||||
]
|
||||
)
|
||||
elif field == "CPU Use %:":
|
||||
self.set_values(
|
||||
["maximum CPU threads count (in percentage) hint for autoconfig"]
|
||||
)
|
||||
elif field == "Additional XMRig Options:":
|
||||
self.set_values(
|
||||
[
|
||||
"Additional options to pass to xmrig",
|
||||
"",
|
||||
"Note: Advanced - Only add options if you know what you are doing",
|
||||
" See 'https://xmrig.com/docs/miner/command-line-options'",
|
||||
]
|
||||
)
|
||||
elif field == "Save":
|
||||
self.set_values(["Save current configuration"])
|
||||
elif field == "Cancel":
|
||||
self.set_values(["Exit without saving"])
|
||||
self.set_values(
|
||||
self.help_msgs.get(field, "No help availabe for {}".format(field))
|
||||
)
|
||||
self.clear()
|
||||
self.display()
|
||||
|
||||
|
||||
class P2PoolHelpBox(HelpBoxBase):
|
||||
help_msgs = {
|
||||
"Wallet Address:": [
|
||||
"Your monero wallet address for receiving mining reqards",
|
||||
"",
|
||||
"Note: You have to use a primary wallet address for mining",
|
||||
" Subaddresses and integrated addresses are not supported!",
|
||||
],
|
||||
"P2Pool Sidechain:": [
|
||||
"Which P2Pool sidechain to mine on",
|
||||
" use main for faster miners",
|
||||
" use mini for slower miners",
|
||||
],
|
||||
"Enable Server Statistics": [
|
||||
"Provide access to your P2Pool server statictics via a web interface",
|
||||
],
|
||||
"Statistics Port:": [
|
||||
"Port number (or IP:Port) to expose web access to your P2Pool server",
|
||||
"statictics",
|
||||
],
|
||||
"Expose Stratum Port": [
|
||||
"Expose the P2Pool stratum port to your network so external miners",
|
||||
"can connect",
|
||||
"Note: You may choose to open this port in your hosts firewall and/or",
|
||||
" router to allow miners outside your network to connect",
|
||||
],
|
||||
"Stratum Port:": [
|
||||
"Port number (or IP:Port) to expose P2Pool stratum to your network to",
|
||||
"allow external miners to connect",
|
||||
"Note: You may choose to open this port in your hosts firewall and/or",
|
||||
" router to allow miners outside your network to connect",
|
||||
],
|
||||
"P2Pool Log Level:": [
|
||||
"Verbosity of the log; (Less) 0 - 6 (More)",
|
||||
],
|
||||
"Enable Autodiff": [
|
||||
"Use automatic difficulty adjustment for miners connected to stratum",
|
||||
],
|
||||
"Enable Light Mode": [
|
||||
"Don't allocate RandomX dataset, saves 2GB of RAM",
|
||||
],
|
||||
"Disable Cache": [
|
||||
"Disable p2pool.cache (not recommended)",
|
||||
],
|
||||
"Additional P2Pool Options:": [
|
||||
"Additional options to pass to p2pool commandline",
|
||||
"",
|
||||
"Note: Advanced - Only add options if you know what you are doing",
|
||||
" See ouput of 'p2pool --help' for available options",
|
||||
],
|
||||
"Next": [
|
||||
"Next configuration menu",
|
||||
],
|
||||
"Save": [
|
||||
"Save current configuration and exit",
|
||||
],
|
||||
"Cancel": [
|
||||
"Exit without saving",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
class MoneroHelpBox(HelpBoxBase):
|
||||
help_msgs = {
|
||||
"Configure Monero Node": [
|
||||
"Configure and run a Monero Node",
|
||||
"",
|
||||
"Note: You must either configure a local node or specify a public node",
|
||||
],
|
||||
"Monero Version:": [
|
||||
"Version of Monero to build; 'latest' for the most recent release",
|
||||
"",
|
||||
"Note: Must be v0.17.3.0 or later for p2pool support",
|
||||
" See: https://github.com/monero-project/monero/tags",
|
||||
],
|
||||
"Prune Blockchain": [
|
||||
"Prune the Monero node to limit the size of the blockchain on disk",
|
||||
],
|
||||
"Monero Log Level:": [
|
||||
"Verbosity of the log; (Less) 0 - 4 (More)",
|
||||
"",
|
||||
"Note: settings above 0 are very noisy",
|
||||
],
|
||||
"Expose RPC Port": [
|
||||
"Expose restricted RPC API port to your network so external services",
|
||||
"(wallets for example) can connect",
|
||||
"Note: You may choose to open this port in your hosts firewall and/or",
|
||||
" router to allow services outside your network to connect",
|
||||
],
|
||||
"RPC Port:": [
|
||||
"TCP port to listen on for RPC connections",
|
||||
],
|
||||
"RPC Login:": [
|
||||
"Specify username[:password] required to connect to the RPC API",
|
||||
],
|
||||
"Limit Data Rates": [
|
||||
"Set a limit value for incoming and outgoing data transfer",
|
||||
],
|
||||
"Rate Limit Up:": [
|
||||
"Set outgoing data transfer limit [kB/s]",
|
||||
],
|
||||
"Rate Limit Down:": [
|
||||
"Set incoming data transfer limit [kB/s]",
|
||||
],
|
||||
"Sync Pruned Blocks": [
|
||||
"Accept pruned blocks instead of pruning yourself to save",
|
||||
"network transfer",
|
||||
],
|
||||
"Fast Block Sync": [
|
||||
'Sync up most of the way by using embedded, "known" (old) block',
|
||||
"hashes without calculating the block hash to verify the proof of work",
|
||||
"",
|
||||
"Note: Faster initial sync by trusting the monerod binary",
|
||||
],
|
||||
"Public Node:": [
|
||||
"Public Monero Node to Use",
|
||||
"",
|
||||
"Note: The public node must have both Monero RPC and zmq-pub ports",
|
||||
" available",
|
||||
],
|
||||
"Node Login:": [
|
||||
"Specify username[:password] required to connect to public monero",
|
||||
"node RPC API (if required)",
|
||||
],
|
||||
"Additional monerod Options:": [
|
||||
"Additional options to pass to monerod commandline",
|
||||
"",
|
||||
"Note: Advanced - Only add options if you know what you are doing",
|
||||
" See 'https://monerodocs.org/interacting/monerod-reference/'",
|
||||
],
|
||||
"Prev": [
|
||||
"Previous configuration menu",
|
||||
],
|
||||
"Next": [
|
||||
"Next configuration menu",
|
||||
],
|
||||
"Save": [
|
||||
"Save current configuration and exit",
|
||||
],
|
||||
"Cancel": [
|
||||
"Exit without saving",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
class XMRigHelpBox(HelpBoxBase):
|
||||
help_msgs = {
|
||||
"Configure XMRig CPU Miner": [
|
||||
"Configure and run an XMRig CPU Miner",
|
||||
"",
|
||||
"Note: You must either configure am XMRig CPU Miner or expose the",
|
||||
" P2Pool stratum port and connect an external miner, or both",
|
||||
],
|
||||
"Username:": [
|
||||
"Set a username for the miner",
|
||||
],
|
||||
"Use Fixed Difficulty": [
|
||||
"Used a fixed minig difficulty",
|
||||
"",
|
||||
"Note: Allows you to see XMRig submitting shares below P2Pool threshold",
|
||||
],
|
||||
"Fixed Difficulty:": [
|
||||
"Set a fixed mining difficulty",
|
||||
"",
|
||||
"Note: Allows you to see XMRig submitting shares below P2Pool threshold",
|
||||
],
|
||||
"CPU Use %:": [
|
||||
"Maximum CPU threads count (in percentage) hint for autoconfig",
|
||||
"Note: Applies to cores only. If you have HyperThreading enabled you",
|
||||
" should divide this value by 2 (use 0-50%). Reference:",
|
||||
" https://github.com/xmrig/xmrig/issues/1670#issuecomment-644433778",
|
||||
],
|
||||
"CPU Priority:": [
|
||||
"Set process priority (0 idle, 2 normal to 5 highest)",
|
||||
],
|
||||
"Additional XMRig Options:": [
|
||||
"Additional options to pass to xmrig",
|
||||
"",
|
||||
"Note: Advanced - Only add options if you know what you are doing",
|
||||
" See 'https://xmrig.com/docs/miner/command-line-options'",
|
||||
],
|
||||
"Prev": [
|
||||
"Previous configuration menu",
|
||||
],
|
||||
"Save": [
|
||||
"Save current configuration and exit",
|
||||
],
|
||||
"Cancel": [
|
||||
"Exit without saving",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Custom (integer) values for title slider
|
||||
class IntegerSlider(npyscreen.Slider):
|
||||
|
@ -227,50 +279,73 @@ class PatchedFormControlCheckbox(npyscreen.FormControlCheckbox):
|
|||
super()
|
||||
|
||||
|
||||
class PrevButton(npyscreen.Button):
|
||||
def whenToggled(self):
|
||||
self.value = False
|
||||
self.parent.prev_form()
|
||||
|
||||
|
||||
class NextButton(npyscreen.Button):
|
||||
def whenToggled(self):
|
||||
self.value = False
|
||||
self.parent.next_form()
|
||||
|
||||
|
||||
class SaveButton(npyscreen.Button):
|
||||
def whenToggled(self):
|
||||
self.parent.save_and_exit()
|
||||
self.find_parent_app().save_and_exit()
|
||||
|
||||
|
||||
class CancelButton(npyscreen.Button):
|
||||
def whenToggled(self):
|
||||
self.parent.cancel_and_exit()
|
||||
self.find_parent_app().cancel_and_exit()
|
||||
|
||||
|
||||
##
|
||||
# Configuration Form
|
||||
class ConfigForm(npyscreen.FormBaseNew):
|
||||
ALLOW_RESIZE = False
|
||||
# Config Forms Base Class
|
||||
class ConfigFormBase(npyscreen.FormBaseNew):
|
||||
name_size = 20
|
||||
indent = 5
|
||||
current_config = None
|
||||
defaults = None
|
||||
ALLOW_RESIZE = False
|
||||
|
||||
def while_editing(self, arg):
|
||||
self.help.display_help_message(arg.name)
|
||||
self.display()
|
||||
|
||||
def get_default_config(self):
|
||||
# Return defaults
|
||||
if self.defaults is None:
|
||||
with open("defaults") as defaults_file:
|
||||
self.defaults = json.load(defaults_file)
|
||||
return self.defaults
|
||||
|
||||
def get_current_config(self):
|
||||
# Return current config
|
||||
if self.current_config is None:
|
||||
# Read current config
|
||||
with open("/docker-compose/current_config") as current_config:
|
||||
self.current_config = json.load(current_config)
|
||||
return self.current_config
|
||||
|
||||
def reset_defaults(self, arg):
|
||||
# Set config to default values
|
||||
ok = npyscreen.notify_ok_cancel(
|
||||
"Set current form values to defaults", title="Reset to Defaults"
|
||||
)
|
||||
if not ok:
|
||||
return
|
||||
defaults = self.get_default_config()
|
||||
self.set_config(defaults)
|
||||
|
||||
|
||||
##
|
||||
# P2Pool Configuration Form
|
||||
class P2PoolConfigForm(ConfigFormBase):
|
||||
def create(self):
|
||||
# Add Hot-Key Controls
|
||||
self.add_handlers({"^D": self.load_defaults})
|
||||
# Add Global Configuration
|
||||
self.add(
|
||||
npyscreen.TitleText,
|
||||
name="## General Configuration",
|
||||
editable=False,
|
||||
begin_entry_at=50,
|
||||
)
|
||||
self.configure_monero_node = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Configure Monero Node",
|
||||
value=True,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_xmrig_miner = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Configure XMRig CPU Miner",
|
||||
value=True,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.nextrely += 1
|
||||
self.add_handlers({"^D": self.reset_defaults})
|
||||
# Add P2Pool Configuration
|
||||
self.add(
|
||||
npyscreen.TitleText,
|
||||
|
@ -285,6 +360,7 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.sidechain = self.add(
|
||||
npyscreen.TitleSelectOne,
|
||||
name="P2Pool Sidechain:",
|
||||
|
@ -297,6 +373,23 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.enable_statistics = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Enable Server Statistics",
|
||||
value=True,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.statistics_port = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Statistics Port:",
|
||||
value="3334",
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.enable_statistics.addVisibleWhenSelected(self.statistics_port)
|
||||
self.nextrely += 1
|
||||
self.expose_stratum_port = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Expose Stratum Port",
|
||||
|
@ -312,6 +405,7 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
relx=self.indent,
|
||||
)
|
||||
self.expose_stratum_port.addVisibleWhenSelected(self.stratum_port)
|
||||
self.nextrely += 1
|
||||
self.p2pool_log_level = self.add(
|
||||
TitleIntegerSlider,
|
||||
name="P2Pool Log Level:",
|
||||
|
@ -325,6 +419,7 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
block_color=None,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.autodiff = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Enable Autodiff",
|
||||
|
@ -332,6 +427,23 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.light_mode = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Enable Light Mode",
|
||||
value=False,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.no_cache = self.add(
|
||||
npyscreen.Checkbox,
|
||||
name="Disable Cache",
|
||||
value=False,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.p2pool_extra = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Additional P2Pool Options:",
|
||||
|
@ -341,6 +453,63 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
)
|
||||
self.nextrely += 1
|
||||
self.nextrely += 1
|
||||
# Add "Next", "Save", and "Cancel" buttons
|
||||
self.next_button = self.add(NextButton, name="Next", relx=1)
|
||||
self.nextrely -= 1
|
||||
self.save_button = self.add(SaveButton, name="Save", relx=8)
|
||||
self.nextrely -= 1
|
||||
self.cancel_button = self.add(CancelButton, name="Cancel", relx=15)
|
||||
self.nextrely += 1
|
||||
# Add Help Box
|
||||
self.help = self.add(
|
||||
P2PoolHelpBox,
|
||||
name="Commands: ^D: Load Defaults - ^C: Exit Without Saving",
|
||||
values=[""],
|
||||
editable=False,
|
||||
)
|
||||
# Start with current config
|
||||
self.set_config(self.get_current_config())
|
||||
|
||||
def next_form(self):
|
||||
self.find_parent_app().switchForm("MONERO")
|
||||
|
||||
def set_config(self, config):
|
||||
self.wallet_address.set_value(config["wallet_address"])
|
||||
self.sidechain.set_value(config["sidechain"])
|
||||
self.enable_statistics.set_value(config["enable_statistics"])
|
||||
self.statistics_port.set_value(config["statistics_port"])
|
||||
self.expose_stratum_port.set_value(config["expose_stratum_port"])
|
||||
self.stratum_port.set_value(config["stratum_port"])
|
||||
self.p2pool_log_level.set_value(config["p2pool_log_level"])
|
||||
self.autodiff.set_value(config["enable_autodiff"])
|
||||
self.light_mode.set_value(config["light_mode"])
|
||||
self.no_cache.value = config["no_cache"]
|
||||
self.p2pool_extra.set_value(config["p2pool_options"])
|
||||
self.DISPLAY()
|
||||
|
||||
def get_config(self):
|
||||
config = {
|
||||
"wallet_address": self.wallet_address.value,
|
||||
"sidechain": self.sidechain.value,
|
||||
"enable_statistics": self.enable_statistics.value,
|
||||
"statistics_port": self.statistics_port.value,
|
||||
"expose_stratum_port": self.expose_stratum_port.value,
|
||||
"stratum_port": self.stratum_port.value,
|
||||
"p2pool_log_level": self.p2pool_log_level.value,
|
||||
"enable_autodiff": self.autodiff.value,
|
||||
"light_mode": self.light_mode.value,
|
||||
"no_cache": self.no_cache.value,
|
||||
"p2pool_options": self.p2pool_extra.value,
|
||||
}
|
||||
return config
|
||||
|
||||
|
||||
##
|
||||
# Monero Configuration Form
|
||||
class MoneroConfigForm(ConfigFormBase):
|
||||
def create(self):
|
||||
# Add Hot-Key Controls
|
||||
self.add_handlers({"^D": self.reset_defaults})
|
||||
# Add Monero Configuration
|
||||
self.add(
|
||||
npyscreen.TitleText,
|
||||
|
@ -348,6 +517,13 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
editable=False,
|
||||
begin_entry_at=50,
|
||||
)
|
||||
self.configure_monero_node = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Configure Monero Node",
|
||||
value=True,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.monero_git_tag = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Monero Version:",
|
||||
|
@ -357,7 +533,7 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.monero_git_tag)
|
||||
self.prune_node = self.add(
|
||||
npyscreen.Checkbox,
|
||||
PatchedFormControlCheckbox,
|
||||
name="Prune Blockchain",
|
||||
value=True,
|
||||
begin_entry_at=self.name_size,
|
||||
|
@ -378,14 +554,78 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.monero_log_level)
|
||||
self.monero_extra = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Additional monerod Options:",
|
||||
value="",
|
||||
begin_entry_at=self.name_size + 10,
|
||||
self.nextrely += 1
|
||||
self.expose_rpc_port = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Expose RPC Port",
|
||||
value=False,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.monero_extra)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.expose_rpc_port)
|
||||
self.rpc_port = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="RPC Port:",
|
||||
value="18081",
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.rpc_port)
|
||||
self.expose_rpc_port.addVisibleWhenSelected(self.rpc_port)
|
||||
self.rpc_login = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="RPC Login:",
|
||||
value="",
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.expose_rpc_port.addVisibleWhenSelected(self.rpc_login)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.rpc_login)
|
||||
self.nextrely += 1
|
||||
self.limit_data_rates = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Limit Data Rates",
|
||||
value=False,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.limit_data_rates)
|
||||
self.rate_limit_up = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Rate Limit Up:",
|
||||
value="2048",
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.limit_data_rates.addVisibleWhenSelected(self.rate_limit_up)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.rate_limit_up)
|
||||
self.rate_limit_down = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Rate Limit Down:",
|
||||
value="8192",
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.limit_data_rates.addVisibleWhenSelected(self.rate_limit_down)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.rate_limit_down)
|
||||
self.nextrely += 1
|
||||
self.sync_pruned_blocks = self.add(
|
||||
npyscreen.Checkbox,
|
||||
name="Sync Pruned Blocks",
|
||||
value=False,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.sync_pruned_blocks)
|
||||
self.prune_node.addVisibleWhenSelected(self.sync_pruned_blocks)
|
||||
self.fast_sync = self.add(
|
||||
npyscreen.Checkbox,
|
||||
name="Fast Block Sync",
|
||||
value=False,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.fast_sync)
|
||||
self.nextrely += 1
|
||||
self.public_node = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Public Node:",
|
||||
|
@ -403,7 +643,97 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
)
|
||||
self.configure_monero_node.addInvisibleWhenSelected(self.node_login)
|
||||
self.nextrely += 1
|
||||
self.monero_extra = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Additional monerod Options:",
|
||||
value="",
|
||||
begin_entry_at=self.name_size + 10,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_monero_node.addVisibleWhenSelected(self.monero_extra)
|
||||
self.nextrely += 1
|
||||
self.nextrely += 1
|
||||
# Add "Prev", "Next", "Save", and "Cancel" buttons
|
||||
self.prev_button = self.add(PrevButton, name="Prev", relx=1)
|
||||
self.nextrely -= 1
|
||||
self.next_button = self.add(NextButton, name="Next", relx=8)
|
||||
self.nextrely -= 1
|
||||
self.save_button = self.add(SaveButton, name="Save", relx=15)
|
||||
self.nextrely -= 1
|
||||
self.cancel_button = self.add(CancelButton, name="Cancel", relx=22)
|
||||
self.nextrely += 1
|
||||
# Add Help Box
|
||||
self.help = self.add(
|
||||
MoneroHelpBox,
|
||||
name="Commands: ^D: Load Defaults - ^C: Exit Without Saving",
|
||||
values=[""],
|
||||
editable=False,
|
||||
)
|
||||
# Start with current config
|
||||
self.set_config(self.get_current_config())
|
||||
|
||||
def prev_form(self):
|
||||
self.find_parent_app().switchForm("MAIN")
|
||||
|
||||
def next_form(self):
|
||||
self.find_parent_app().switchForm("XMRIG")
|
||||
|
||||
def set_config(self, config):
|
||||
self.configure_monero_node.set_value(config["configure_monero"])
|
||||
self.monero_git_tag.set_value(config["monero_version"])
|
||||
self.prune_node.value = config["prune_blockchain"]
|
||||
self.monero_log_level.set_value(config["monero_log_level"])
|
||||
self.expose_rpc_port.set_value(config["expose_rpc_port"])
|
||||
self.rpc_port.set_value(config["rpc_port"])
|
||||
self.rpc_login.set_value(config["rpc_login"])
|
||||
self.limit_data_rates.set_value(config["limit_data_rates"])
|
||||
self.rate_limit_up.set_value(config["rate_limit_up"])
|
||||
self.rate_limit_down.set_value(config["rate_limit_down"])
|
||||
self.sync_pruned_blocks.value = config["sync_pruned_blocks"]
|
||||
self.fast_sync.value = config["fast_sync"]
|
||||
self.monero_extra.set_value(config["monero_options"])
|
||||
self.public_node.set_value(config["public_monero_node"])
|
||||
self.node_login.set_value(config["monero_node_login"])
|
||||
self.DISPLAY()
|
||||
|
||||
def get_config(self):
|
||||
config = {
|
||||
"configure_monero": self.configure_monero_node.value,
|
||||
"monero_version": self.monero_git_tag.value,
|
||||
"prune_blockchain": self.prune_node.value,
|
||||
"monero_log_level": self.monero_log_level.value,
|
||||
"expose_rpc_port": self.expose_rpc_port.value,
|
||||
"rpc_port": self.rpc_port.value,
|
||||
"rpc_login": self.rpc_login.value,
|
||||
"limit_data_rates": self.limit_data_rates.value,
|
||||
"rate_limit_up": self.rate_limit_up.value,
|
||||
"rate_limit_down": self.rate_limit_down.value,
|
||||
"sync_pruned_blocks": self.sync_pruned_blocks.value,
|
||||
"fast_sync": self.fast_sync.value,
|
||||
"monero_options": self.monero_extra.value,
|
||||
"public_monero_node": self.public_node.value,
|
||||
"monero_node_login": self.node_login.value,
|
||||
}
|
||||
return config
|
||||
|
||||
|
||||
##
|
||||
# XMRig Configuration Form
|
||||
class XMRigConfigForm(ConfigFormBase):
|
||||
def create(self):
|
||||
# Add Hot-Key Controls
|
||||
self.add_handlers({"^D": self.reset_defaults})
|
||||
# Hidden caryover from P2Pool form
|
||||
self.autodiff = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Enable Autodiff",
|
||||
value=True,
|
||||
begin_entry_at=self.name_size,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.autodiff.hide = True
|
||||
self.autodiff.editable = False
|
||||
self.nextrely -= 1
|
||||
# Add XMRig Configuration
|
||||
self.add(
|
||||
npyscreen.TitleText,
|
||||
|
@ -411,6 +741,13 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
editable=False,
|
||||
begin_entry_at=50,
|
||||
)
|
||||
self.configure_xmrig_miner = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Configure XMRig CPU Miner",
|
||||
value=True,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.nextrely += 1
|
||||
self.username = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Username:",
|
||||
|
@ -419,6 +756,7 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
relx=self.indent,
|
||||
)
|
||||
self.configure_xmrig_miner.addVisibleWhenSelected(self.username)
|
||||
self.nextrely += 1
|
||||
self.use_fixed_difficulty = self.add(
|
||||
PatchedFormControlCheckbox,
|
||||
name="Use Fixed Difficulty",
|
||||
|
@ -442,6 +780,7 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
self.configure_xmrig_miner.addVisibleWhenSelected(self.fixed_difficulty)
|
||||
self.use_fixed_difficulty.addVisibleWhenSelected(self.fixed_difficulty)
|
||||
self.autodiff.addInvisibleWhenSelected(self.fixed_difficulty)
|
||||
self.nextrely += 1
|
||||
self.cpu_threads = self.add(
|
||||
TitleIntegerSlider,
|
||||
name="CPU Use %:",
|
||||
|
@ -455,6 +794,21 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
relx=self.indent,
|
||||
)
|
||||
self.configure_xmrig_miner.addVisibleWhenSelected(self.cpu_threads)
|
||||
self.nextrely += 1
|
||||
self.cpu_priority = self.add(
|
||||
TitleIntegerSlider,
|
||||
name="CPU Priority:",
|
||||
out_of=5,
|
||||
value=2,
|
||||
lowest=0,
|
||||
step=1,
|
||||
width=48,
|
||||
begin_entry_at=20,
|
||||
label=True,
|
||||
relx=self.indent,
|
||||
)
|
||||
self.configure_xmrig_miner.addVisibleWhenSelected(self.cpu_priority)
|
||||
self.nextrely += 1
|
||||
self.xmrig_extra = self.add(
|
||||
npyscreen.TitleText,
|
||||
name="Additional XMRig Options:",
|
||||
|
@ -465,81 +819,97 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
self.configure_xmrig_miner.addVisibleWhenSelected(self.xmrig_extra)
|
||||
self.nextrely += 1
|
||||
self.nextrely += 1
|
||||
# Add "Save" button
|
||||
self.save_button = self.add(SaveButton, name="Save", relx=1)
|
||||
# Add "Prev", "Save", and "Cancel" buttons
|
||||
self.prev_button = self.add(PrevButton, name="Prev", relx=1)
|
||||
self.nextrely -= 1
|
||||
self.cancel_button = self.add(CancelButton, name="Cancel", relx=8)
|
||||
self.save_button = self.add(SaveButton, name="Save", relx=8)
|
||||
self.nextrely -= 1
|
||||
self.cancel_button = self.add(CancelButton, name="Cancel", relx=15)
|
||||
self.nextrely += 1
|
||||
# Add Help Box
|
||||
self.help = self.add(
|
||||
HelpBox,
|
||||
XMRigHelpBox,
|
||||
name="Commands: ^D: Load Defaults - ^C: Exit Without Saving",
|
||||
values=[""],
|
||||
rely=-8,
|
||||
editable=False,
|
||||
)
|
||||
# Start with current config
|
||||
self.set_config(load_current_config())
|
||||
self.set_config(self.get_current_config())
|
||||
|
||||
def prev_form(self):
|
||||
self.find_parent_app().switchForm("MONERO")
|
||||
|
||||
def next_form(self):
|
||||
self.find_parent_app().switchForm(None)
|
||||
|
||||
def beforeEditing(self):
|
||||
# Cary autodiff value from P2Pool config form
|
||||
enable_autodiff = self.find_parent_app().get_p2pool_config()["enable_autodiff"]
|
||||
self.autodiff.set_value(enable_autodiff)
|
||||
|
||||
def set_config(self, config):
|
||||
self.configure_monero_node.set_value(config["configure_monero"])
|
||||
self.configure_xmrig_miner.set_value(config["configure_xmrig"])
|
||||
self.wallet_address.set_value(config["wallet_address"])
|
||||
self.sidechain.set_value(config["sidechain"])
|
||||
self.expose_stratum_port.set_value(config["expose_stratum_port"])
|
||||
self.stratum_port.set_value(config["stratum_port"])
|
||||
self.p2pool_log_level.set_value(config["p2pool_log_level"])
|
||||
self.autodiff.set_value(config["enable_autodiff"])
|
||||
self.p2pool_extra.set_value(config["p2pool_options"])
|
||||
self.monero_git_tag.set_value(config["monero_version"])
|
||||
self.prune_node.value = config["prune_blockchain"]
|
||||
self.monero_log_level.set_value(config["monero_log_level"])
|
||||
self.monero_extra.set_value(config["monero_options"])
|
||||
self.public_node.set_value(config["public_monero_node"])
|
||||
self.node_login.set_value(config["monero_node_login"])
|
||||
self.username.set_value(config["xmrig_username"])
|
||||
self.use_fixed_difficulty.set_value(config["use_fixed_difficulty"])
|
||||
self.fixed_difficulty.set_value(config["fixed_difficulty"])
|
||||
self.cpu_threads.set_value(config["cpu_percent"])
|
||||
self.cpu_priority.set_value(config["cpu_priority"])
|
||||
self.xmrig_extra.set_value(config["xmrig_options"])
|
||||
self.DISPLAY()
|
||||
|
||||
def get_config(self):
|
||||
config = {
|
||||
"configure_monero": self.configure_monero_node.value,
|
||||
"configure_xmrig": self.configure_xmrig_miner.value,
|
||||
"wallet_address": self.wallet_address.value,
|
||||
"sidechain": self.sidechain.value,
|
||||
"expose_stratum_port": self.expose_stratum_port.value,
|
||||
"stratum_port": self.stratum_port.value,
|
||||
"p2pool_log_level": self.p2pool_log_level.value,
|
||||
"enable_autodiff": self.autodiff.value,
|
||||
"p2pool_options": self.p2pool_extra.value,
|
||||
"monero_version": self.monero_git_tag.value,
|
||||
"prune_blockchain": self.prune_node.value,
|
||||
"monero_log_level": self.monero_log_level.value,
|
||||
"monero_options": self.monero_extra.value,
|
||||
"public_monero_node": self.public_node.value,
|
||||
"monero_node_login": self.node_login.value,
|
||||
"xmrig_username": self.username.value,
|
||||
"use_fixed_difficulty": self.use_fixed_difficulty.value,
|
||||
"fixed_difficulty": self.fixed_difficulty.value,
|
||||
"cpu_percent": self.cpu_threads.value,
|
||||
"cpu_priority": self.cpu_priority.value,
|
||||
"xmrig_options": self.xmrig_extra.value,
|
||||
}
|
||||
return config
|
||||
|
||||
# Control methods
|
||||
def load_defaults(self, arg):
|
||||
ok = npyscreen.notify_ok_cancel(
|
||||
"Set all values to defaults", title="Load Defaults"
|
||||
|
||||
##
|
||||
# Our P2Pool configuration App
|
||||
class ConfigApp(npyscreen.NPSAppManaged):
|
||||
current_config = None
|
||||
defaults = None
|
||||
|
||||
def onStart(self):
|
||||
self.p2pool_form = self.addForm(
|
||||
"MAIN",
|
||||
P2PoolConfigForm,
|
||||
name="P2Pool for docker-compose: P2Pool Configuration",
|
||||
minimum_lines=35,
|
||||
minimum_columns=80,
|
||||
)
|
||||
if not ok:
|
||||
return
|
||||
defaults = load_default_config()
|
||||
self.set_config(defaults)
|
||||
self.monero_form = self.addForm(
|
||||
"MONERO",
|
||||
MoneroConfigForm,
|
||||
name="P2Pool for docker-compose: Monero Configuration",
|
||||
minimum_lines=35,
|
||||
minimum_columns=80,
|
||||
)
|
||||
self.xmrig_form = self.addForm(
|
||||
"XMRIG",
|
||||
XMRigConfigForm,
|
||||
name="P2Pool for docker-compose: XMRig Configuration",
|
||||
minimum_lines=35,
|
||||
minimum_columns=80,
|
||||
)
|
||||
|
||||
def get_p2pool_config(self):
|
||||
return self.p2pool_form.get_config()
|
||||
|
||||
def get_config(self):
|
||||
p2pool_config = self.p2pool_form.get_config()
|
||||
monero_config = self.monero_form.get_config()
|
||||
xmrig_config = self.xmrig_form.get_config()
|
||||
return p2pool_config | monero_config | xmrig_config
|
||||
|
||||
def save_and_exit(self):
|
||||
# Get config from all forms
|
||||
config = self.get_config()
|
||||
# Save "current config" values file
|
||||
with open("current_config.jinja2", "r") as current_config:
|
||||
|
@ -554,27 +924,15 @@ class ConfigForm(npyscreen.FormBaseNew):
|
|||
with open("/docker-compose/docker-compose.yml", "w") as compose_file:
|
||||
compose_file.write(rendered)
|
||||
npyscreen.notify("Saved current settings", title="Saved")
|
||||
self.find_parent_app().switchForm(None)
|
||||
self.find_parent_app().saved = True
|
||||
self.switchForm(None)
|
||||
self.saved = True
|
||||
|
||||
def cancel_and_exit(self):
|
||||
self.find_parent_app().switchForm(None)
|
||||
self.find_parent_app().saved = False
|
||||
self.switchForm(None)
|
||||
self.saved = False
|
||||
|
||||
|
||||
##
|
||||
# Our P2Pool configuration App
|
||||
class ConfigApp(npyscreen.NPSAppManaged):
|
||||
def onStart(self):
|
||||
self.f = self.addForm(
|
||||
"MAIN",
|
||||
ConfigForm,
|
||||
name="P2Pool for docker-compose: Global Configuration",
|
||||
lines=45,
|
||||
columns=80,
|
||||
minimum_lines=45,
|
||||
minimum_columns=80,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -585,13 +943,9 @@ if __name__ == "__main__":
|
|||
print("\n\n")
|
||||
if App.saved:
|
||||
print("Configuration Saved")
|
||||
print(
|
||||
'Run "docker compose up -d" to start (if you are using the docker-compose plugin'
|
||||
)
|
||||
print(
|
||||
'or, "docker-compose up -d" (if you are using pip installed docker-compose)'
|
||||
)
|
||||
else:
|
||||
print("Configuration Aborted")
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
print("Configuration Aborted")
|
||||
sys.exit(1)
|
||||
|
|
|
@ -3,14 +3,26 @@
|
|||
"configure_monero": {{ configure_monero | tojson(indent=2) }},
|
||||
"configure_xmrig": {{ configure_xmrig | tojson(indent=2) }},
|
||||
"sidechain": {{ sidechain | tojson(indent=2) }},
|
||||
"enable_statistics": {{ enable_statistics | tojson(indent=2) }},
|
||||
"statistics_port": {{ statistics_port | tojson(indent=2) }},
|
||||
"expose_stratum_port": {{ expose_stratum_port | tojson(indent=2) }},
|
||||
"stratum_port": {{ stratum_port | tojson(indent=2) }},
|
||||
"p2pool_log_level": {{ p2pool_log_level | int | tojson(indent=2) }},
|
||||
"enable_autodiff": {{ enable_autodiff | tojson(indent=2) }},
|
||||
"light_mode": {{ light_mode | tojson(indent=2) }},
|
||||
"no_cache": {{ no_cache | tojson(indent=2) }},
|
||||
"p2pool_options": {{ p2pool_options | tojson(indent=2) }},
|
||||
"monero_version": {{ monero_version | tojson(indent=2) }},
|
||||
"prune_blockchain": {{ prune_blockchain | tojson(indent=2) }},
|
||||
"monero_log_level": {{ monero_log_level | int | tojson(indent=2) }},
|
||||
"expose_rpc_port": {{ expose_rpc_port | tojson(indent=2) }},
|
||||
"rpc_port": {{ rpc_port | tojson(indent=2) }},
|
||||
"rpc_login": {{ rpc_login | tojson(indent=2) }},
|
||||
"limit_data_rates": {{ limit_data_rates | tojson(indent=2) }},
|
||||
"rate_limit_up": {{ rate_limit_up | tojson(indent=2) }},
|
||||
"rate_limit_down": {{ rate_limit_down | tojson(indent=2) }},
|
||||
"sync_pruned_blocks": {{ sync_pruned_blocks | tojson(indent=2) }},
|
||||
"fast_sync": {{ fast_sync | tojson(indent=2) }},
|
||||
"monero_options": {{ monero_options | tojson(indent=2) }},
|
||||
"public_monero_node": {{ public_monero_node | tojson(indent=2) }},
|
||||
"monero_node_login": {{ monero_node_login | tojson(indent=2) }},
|
||||
|
@ -18,5 +30,6 @@
|
|||
"use_fixed_difficulty": {{ use_fixed_difficulty | tojson(indent=2) }},
|
||||
"fixed_difficulty": {{ fixed_difficulty | int | tojson(indent=2) }},
|
||||
"cpu_percent": {{ cpu_percent | int | tojson(indent=2) }},
|
||||
"cpu_priority": {{ cpu_priority | int | tojson(indent=2) }},
|
||||
"xmrig_options": {{ xmrig_options | tojson(indent=2) }}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,26 @@
|
|||
"configure_monero": true,
|
||||
"configure_xmrig": true,
|
||||
"sidechain": [0],
|
||||
"enable_statistics": true,
|
||||
"statistics_port": "3380",
|
||||
"expose_stratum_port": false,
|
||||
"stratum_port": "3333",
|
||||
"p2pool_log_level": 3,
|
||||
"enable_autodiff": true,
|
||||
"light_mode": false,
|
||||
"no_cache": false,
|
||||
"p2pool_options": "",
|
||||
"monero_version": "latest",
|
||||
"prune_blockchain": true,
|
||||
"monero_log_level": 0,
|
||||
"expose_rpc_port": false,
|
||||
"rpc_port": "18081",
|
||||
"rpc_login": "",
|
||||
"limit_data_rates": false,
|
||||
"rate_limit_up": "2048",
|
||||
"rate_limit_down": "8192",
|
||||
"sync_pruned_blocks": false,
|
||||
"fast_sync": false,
|
||||
"monero_options": "",
|
||||
"public_monero_node": "",
|
||||
"monero_node_login": "",
|
||||
|
@ -18,5 +30,6 @@
|
|||
"use_fixed_difficulty": true,
|
||||
"fixed_difficulty": 500000,
|
||||
"cpu_percent": 100,
|
||||
"cpu_priority": 2,
|
||||
"xmrig_options": ""
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ services:
|
|||
container_name: p2pool-p2pool
|
||||
networks:
|
||||
- p2pool
|
||||
privileged: true
|
||||
ports:
|
||||
{% if sidechain[0] == 0 %}
|
||||
- 37888:37888/tcp
|
||||
|
@ -27,7 +28,7 @@ services:
|
|||
- 37889:37889/tcp
|
||||
{% endif %}
|
||||
{% if expose_stratum_port == True %}
|
||||
- {{ stratum_port | int }}:3333/tcp
|
||||
- {{ stratum_port }}:3333/tcp
|
||||
{% endif %}
|
||||
volumes:
|
||||
- p2pool:/home/p2pool/.p2pool:rw
|
||||
|
@ -53,11 +54,42 @@ services:
|
|||
{% if enable_autodiff == False %}
|
||||
--no-autodiff
|
||||
{% endif %}
|
||||
{% if enable_statistics == True %}
|
||||
--local-api
|
||||
--data-api /home/p2pool/.p2pool
|
||||
{% endif %}
|
||||
{% if light_mode == True %}
|
||||
--light-mode
|
||||
{% endif %}
|
||||
{% if no_cache == True %}
|
||||
--no-cache
|
||||
{% endif %}
|
||||
{% if rpc_login != "" %}
|
||||
--rpc-login {{ rpc_login }}
|
||||
{% endif %}
|
||||
{% if p2pool_options != "" %}
|
||||
{{ p2pool_options }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if enable_statistics == True %}
|
||||
statistics:
|
||||
image: statistics:latest
|
||||
build:
|
||||
context: statistics
|
||||
container_name: p2pool-statistics
|
||||
networks:
|
||||
- p2pool
|
||||
ports:
|
||||
- {{ statistics_port }}:80/tcp
|
||||
volumes:
|
||||
- p2pool:/data:ro
|
||||
depends_on:
|
||||
- p2pool
|
||||
restart: unless-stopped
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if configure_monero == True %}
|
||||
monero:
|
||||
image: monero:latest
|
||||
|
@ -70,6 +102,9 @@ services:
|
|||
- p2pool
|
||||
ports:
|
||||
- 18080:18080/tcp
|
||||
{% if expose_rpc_port == True %}
|
||||
- {{ rpc_port }}:18081/tcp
|
||||
{% endif %}
|
||||
volumes:
|
||||
- monero:/home/monero/.bitmonero:rw
|
||||
- /dev/null:/home/monero/.bitmonero/bitmonero.log:rw
|
||||
|
@ -84,10 +119,26 @@ services:
|
|||
--p2p-bind-port=18080
|
||||
--rpc-bind-ip=0.0.0.0
|
||||
--rpc-bind-port=18081
|
||||
--restricted-rpc
|
||||
--confirm-external-bind
|
||||
--log-level={{ monero_log_level | int }}
|
||||
{% if prune_blockchain == True %}
|
||||
--prune-blockchain
|
||||
{% if sync_pruned_blocks == True %}
|
||||
--sync-pruned-blocks
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if rpc_login != "" %}
|
||||
--rpc-login {{ rpc_login }}
|
||||
{% endif %}
|
||||
{% if limit_data_rates == True %}
|
||||
--limit-rate-up {{ rate_limit_up }}
|
||||
--limit-rate-down {{ rate_limit_down }}
|
||||
{% endif %}
|
||||
{% if fast_sync == True %}
|
||||
--fast-block-sync=1
|
||||
{% else %}
|
||||
--fast-block-sync=0
|
||||
{% endif %}
|
||||
{% if monero_options != "" %}
|
||||
{{ monero_options }}
|
||||
|
@ -119,6 +170,7 @@ services:
|
|||
-u {{ xmrig_username }}
|
||||
{% endif %}
|
||||
--cpu-max-threads-hint={{ cpu_percent | int }}
|
||||
--cpu-priority={{ cpu_priority | int }}
|
||||
{% if xmrig_options != "" %}
|
||||
{{ xmrig_options }}
|
||||
{% endif %}
|
||||
|
|
39
docker-compose/configure
vendored
39
docker-compose/configure
vendored
|
@ -1,6 +1,45 @@
|
|||
#!/bin/bash
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Verifying Requirements:"
|
||||
DOCKER_VER=$(docker version -f "{{.Server.Version}}" 2> /dev/null)
|
||||
if [ -z "$DOCKER_VER" ]; then
|
||||
echo "Docker not found; install it: https://docs.docker.com/engine/install/"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(echo "$DOCKER_VER"| cut -d'.' -f 1)" -ge 19 ] && \
|
||||
[ "$(echo "$DOCKER_VER"| cut -d'.' -f 2)" -ge 0 ] && \
|
||||
[ "$(echo "$DOCKER_VER"| cut -d'.' -f 3)" -ge 3 ]; then
|
||||
echo "Docker Found; OK"
|
||||
else
|
||||
echo "Docker version less than 19.0.3; upgrade it: https://docs.docker.com/engine/install/"
|
||||
exit 1
|
||||
fi
|
||||
docker compose version 2>&1 > /dev/null
|
||||
COMPOSE_PLUGIN_RC=$?
|
||||
docker-compose --version 2>&1 > /dev/null
|
||||
COMPOSE_CLI_RC=$?
|
||||
if [ "$COMPOSE_PLUGIN_RC" -eq 0 ] || [ "$COMPOSE_CLI_RC" -eq 0 ]; then
|
||||
echo "Docker Compose found; OK"
|
||||
if [ "$COMPOSE_PLUGIN_RC" -eq 0 ]; then
|
||||
COMPOSE_COMMAND="docker compose"
|
||||
else
|
||||
COMPOSE_COMMAND="docker-compose"
|
||||
fi
|
||||
else
|
||||
echo "Docker Compose not found; install it: https://docs.docker.com/compose/install/compose-plugin/"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Building and Running P2Pool docker-compose Configuration"
|
||||
docker build -t p2pool_config:latest cfg
|
||||
docker run -it --rm -v $PWD:/docker-compose --user $(id -u):$(id -g) p2pool_config:latest
|
||||
CONFIGURE_RC=$?
|
||||
echo ""
|
||||
echo ""
|
||||
if [ "$CONFIGURE_RC" -eq 0 ]; then
|
||||
echo "P2Pool is configured. Start the project with: $COMPOSE_COMMAND up --build -d"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -5,14 +5,26 @@
|
|||
"sidechain": [
|
||||
0
|
||||
],
|
||||
"enable_statistics": true,
|
||||
"statistics_port": "3380",
|
||||
"expose_stratum_port": false,
|
||||
"stratum_port": "3333",
|
||||
"p2pool_log_level": 3,
|
||||
"enable_autodiff": true,
|
||||
"light_mode": false,
|
||||
"no_cache": false,
|
||||
"p2pool_options": "",
|
||||
"monero_version": "latest",
|
||||
"prune_blockchain": true,
|
||||
"monero_log_level": 0,
|
||||
"expose_rpc_port": false,
|
||||
"rpc_port": "18081",
|
||||
"rpc_login": "",
|
||||
"limit_data_rates": false,
|
||||
"rate_limit_up": "2048",
|
||||
"rate_limit_down": "8192",
|
||||
"sync_pruned_blocks": false,
|
||||
"fast_sync": false,
|
||||
"monero_options": "",
|
||||
"public_monero_node": "",
|
||||
"monero_node_login": "",
|
||||
|
@ -20,5 +32,6 @@
|
|||
"use_fixed_difficulty": true,
|
||||
"fixed_difficulty": 500000,
|
||||
"cpu_percent": 100,
|
||||
"cpu_priority": 2,
|
||||
"xmrig_options": ""
|
||||
}
|
|
@ -20,6 +20,7 @@ services:
|
|||
container_name: p2pool-p2pool
|
||||
networks:
|
||||
- p2pool
|
||||
privileged: true
|
||||
ports:
|
||||
|
||||
- 37888:37888/tcp
|
||||
|
@ -31,7 +32,8 @@ services:
|
|||
- /dev/hugepages:/dev/hugepages:rw
|
||||
|
||||
depends_on:
|
||||
- monero
|
||||
monero:
|
||||
condition: service_healthy
|
||||
|
||||
restart: unless-stopped
|
||||
command: >-
|
||||
|
@ -43,6 +45,31 @@ services:
|
|||
|
||||
|
||||
|
||||
--local-api
|
||||
--data-api /home/p2pool/.p2pool
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
statistics:
|
||||
image: statistics:latest
|
||||
build:
|
||||
context: statistics
|
||||
container_name: p2pool-statistics
|
||||
networks:
|
||||
- p2pool
|
||||
ports:
|
||||
- 3380:80/tcp
|
||||
volumes:
|
||||
- p2pool:/data:ro
|
||||
depends_on:
|
||||
- p2pool
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -57,11 +84,17 @@ services:
|
|||
- p2pool
|
||||
ports:
|
||||
- 18080:18080/tcp
|
||||
|
||||
volumes:
|
||||
- monero:/home/monero/.bitmonero:rw
|
||||
- /dev/null:/home/monero/.bitmonero/bitmonero.log:rw
|
||||
- /dev/hugepages:/dev/hugepages:rw
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-z", "localhost", "18081"]
|
||||
interval: 2s
|
||||
timeout: 1s
|
||||
start_period: 10s
|
||||
command: >-
|
||||
--zmq-pub tcp://0.0.0.0:18083
|
||||
--disable-dns-checkpoints
|
||||
|
@ -71,6 +104,7 @@ services:
|
|||
--p2p-bind-port=18080
|
||||
--rpc-bind-ip=0.0.0.0
|
||||
--rpc-bind-port=18081
|
||||
--restricted-rpc
|
||||
--confirm-external-bind
|
||||
--log-level=0
|
||||
|
||||
|
@ -80,6 +114,12 @@ services:
|
|||
|
||||
|
||||
|
||||
--fast-block-sync=0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
xmrig:
|
||||
image: xmrig:latest
|
||||
|
@ -102,4 +142,5 @@ services:
|
|||
-u p2pool
|
||||
|
||||
--cpu-max-threads-hint=100
|
||||
--cpu-priority=2
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ RUN set -e && \
|
|||
apt-get update -q -y --no-install-recommends && \
|
||||
DEBIAN_FRONTEND="noninteractive" apt-get install -q -y --no-install-recommends \
|
||||
libgssapi-krb5-2 \
|
||||
netcat \
|
||||
&& \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt
|
||||
|
|
8
docker-compose/statistics/Dockerfile
Normal file
8
docker-compose/statistics/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM python:slim
|
||||
|
||||
COPY app /app
|
||||
|
||||
WORKDIR /app
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["/app/p2pool_statistics.py"]
|
78
docker-compose/statistics/app/p2pool_statistics.py
Executable file
78
docker-compose/statistics/app/p2pool_statistics.py
Executable file
|
@ -0,0 +1,78 @@
|
|||
#!/usr/bin/env python3
|
||||
import json
|
||||
from datetime import datetime
|
||||
from prefixed import Float
|
||||
import humanfriendly
|
||||
from flask import Flask, render_template
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
##
|
||||
# Add some custom jinja filters
|
||||
def timeago(value):
|
||||
"""Format a date time to human friendly time ago"""
|
||||
if value is None:
|
||||
return ""
|
||||
if type(value) is int:
|
||||
dt = datetime.fromtimestamp(value).replace(microsecond=0)
|
||||
now = datetime.now().replace(microsecond=0)
|
||||
return humanfriendly.format_timespan(now - dt)
|
||||
|
||||
|
||||
app.jinja_env.filters["timeago"] = timeago
|
||||
|
||||
|
||||
def human_numbers(value):
|
||||
"""Format a number in human readable format"""
|
||||
if value is None:
|
||||
return ""
|
||||
return "{:!.3h}".format(Float(value))
|
||||
|
||||
|
||||
app.jinja_env.filters["humanize"] = human_numbers
|
||||
|
||||
|
||||
##
|
||||
# Get Pool Instance Birth Date
|
||||
def birthdate():
|
||||
try:
|
||||
with open("/data/p2pool.blocks") as reader:
|
||||
first_block = reader.readline().rstrip()
|
||||
bday_ts = int(first_block.split(" ")[0])
|
||||
bday = timeago(bday_ts)
|
||||
return bday
|
||||
except Exception as e:
|
||||
return "unknown time"
|
||||
|
||||
|
||||
##
|
||||
# The App Routes
|
||||
@app.route("/")
|
||||
def render():
|
||||
try:
|
||||
my_bday = birthdate()
|
||||
with open("/data/stats_mod", "r") as reader:
|
||||
stats_mod = json.loads(reader.read())
|
||||
with open("/data/pool/stats", "r") as reader:
|
||||
pool_stats = json.loads(reader.read())
|
||||
with open("/data/network/stats", "r") as reader:
|
||||
network_stats = json.loads(reader.read())
|
||||
with open("/data/local/stats", "r") as reader:
|
||||
local_stats = json.loads(reader.read())
|
||||
return render_template(
|
||||
"index.html",
|
||||
my_bday=my_bday,
|
||||
stats_mod=stats_mod,
|
||||
pool_stats=pool_stats,
|
||||
network_stats=network_stats,
|
||||
local_stats=local_stats,
|
||||
)
|
||||
except Exception as e:
|
||||
return render_template("oops.html", error=str(e))
|
||||
|
||||
|
||||
##
|
||||
# main()
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=False, host="0.0.0.0", port=80)
|
3
docker-compose/statistics/app/requirements.txt
Normal file
3
docker-compose/statistics/app/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
flask
|
||||
prefixed
|
||||
humanfriendly
|
7
docker-compose/statistics/app/static/bootstrap.min.css
vendored
Normal file
7
docker-compose/statistics/app/static/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
7
docker-compose/statistics/app/static/bootstrap.min.js
vendored
Normal file
7
docker-compose/statistics/app/static/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
docker-compose/statistics/app/static/jquery-3.2.1.slim.min.js
vendored
Normal file
4
docker-compose/statistics/app/static/jquery-3.2.1.slim.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
docker-compose/statistics/app/static/monero-symbol-480.png
Normal file
BIN
docker-compose/statistics/app/static/monero-symbol-480.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
5
docker-compose/statistics/app/static/popper.min.js
vendored
Normal file
5
docker-compose/statistics/app/static/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
158
docker-compose/statistics/app/templates/index.html
Normal file
158
docker-compose/statistics/app/templates/index.html
Normal file
|
@ -0,0 +1,158 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="{{url_for('static', filename='bootstrap.min.css')}}">
|
||||
<title>Monero P2Pool Server Statistics</title>
|
||||
</head>
|
||||
<body style="font-size:85%;">
|
||||
<script src="{{url_for('static', filename='jquery-3.2.1.slim.min.js')}}"></script>
|
||||
<script src="{{url_for('static', filename='popper.min.js')}}"></script>
|
||||
<script src="{{url_for('static', filename='bootstrap.min.js')}}"></script>
|
||||
<div style="text-align:center;">
|
||||
<img src="{{url_for('static', filename='monero-symbol-480.png')}}" width="75px" height="75px" alt="Monero"/>
|
||||
<h1 style="color: #FFA500;">P2Pool Server Statistics</h1>
|
||||
</div>
|
||||
|
||||
<div class="card-group">
|
||||
<div class="col-sm-4 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-header text-black mb-1 pb-1" style="background-color: #FFA500;"><h2>Local Pool</h2></div>
|
||||
<div class="card-body mb-0 pb-0">
|
||||
<h6 class="card-subtitle text-muted" style="font-size:80%;">(note: stats reset on restart)</h6>
|
||||
<div class="table-responsive table-hover table-condensed table-striped">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Hashrate 15 Minutes</td>
|
||||
<td>{{ local_stats["hashrate_15m"]|humanize }}H/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hashrate 1 Hour</td>
|
||||
<td>{{ local_stats["hashrate_1h"]|humanize }}H/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hashrate 24 Hours</td>
|
||||
<td>{{ local_stats["hashrate_24h"]|humanize }}H/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shares Found</td>
|
||||
<td>{{ local_stats["shares_found"] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Current Effort</td>
|
||||
<td>{{ local_stats["current_effort"] }}%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Average Effort</td>
|
||||
<td>{{ local_stats["average_effort"] }}%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Total Hashes</td>
|
||||
<td>{{ local_stats["total_hashes"]|humanize }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Miner Connections</td>
|
||||
<td>{{ local_stats["incoming_connections"] }}<td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-header text-black mb-1 pb-1" style="background-color: #FFA500;"><h2>Global Pool</h2></div>
|
||||
<div class="card-body mb-0 pb-0">
|
||||
<h6 class="card-subtitle text-muted" style="font-size:80%;"> </h6>
|
||||
<div class="table-responsive table-hover table-condensed table-striped">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Hash Rate</td>
|
||||
<td>{{ pool_stats["pool_statistics"]["hashRate"]|humanize }}H/s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Round Hashes</td>
|
||||
<td>{{ stats_mod["pool"]["roundHashes"]|humanize }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Last Block Found</td>
|
||||
<td>{{ pool_stats["pool_statistics"]["lastBlockFound"] }} <br>
|
||||
{{ pool_stats["pool_statistics"]["lastBlockFoundTime"]|timeago }} ago</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Payout Method</td>
|
||||
<td>{{ pool_stats["pool_list"]|join(',') }}<br>2160 block window (~6 hours)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<h6 class="card-subtitle text-muted" style="font-size:80%;">(since instance birth: {{ my_bday }} ago)</h6>
|
||||
<div class="table-responsive table-hover table-condensed table-striped">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Total Hashes</td>
|
||||
<td>{{ pool_stats["pool_statistics"]["totalHashes"]|humanize }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Blocks Found</td>
|
||||
<td>{{ pool_stats["pool_statistics"]["totalBlocksFound"] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Known Miners</td>
|
||||
<td>{{ pool_stats["pool_statistics"]["miners"] }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-header text-black mb-1 pb-1" style="background-color: #FFA500;"><h2>Monero Network</h2></div>
|
||||
<div class="card-body mb-0 pb-0">
|
||||
<h6 class="card-subtitle text-muted" style="font-size:80%;"> </h6>
|
||||
<div class="table-responsive table-hover table-condensed table-striped">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Height</td>
|
||||
<td>{{ network_stats["height"] }}<br>
|
||||
{{ network_stats["timestamp"]|timeago }} ago</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Difficulty</td>
|
||||
<td>{{ network_stats["difficulty"]|humanize }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Reward</td>
|
||||
<td>0.{{ network_stats["reward"] }} Monero</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Head Hash</td>
|
||||
<td>{{ network_stats["hash"] }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.setInterval('refresh()', 30000); // Call refresh function every 30000 milliseconds (30 seconds).
|
||||
function refresh() {
|
||||
window .location.reload();
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
12
docker-compose/statistics/app/templates/oops.html
Normal file
12
docker-compose/statistics/app/templates/oops.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Oops</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Ooops, something went wrong:</h2>
|
||||
{{ error }}
|
||||
(Maybe you need to wait a few minutes for p2pool to start and sync for the first time?)
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue