Add changes I've made manually on the build server
This also adds the xmr-stak cypto miner container image I created That one is the first of potentially many images I won't push to the official Docker Hub registries, but insted to my own private registry
This commit is contained in:
parent
45983f1d10
commit
8c3769180d
12
Makefile
12
Makefile
@ -1,3 +1,5 @@
|
|||||||
|
.PHONY: build push hub build_reg push_reg registry all
|
||||||
|
|
||||||
modded_mc = siverten/magma siverten/rlcraft
|
modded_mc = siverten/magma siverten/rlcraft
|
||||||
mc_contexts = $(modded_mc) siverten/papermc siverten/waterfall
|
mc_contexts = $(modded_mc) siverten/papermc siverten/waterfall
|
||||||
game_contexts = $(mc_contexts) siverten/tshock
|
game_contexts = $(mc_contexts) siverten/tshock
|
||||||
@ -5,20 +7,20 @@ game_contexts = $(mc_contexts) siverten/tshock
|
|||||||
contexts = siverten/bind9 siverten/oxen siverten/tor\
|
contexts = siverten/bind9 siverten/oxen siverten/tor\
|
||||||
$(game_contexts)
|
$(game_contexts)
|
||||||
|
|
||||||
.PHONY: build push hub build_reg push_reg registry all
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(foreach context,$(contexts),docker build $(context);)
|
$(foreach context,$(contexts),docker build --pull $(context);)
|
||||||
push:
|
push:
|
||||||
$(foreach context,$(contexts),docker push $(context);)
|
$(foreach context,$(contexts),docker push $(context);)
|
||||||
hub: build push
|
hub: build push
|
||||||
|
|
||||||
|
|
||||||
reg_contexts = xmr-stak
|
reg_contexts = xmr-stak
|
||||||
|
|
||||||
build_reg:
|
build_reg:
|
||||||
$(foreach context,$(reg_contexts),docker build $(context);docker tag $(context) registry.sivert.pw/$(context))
|
$(foreach context,$(reg_contexts),docker build --pull $(context);docker tag $(context) registry.42069.no/$(context))
|
||||||
push_reg:
|
push_reg:
|
||||||
$(foreach context,$(reg_contexts),docker push registry.sivert.pw/$(context);)
|
$(foreach context,$(reg_contexts),docker push registry.42069.no/$(context);)
|
||||||
|
|
||||||
|
|
||||||
registry: build_reg push_reg
|
registry: build_reg push_reg
|
||||||
all: hub registry
|
all: hub registry
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
FROM alpine:3.12
|
FROM alpine:latest
|
||||||
|
RUN apk update && apk upgrade
|
||||||
RUN apk --update --no-cache add bind bind-dnssec-tools
|
RUN apk --no-cache add bind bind-dnssec-tools
|
||||||
EXPOSE 53
|
EXPOSE 53
|
||||||
|
|
||||||
CMD ["named", "-c", "/etc/bind/named.conf", "-g", "-u", "named"]
|
CMD ["named", "-c", "/etc/bind/named.conf", "-g", "-u", "named"]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
FROM debian:10
|
#FROM debian:10
|
||||||
|
FROM debian:latest
|
||||||
|
|
||||||
RUN apt update
|
RUN apt update
|
||||||
RUN apt install -y curl
|
RUN apt install -y curl
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM openjdk:16-slim
|
FROM openjdk:17-slim
|
||||||
|
|
||||||
ENV MC_VERSION="latest" \
|
ENV MC_VERSION="latest" \
|
||||||
PAPER_BUILD="latest" \
|
PAPER_BUILD="latest" \
|
||||||
|
5
xmr-stak/Dockerfile
Normal file
5
xmr-stak/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
RUN apk add python3
|
||||||
|
COPY ./ /opt
|
||||||
|
WORKDIR /opt
|
||||||
|
CMD ./miner.py -m1
|
1
xmr-stak/config.txt
Normal file
1
xmr-stak/config.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
"call_timeout": 10, "retry_time": 30, "giveup_limit": 0, "verbose_level": 4, "print_motd": false, "h_print_time": 300, "aes_override": null, "use_slow_memory": "always", "tls_secure_algo": true, "daemon_mode": false, "output_file": "", "httpd_port": 8080, "http_login": "", "http_pass": "", "prefer_ipv4": false,
|
1
xmr-stak/cpu.txt
Normal file
1
xmr-stak/cpu.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
"cpu_threads_conf": [{"low_power_mode": 5, "affine_to_cpu": false}, {"low_power_mode": 5, "affine_to_cpu": false}],
|
112
xmr-stak/miner.py
Executable file
112
xmr-stak/miner.py
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
from getopt import gnu_getopt, GetoptError
|
||||||
|
from json import dumps, loads
|
||||||
|
from os import environ
|
||||||
|
|
||||||
|
from sys import stdout, stdin
|
||||||
|
|
||||||
|
if environ.get('SLOW_MEMORY') == None:
|
||||||
|
environ['SLOW_MEMORY'] = 'warn'
|
||||||
|
if environ.get('WORK_GROUP') == None:
|
||||||
|
environ['WORK_GROUP'] = 'testing'
|
||||||
|
|
||||||
|
xmr = {
|
||||||
|
'config.txt': {
|
||||||
|
"call_timeout": 10,
|
||||||
|
"retry_time": 30,
|
||||||
|
"giveup_limit": 0,
|
||||||
|
"verbose_level": 4,
|
||||||
|
"print_motd": False,
|
||||||
|
"h_print_time": 300,
|
||||||
|
"aes_override": None,
|
||||||
|
"use_slow_memory": environ['SLOW_MEMORY'],
|
||||||
|
"tls_secure_algo": True,
|
||||||
|
"daemon_mode": False,
|
||||||
|
"output_file": "", #"/var/log/xmr-stak-rx.log",
|
||||||
|
"httpd_port": 8080,
|
||||||
|
"http_login": "",
|
||||||
|
"http_pass": "",
|
||||||
|
"prefer_ipv4": False,
|
||||||
|
},
|
||||||
|
'pools.txt': { "pool_list": [ {
|
||||||
|
"pool_address": "europe.randomx-hub.miningpoolhub.com:20580",
|
||||||
|
"wallet_address": f"Ghost-Zephyr.{environ['WORK_GROUP']}", "rig_id" : "",
|
||||||
|
"pool_password": "x", "use_nicehash": False, "use_tls": False, "tls_fingerprint": "",
|
||||||
|
"pool_weight": 1 },
|
||||||
|
], "currency": "monero" },
|
||||||
|
'cpu.txt': {
|
||||||
|
"cpu_threads_conf" : [
|
||||||
|
#{ "low_power_mode": 5, "affine_to_cpu": false },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sys = []
|
||||||
|
|
||||||
|
def usage():
|
||||||
|
print('''
|
||||||
|
Docker cryptominer script.
|
||||||
|
Automagically generates configs and runs miner programs inside a container.
|
||||||
|
|
||||||
|
-h --help, shows this.
|
||||||
|
-m --monero [n], mines monero with n threads.
|
||||||
|
''')
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
try:
|
||||||
|
opts, _ = gnu_getopt(argv, 'm:h', ['monero=', 'help'])
|
||||||
|
if len(opts) < 1:
|
||||||
|
usage()
|
||||||
|
exit()
|
||||||
|
for o, a in opts:
|
||||||
|
if o in ('-m', '--monero'):
|
||||||
|
monero(a)
|
||||||
|
elif o in ('-h', '--help'):
|
||||||
|
usage()
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
|
assert False, "unhandled option"
|
||||||
|
#calls(sys)
|
||||||
|
except GetoptError as err:
|
||||||
|
print(f'\n{err}')
|
||||||
|
usage()
|
||||||
|
|
||||||
|
def monero(threads):
|
||||||
|
try:
|
||||||
|
for _ in range(0, int(threads)):
|
||||||
|
xmr['cpu.txt']['cpu_threads_conf'].append({ "low_power_mode": 5, "affine_to_cpu": False })
|
||||||
|
for c in xmr:
|
||||||
|
with open(c, 'r') as f:
|
||||||
|
d = f.readline()
|
||||||
|
if f'{dumps(xmr[c])[1:-1]},' != d:
|
||||||
|
with open(c, 'w') as f:
|
||||||
|
f.write(f'{dumps(xmr[c])[1:-1]},')
|
||||||
|
print(f'Config {c} updated.')
|
||||||
|
else:
|
||||||
|
print(f'Config {c} unchanged.')
|
||||||
|
#sys.append(xmr)
|
||||||
|
p = Popen(['./xmr-stak-rx', '--currency', 'monero', '--config', 'config.txt', '--noDevSupport', '--noTest'], stdout=PIPE, stderr=PIPE, stdin=stdin)
|
||||||
|
for c in iter(lambda: p.stdout.readline(1), b''): stdout.write(c.decode('utf-8'))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
p.terminate()
|
||||||
|
o, _ = p.communicate()
|
||||||
|
print(o.decode('utf-8'))
|
||||||
|
except NameError:
|
||||||
|
print('\\nGot keyboard interrupt beafore starting xmr-stak-rx.')
|
||||||
|
except ValueError:
|
||||||
|
print('\nThreads has to be a number.')
|
||||||
|
usage()
|
||||||
|
|
||||||
|
def calls(sys):
|
||||||
|
if len(sys) > 1:
|
||||||
|
raise NotImplementedError # TODO: syscall hander with std pipes to run multiple miners at once. subprocess.Popen?
|
||||||
|
if 'xmr' in sys:
|
||||||
|
p = Popen('./xmr-stak-rx --currency monero --config config.txt --noDevSupport --noTest', shell=True, stdout=PIPE, stderr=PIPE, stdin=stdin)
|
||||||
|
o, _ = p.communicate()
|
||||||
|
print(o.decode('utf-8'))
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
from sys import argv
|
||||||
|
main(argv[1:])
|
||||||
|
|
1
xmr-stak/pools.txt
Normal file
1
xmr-stak/pools.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
"pool_list": [{"pool_address": "europe.randomx-hub.miningpoolhub.com:20580", "wallet_address": "Ghost-Zephyr.datacenter", "rig_id": "", "pool_password": "x", "use_nicehash": false, "use_tls": false, "tls_fingerprint": "", "pool_weight": 1}], "currency": "monero",
|
BIN
xmr-stak/xmr-stak-rx
Executable file
BIN
xmr-stak/xmr-stak-rx
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user