Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Commit

Permalink
Support for xmrig 3.0:
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ste committed Aug 23, 2019
1 parent 1201cb4 commit 62fcd05
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 107 deletions.
113 changes: 57 additions & 56 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -52,61 +52,88 @@ xmrig:
package_state: 'latest'
xmrig_settings:
# Mandatory variable.
- name: 'cpu0'
- name: 'cpu'
# Mandatory variable: miner type: 'cpu' for cpu miner, 'amd' for gpu miner.
type: 'cpu'
# 'cryptonight' (default) or 'cryptonight-lite'.
algo: 'cryptonight'
# CPU settings (since xmrig 3.0).
cpu:
# 'true' or 'auto' - will try use proper assembly by CPUID information. This is
# default value. 'false' or 'none' - feature disabled. 'intel' best for Intel
# CPUs starting from Ivy Bridge/Sandy Bridge, 'ryzen' best for AMD Ryzen CPUs.
asm: 'auto'
# Algorithm variation, 0 auto select.
av: '0'
- asm: 'auto'
# This option possible values is range from 1 to 5.
intensity: '2'
# Mining threads priority, value from 1 (lowest priority) to 5 (highest
# possible priority). Default value 'null' means miner don't change threads
# priority at all.
priority: 'null'
# Force enable ('true') or disable ('false') hardware AES support. Default
# value 'null' means miner autodetect this feature. Usually don't need change
# this option, this option useful for some rare cases when miner can't detect
# hardware AES, but it available. If you force enable this option, but your
# hardware not support it, miner will crash.
hw_aes: 'null'
# Enable ('true') or disable ('false') huge pages support, by default 'true'.
huge_pages: 'false'
# Number of miner threads.
threads: 'null'
# True to run the miner in the background.
background: 'false'
# False to disable colored output.
colors: 'false'
# Set process affinity to CPU core(s) (defatul is 'null').
cpu_affinity: '0x7E'
# Set process priority (0 idle, 2 normal to 5 highest).
cpu_priority: 'null'
affinity: '0x7E'
# Donate level, mininum 1%.
donate_level: '5'
# Use huge pages or not.
huge_pages: 'false'
# '0' - donate over proxy disabled, only direct connections allowed.
# '1' - miner will try use proxy first with failback to direct connections.
# '2' - direct connections disabled.
# Default is '1'.
donate_over_proxy: '1'
# Log all output to a file, example: "/var/log/xmrig/xmrig.log".
log_file: 'null'
# Maximum CPU usage for automatic mode, usually limiting factor is CPU cache
# not this option.
max_cpu_usage: '75'
# Print hashrate report every N seconds.
print_time: '60'
# Number of times to retry before switch to backup server.
retries: '5'
# Time to pause between retries.
retry_pause: '5'
# Set to 'true' to safe adjust threads and av settings for current CPU.
safe: 'false'
# Use system log for output messages (default is 'false'). Set to 'true'
# for output log to systemd journald.
syslog: 'false'
# User agent (HTTP).
user_agent: 'null'
# Watch for config (?).
watch: 'false'
# Number of miner threads.
threads: 'null'
# https://github.com/xmrig/xmrig/wiki/API
api:
- port: '0'
access_token: 'null'
# Miner ID, if not set created automatically.
- id: 'null'
# Optional worker name, if not set will be detected automatically.
worker_id: 'null'
ipv6: 'false'
http:
# Enable (true) or disable (false) HTTP API.
- enabled: 'true'
# Host for incoming connections http://<host>:<port>, to allow connections from
# all interfaces use 0.0.0.0 (IPv4) or :: (IPv4+IPv6).
host: '127.0.0.1'
# Port for incoming connections http://<host>:<port>, zero port is valid option
# and means random port.
port: '0'
# Bearer access token to secure access to API. Miner support this token only via
# 'Authorization' header.
access_token: 'null'
# Use 'false' to allow remote configuration.
restricted: 'true'
# RandomX algo settings.
randomx:
# Disable per numa allocation if not enough RAM (default is enabled).
- numa: 'false'
init: '-1'
pools:
# URL of mining server.
- url: 'monero.napaster.name:14444'
# Algorithm PoW variant.
algo: 'cn/r'
# Username for mining server.
user: '43kwWi8seNj1arEEKkbS95jAQRdPuY6hmiKqwS3wirGgNG5xPqUBxJvj214k1w48rB8Hzht9ZpUWcb2AWxmCL41tCH11mjh'
# Password for mining server.
Expand All @@ -117,43 +144,15 @@ xmrig:
keepalive: 'true'
# Enable nicehash/xmrig-proxy support.
nicehash: 'false'
# Algorithm PoW variant, '-1' for autodetection.
variant: '-1'
# Enable TLS support.
tls: 'false'
# Optionally verify pool certificate fingerprint.
tls_fingerprint: 'null'
- name: 'cpu1'
type: 'cpu'
algo: 'cryptonight-lite'
asm: 'auto'
av: '0'
background: 'false'
colors: 'false'
cpu_affinity: '0x7E00'
cpu_priority: 'null'
donate_level: '5'
log_file: 'null'
max_cpu_usage: '75'
print_time: '60'
retries: '5'
retry_pause: '5'
safe: 'false'
syslog: 'false'
user_agent: 'null'
watch: 'false'
threads: 'null'
api:
- port: '0'
access_token: 'null'
worker_id: 'null'
ipv6: 'false'
restricted: 'true'
pools: "{{ xmrig_pools }}"
# Connect to daemon (monerod) instead pool?
daemon: 'false'
# AMD GPU miner
- name: 'opencl0'
type: 'amd'
algo: 'cryptonight-lite'
autosave: 'false'
# Enable OpenCL cache or not.
cache: 'true'
Expand All @@ -166,7 +165,6 @@ xmrig:
print_time: '60'
retries: '5'
retry_pause: '5'
safe: 'false'
syslog: 'false'
user_agent: 'null'
watch: 'false'
Expand Down Expand Up @@ -211,10 +209,13 @@ xmrig:
comp_mode: 'true'
affine_to_cpu: 'false'
api:
- port: '0'
access_token: 'null'
- id: 'null'
worker_id: 'null'
ipv6: 'false'
http:
- enabled: 'true'
host: '127.0.0.1'
port: '0'
access_token: 'null'
restricted: 'true'
pools: "{{ xmrig_pools }}"
```
34 changes: 34 additions & 0 deletions templates/xmrig.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@
{{ '{' }}
{% include 'xmrig_main.j2' %}
{% if item.type == 'cpu' %}
{% if item.cpu is defined and item.cpu != '' %}
{% for xc in item.cpu %}
{% if loop.first %}
{{ ' \"cpu\": {' }}
{{ ' \"*\": {' }}
{% endif %}
{% include 'xmrig_cpu.j2' %}
{% if loop.last %}
{{ ' ' + '}' }}
{{ ' ' + '},' }}
{% endif %}
{% endfor %}
{% endif %}
{% elif item.type == 'amd' %}
{% include 'xmrig_amd.j2' %}
{% endif %}
Expand All @@ -20,6 +32,28 @@
{% endif %}
{% endfor %}
{% endif %}
{% if item.randomx is defined and item.randomx != '' %}
{% for xr in item.randomx %}
{% if loop.first %}
{{ ' ' ~ '\"randomx\"' ~ ': {' }}
{% endif %}
{% include 'xmrig_randomx.j2' %}
{% if loop.last %}
{{ ' ' + '},' }}
{% endif %}
{% endfor %}
{% endif %}
{% if item.http is defined and item.http != '' %}
{% for xh in item.http %}
{% if loop.first %}
{{ ' ' ~ '\"http\"' ~ ': {' }}
{% endif %}
{% include 'xmrig_http.j2' %}
{% if loop.last %}
{{ ' ' + '},' }}
{% endif %}
{% endfor %}
{% endif %}
{% if item.pools is defined and item.pools != '' %}
{% for xp in item.pools %}
{% if loop.first %}
Expand Down
25 changes: 4 additions & 21 deletions templates/xmrig_api.j2
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
{% if xa.port is defined and xa.port != '' %}
{{ ' ' ~ '\"port\"' ~ ': ' ~ xa.port ~ ',' }}
{% if xr.init is defined and xr.init != '' %}
{{ ' ' ~ '\"worker-id\"' ~ ': ' ~ xr.init ~ ',' }}
{% endif %}
{% if xa.access_token is defined and xa.access_token != '' %}
{% if xa.access_token == 'null' %}
{{ ' ' ~ '\"access-token\"' ~ ': ' ~ xa.access_token ~ ',' }}
{% else %}
{{ ' ' ~ '\"access-token\"' ~ ': \"' ~ xa.access_token ~ '\",' }}
{% endif %}
{% endif %}
{% if xa.worker_id is defined and xa.worker_id != '' %}
{% if xa.worker_id == 'null' %}
{{ ' ' ~ '\"worker-id\"' ~ ': ' ~ xa.worker_id ~ ',' }}
{% else %}
{{ ' ' ~ '\"worker-id\"' ~ ': \"' ~ xa.worker_id ~ '\",' }}
{% endif %}
{% endif %}
{% if xa.ipv6 is defined and xa.ipv6 in ['true', 'false'] %}
{{ ' ' ~ '\"ipv6\"' ~ ': ' ~ xa.ipv6 ~ ',' }}
{% endif %}
{% if xa.restricted is defined and xa.restricted in ['true', 'false'] %}
{{ ' ' ~ '\"restricted\"' ~ ': ' ~ xa.restricted ~ ',' }}
{% if xr.numa is defined and xr.numa in ['true', 'false'] %}
{{ ' ' ~ '\"numa\"' ~ ': ' ~ xr.hw_aes ~ ',' }}
{% endif %}
40 changes: 21 additions & 19 deletions templates/xmrig_cpu.j2
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{% if item.asm is defined and item.asm in ['true', 'false'] %}
{{ ' ' ~ '\"asm\"' ~ ': ' ~ item.asm ~ ',' }}
{% elif item.asm is defined and item.asm in ['auto', 'none',
'intel', 'ryzen'] %}
{{ ' ' ~ '\"asm\"' ~ ': \"' ~ item.asm ~ '\",' }}
{% if xc.asm is defined and xc.asm in ['true', 'false'] %}
{{ ' ' ~ '\"asm\"' ~ ': ' ~ xc.asm ~ ',' }}
{% elif xc.asm is defined and xc.asm in ['intel', 'ryzen', 'bulldozer'] %}
{{ ' ' ~ '\"asm\"' ~ ': \"' ~ xc.asm ~ '\",' }}
{% endif %}
{% if item.av is defined and item.av in ['0', '1', '2', '3', '4'] %}
{{ ' ' ~ '\"av\"' ~ ': ' ~ item.av ~ ',' }}
{% if xc.huge_pages is defined and xc.huge_pages in ['true', 'false'] %}
{{ ' ' ~ '\"huge-pages\"' ~ ': ' ~ xc.huge_pages ~ ',' }}
{% endif %}
{% if item.max_cpu_usage is defined and item.max_cpu_usage != '' %}
{{ ' ' ~ '\"max-cpu-usage\"' ~ ': ' ~ item.max_cpu_usage ~ ',' }}
{% if xc.hw_aes is defined and xc.hw_aes in ['true', 'false'] %}
{{ ' ' ~ '\"hw-aes\"' ~ ': ' ~ xc.hw_aes ~ ',' }}
{% endif %}
{% if item.cpu_affinity is defined and item.cpu_affinity != '' %}
{% if item.cpu_affinity == 'null' %}
{{ ' ' ~ '\"cpu-affinity\"' ~ ': ' ~ item.cpu_affinity ~ ',' }}
{% if xc.affinity is defined and xc.affinity != '' %}
{% if xc.affinity == 'null' %}
{{ ' ' ~ '\"affinity\"' ~ ': ' ~ xc.affinity ~ ',' }}
{% else %}
{{ ' ' ~ '\"cpu-affinity\"' ~ ': \"' ~ item.cpu_affinity ~ '\",' }}
{{ ' ' ~ '\"affinity\"' ~ ': \"' ~ xc.affinity ~ '\",' }}
{% endif %}
{% endif %}
{% if item.cpu_priority is defined and item.cpu_priority != '' %}
{% if item.cpu_priority == 'null' %}
{{ ' ' ~ '\"cpu-priority\"' ~ ': ' ~ item.cpu_priority ~ ',' }}
{% if xc.priority is defined and xc.priority != '' %}
{% if xc.priority == 'null' %}
{{ ' ' ~ '\"priority\"' ~ ': ' ~ xc.priority ~ ',' }}
{% else %}
{{ ' ' ~ '\"cpu-priority\"' ~ ': \"' ~ item.cpu_priority ~ '\",' }}
{{ ' ' ~ '\"priority\"' ~ ': \"' ~ xc.priority ~ '\",' }}
{% endif %}
{% endif %}
{% if item.threads is defined and item.threads != '' %}
{{ ' ' ~ '\"threads\"' ~ ': ' ~ item.threads ~ ',' }}
{% if xc.threads is defined and xc.threads != '' %}
{{ ' ' ~ '\"threads\"' ~ ': ' ~ xc.threads ~ ',' }}
{% endif %}
{% if xc.intensity is defined and xc.intensity != '' %}
{{ ' ' ~ '\"intensity\"' ~ ': ' ~ xc.intensity ~ ',' }}
{% endif %}
19 changes: 19 additions & 0 deletions templates/xmrig_http.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% if xh.enabled is defined and xh.enabled in ['true', 'false'] %}
{{ ' ' ~ '\"enabled\"' ~ ': ' ~ xh.enabled ~ ',' }}
{% endif %}
{% if xh.host is defined and xh.host | ipaddr('host') %}
{{ ' ' ~ '\"host\"' ~ ': \"' ~ xh.host ~ '\",' }}
{% endif %}
{% if xh.port is defined and xh.port != '' %}
{{ ' ' ~ '\"port\"' ~ ': ' ~ xh.port ~ ',' }}
{% endif %}
{% if xh.access_token is defined and xh.access_token != '' %}
{% if xh.access_token == 'null' %}
{{ ' ' ~ '\"access-token\"' ~ ': ' ~ xh.access_token ~ ',' }}
{% else %}
{{ ' ' ~ '\"access-token\"' ~ ': \"' ~ xh.access_token ~ '\",' }}
{% endif %}
{% endif %}
{% if xh.restricted is defined and xh.restricted in ['true', 'false'] %}
{{ ' ' ~ '\"restricted\"' ~ ': ' ~ xh.restricted ~ ',' }}
{% endif %}
11 changes: 3 additions & 8 deletions templates/xmrig_main.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{% if item.algo is defined and item.algo != '' %}
{{ ' ' ~ '\"algo\"' ~ ': \"' ~ item.algo ~ '\",' }}
{% endif %}
{% if item.background is defined and item.background in ['true', 'false'] %}
{{ ' ' ~ '\"background\"' ~ ': ' ~ item.background ~ ',' }}
{% endif %}
Expand All @@ -17,8 +14,9 @@
{% if item.donate_level is defined and item.donate_level != '' %}
{{ ' ' ~ '\"donate-level\"' ~ ': ' ~ item.donate_level ~ ',' }}
{% endif %}
{% if item.huge_pages is defined and item.huge_pages in ['true', 'false'] %}
{{ ' ' ~ '\"huge-pages\"' ~ ': ' ~ item.huge_pages ~ ',' }}
{% if item.donate_over_proxy is defined and
item.donate_over_proxy in ['1', '2', '3'] %}
{{ ' ' ~ '\"donate-over-proxy\"' ~ ': ' ~ item.donate_over_proxy ~ ',' }}
{% endif %}
{% if item.print_time is defined and item.print_time != '' %}
{{ ' ' ~ '\"print-time\"' ~ ': ' ~ item.print_time ~ ',' }}
Expand All @@ -29,9 +27,6 @@
{% if item.retry_pause is defined and item.retry_pause != '' %}
{{ ' ' ~ '\"retry-pause\"' ~ ': ' ~ item.retry_pause ~ ',' }}
{% endif %}
{% if item.safe is defined and item.safe in ['true', 'false'] %}
{{ ' ' ~ '\"safe\"' ~ ': ' ~ item.safe ~ ',' }}
{% endif %}
{% if item.syslog is defined and item.syslog in ['true', 'false'] %}
{{ ' ' ~ '\"syslog\"' ~ ': ' ~ item.syslog ~ ',' }}
{% endif %}
Expand Down
9 changes: 6 additions & 3 deletions templates/xmrig_pool.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{% if xp.algo is defined and xp.algo != '' %}
{{ ' ' ~ '\"algo\"' ~ ': \"' ~ xp.algo ~ '\",' }}
{% endif %}
{% if xp.keepalive is defined and xp.keepalive in ['true', 'false'] %}
{{ ' ' ~ '\"keepalive\"' ~ ': ' ~ xp.keepalive ~ ',' }}
{% endif %}
Expand All @@ -20,9 +23,6 @@
{{ ' ' ~ '\"rig-id\"' ~ ': \"' ~ xp.rig_id ~ '\",' }}
{% endif %}
{% endif %}
{% if xp.variant is defined and xp.variant != '' %}
{{ ' ' ~ '\"variant\"' ~ ': \"' ~ xp.variant ~ '\",' }}
{% endif %}
{% if xp.tls is defined and xp.tls in ['true', 'false'] %}
{{ ' ' ~ '\"tls\"' ~ ': ' ~ xp.tls ~ ',' }}
{% endif %}
Expand All @@ -33,3 +33,6 @@
{{ ' ' ~ '\"tls-fingerprint\"' ~ ': \"' ~ xp.tls_fingerprint ~ '\",' }}
{% endif %}
{% endif %}
{% if xp.daemon is defined and xp.daemon in ['true', 'false'] %}
{{ ' ' ~ '\"daemon\"' ~ ': ' ~ xp.daemon ~ ',' }}
{% endif %}

0 comments on commit 62fcd05

Please sign in to comment.