Compare commits

..

No commits in common. "master" and "801826e5c925a4058f36f3f905c92c7415ec9d89" have entirely different histories.

35 changed files with 49 additions and 724 deletions

View File

@ -1,25 +0,0 @@
---
kind: pipeline
type: docker
name: build and push
steps:
- name: build and push
image: docker:dind
volumes:
- name: docker.sock
path: /var/run/docker.sock
environment:
REG:
from_secret: registry
commands:
- mkdir ~/.docker
- echo "$REG" > ~/.docker/config.json
- apk add make
- make all
volumes:
- name: docker.sock
host:
path: /var/run/docker.sock

View File

@ -208,8 +208,8 @@ If you develop a new program, and you want it to be of the greatest possible use
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
Dockerfiles developed and maintained by Sivert V. Sæther.
Copyright (C) 2021 Sivert V. Sæther <dockerfiles@sivert.pw>
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
@ -221,7 +221,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
Dockerfiles Copyright (C) 2021 Sivert V. Sæther <dockerfiles@sivert.pw>
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.

View File

@ -1,26 +0,0 @@
.PHONY: build push hub build_reg push_reg registry all
modded_mc = magma rlcraft
mc_contexts = $(modded_mc) papermc waterfall
game_contexts = $(mc_contexts) tshock
contexts = ansible bind9 oxen tor $(game_contexts)
build:
$(foreach context,$(contexts),docker build --pull siverten/$(context) -t siverten/$(context);)
push:
$(foreach context,$(contexts),docker push siverten/$(context);)
hub: build push
reg_contexts = #xmr-stak
build_reg:
$(foreach context,$(reg_contexts),docker build --pull $(context) -t $(context);docker tag $(context) registry.42069.no/$(context))
push_reg:
$(foreach context,$(reg_contexts),docker push registry.42069.no/$(context);)
registry: build_reg push_reg
all: hub registry

View File

@ -1,13 +1,4 @@
# Dockerfiles
[![Build Status](https://drone.42069.no/api/badges/siv/dockerfiles/status.svg)](https://drone.42069.no/siv/dockerfiles)
Dockerfiles autored by me! I'm Sivert V. Sæther.
The siverten/ folder contains docker images you may find on
[DockerHub](https://hub.docker.com/u/siverten).
I would love for anyone to contriblute, but for the time being
this is hosted on my very own, pretty obscure git server.
## The sh folder
Contians a script and symlinks for using the Makefile.
Only Dockerfiles for build images so far.
Will most certanly put some other useful Dockerfiles here later.

39
build/image-builder.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
build_rust() {
docker build --pull -t registry.sivert.pw/build/rust:latest rust
}
push_rust() {
docker push registry.sivert.pw/build/rust:latest
}
build_and_push_rust() {
build_rust
push_rust
}
echo ''
echo ' --- image-builder.sh (6000) ---'
echo ''
echo ' 0 - exit'
echo ''
echo ' # rust'
echo ' 1 - build'
echo ' 2 - both'
echo ' 3 - push'
echo ''
# TODO: add submenus for more build images
loop() {
echo -n 'what numba? '
read -r todo
case $todo in
'0') exit 0 ;;
'1') build_rust ;;
'2') build_and_push_rust ;;
'3') push_rust ;;
*) loop && exit 0;; # sus
esac
}
loop

View File

@ -1,9 +1,7 @@
FROM alpine:edge
FROM archlinux:base-devel
RUN apk update && apk upgrade
RUN apk add rustup
RUN rustup-init -y
RUN pacman -Suyy --noconfirm\
rustup docker
RUN rustup toolchain install stable
ENV PATH="/root/.cargo/bin:${PATH}"
CMD [ "ash" ]
CMD [ "bash" ]

View File

@ -1 +0,0 @@
docker.sh

View File

@ -1,10 +0,0 @@
#!/bin/sh
op=`basename $0 .sh`
for context in $*; do
if [ "$op" == "build" ]; then
extra=" -t $context:latest"
else
extra=":latest"
fi
docker "$op" "$context"$extra
done

View File

@ -1 +0,0 @@
docker.sh

View File

@ -1,24 +0,0 @@
# Docker files for siverten/ docker images on the DockerHub registry!
### oxen
A bit bloated debian based docker image for running nodes
on the oxen/loki crypto network.
### magma
Is a minecraft server that supports both paper/spigot/bukkit plugins and
forge mods!
### rlcraft
Docker image based of the magma one that comes with the rlcraft modpack ready.
NOTE: requires the modpack .zip unpacked in a folder named rlcraft for the
Dockerfile build to work!
### tshock
Tsock Terraria server running in docker!
### tor
Simple alpine based tor docker image.
There should be an arm based version of this on DockerHub (siverten/tor-arm)!
### bind9
Simple alpine based bind9 docker image.

View File

@ -1,7 +0,0 @@
FROM alpine:latest
RUN apk update && apk upgrade
RUN apk add ansible expect
CMD ansible

View File

@ -1,5 +0,0 @@
FROM alpine:latest
RUN apk update && apk upgrade
RUN apk --no-cache add bind bind-dnssec-tools
EXPOSE 53
CMD ["named", "-c", "/etc/bind/named.conf", "-g", "-u", "named"]

View File

@ -1,26 +0,0 @@
FROM openjdk:8-jre
RUN mkdir /magma
WORKDIR /magma
ENV GIT_HASH "761933c"
ENV MC_RAM="1G"
#https://magmafoundation.org/#download
RUN wget https://github.com/magmafoundation/Magma/releases/download/v${GIT_HASH}-CUSTOM/Magma-${GIT_HASH}-STABLE-server.jar
RUN java -jar Magma-${GIT_HASH}-STABLE-server.jar nogui
RUN echo 'eula=true' > eula.txt
COPY server.properties .
COPY bukkit.yml .
COPY spigot.yml .
COPY paper.yml .
COPY magma.yml .
COPY ops.json .
EXPOSE 25565
EXPOSE 25575
VOLUME [ "/magma/plugins", "/magma/mods", "/magma/config", "/magma/world", "/magma/logs" ]
CMD java -server -Xms${MC_RAM} -Xmx${MC_RAM} -Dfml.queryResult=confirm -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -Djline.terminal=jline.UnsupportedTerminal -jar Magma-${GIT_HASH}-STABLE-server.jar nogui

View File

@ -1,37 +0,0 @@
# This is the main configuration file for Bukkit.
# As you can see, there's actually not that much to configure without any plugins.
# For a reference for any variable inside this file, check out the Bukkit Wiki at
# http://wiki.bukkit.org/Bukkit.yml
#
# If you need help on this file, feel free to join us on irc or leave a message
# on the forums asking for advice.
#
# IRC: #spigot @ irc.spi.gt
# (If this means nothing to you, just go to http://www.spigotmc.org/pages/irc/ )
# Forums: http://www.spigotmc.org/
# Bug tracker: http://www.spigotmc.org/go/bugs
settings:
allow-end: true
warn-on-overload: true
permissions-file: permissions.yml
update-folder: update
plugin-profiling: false
connection-throttle: 4000
query-plugins: true
deprecated-verbose: default
shutdown-message: Server closed
spawn-limits:
monsters: 70
animals: 15
water-animals: 5
ambient: 15
chunk-gc:
period-in-ticks: 600
load-threshold: 0
ticks-per:
animal-spawns: 400
monster-spawns: 1
autosave: 6000
aliases: now-in-commands.yml

View File

@ -1,51 +0,0 @@
# This is the main configuration file for Magma.
#
# Site: https://magmafoundation.org
# Discord: https://discord.gg/6rkqngA
#
# Value: forge.blacklistedmods.enabled Default: false # Enable blacklisting of mods
# Value: debug.debugPrintBukkitBannerPatterns Default: false # Prints the Forge Bukkit Banner Patterns
# Value: fakeplayer.permissions Default: # A list of permissions that fake players should have
# Value: magma.advanced.override-brand Default: false # Enables overriding the brand string
# Value: magma.advanced.tooltip-priority Default: mod # Mod, Plugin, None : determines what has tooltip priority
# Value: forge.blacklistedmods.list Default: # A list of mods to blacklist
# Value: magma.advanced.override-brand-name Default: Spigot # Value to use for new brand string
# Value: magma.messages.fml.fml-required Default: &cThis Server is running Magma. Forge and additional mods are required in order to connect to this server. # FML required kick message
# Value: debug.debugPrintCommandNode Default: false # Prints out all Command Nodes for permissions
# Value: magma.auto-update Default: true # Auto updates the Magma jar
# Value: experience-merge-max-value Default: -1 # Instructs the server put a maximum value on experience orbs, preventing them all from merging down into 1 single orb.
# Value: forge.bukkitPermissionHandler.enable Default: true # Let's Bukkit permission plugins handle forge/modded commands
# Value: magma.advanced.server-type Default: FML # Set to FML to show forge icon or BUKKIT to show bukkit icon (FML is default)
# Value: debug.debugPrintBukkitMatterials Default: false # Prints the Forge Bukkit Materials
# Value: forge.blacklistedmods.kickmessage Default: Please Remove Blacklisted Mods # Mod Blacklist kick message
# Value: magma.messages.fml.missing-mods Default: &cYou are missing the following mods: # Missing Mods kick message
forge:
blacklistedmods:
enabled: false
list: []
kickmessage: Please Remove Blacklisted Mods
bukkitPermissionHandler:
enable: true
autoUnloadDimensions:
- -1
debug:
debugPrintBukkitBannerPatterns: false
debugPrintCommandNode: false
debugPrintBukkitMatterials: false
fakeplayer:
permissions: []
magma:
advanced:
override-brand: false
tooltip-priority: mod
override-brand-name: PaperMC
server-type: FML
messages:
fml:
fml-required: '&cThis Server is running Magma. Forge and additional mods are
required in order to connect to this server.'
missing-mods: '&cYou are missing the following mods:'
auto-update: true
experience-merge-max-value: -1
config-version: 2

View File

@ -1,8 +0,0 @@
[
{
"uuid": "b879ccdf-6408-4420-93aa-6441d5f315e8",
"name": "GhostZephyr",
"level": 4,
"bypassesPlayerLimit": true
}
]

View File

@ -1,48 +0,0 @@
# This is the main configuration file for Paper.
# As you can see, there's tons to configure. Some options may impact gameplay, so use
# with caution, and make sure you know what each option does before configuring.
#
# If you need help with the configuration or have any questions related to Paper,
# join us in our IRC channel.
#
# IRC: #paper @ irc.spi.gt ( http://irc.spi.gt/iris/?channels=paper )
# Wiki: https://paper.readthedocs.org/
# Paper Forums: https://aquifermc.org/
verbose: false
config-version: 13
settings:
sleep-between-chunk-saves: false
load-permissions-yml-before-plugins: true
region-file-cache-size: 256
enable-player-collisions: true
save-empty-scoreboard-teams: false
bungee-online-mode: true
incoming-packet-spam-threshold: 300
player-auto-save-rate: -1
max-player-auto-save-per-tick: -1
remove-invalid-statistics: false
save-player-data: true
use-alternative-luck-formula: false
min-chunk-load-threads: 2
suggest-player-names-when-null-tab-completions: true
spam-limiter:
tab-spam-increment: 10
tab-spam-limit: 500
book-size:
page-max: 2560
total-multiplier: 0.98
messages:
kick:
authentication-servers-down: ''
flying-player: Flying is not enabled on this server
flying-vehicle: Flying is not enabled on this server
timings:
enabled: true
verbose: true
server-name-privacy: false
hidden-config-entries:
- database
- settings.bungeecord-addresses
history-interval: 300
history-length: 3600

View File

@ -1,40 +0,0 @@
#Minecraft server properties
#Tue Feb 23 17:29:59 CET 2021
spawn-protection=16
generator-settings=
force-gamemode=false
allow-nether=true
gamemode=0
broadcast-console-to-ops=true
enable-query=false
player-idle-timeout=0
difficulty=3
spawn-monsters=true
op-permission-level=4
pvp=true
snooper-enabled=true
level-type=DEFAULT
hardcore=false
enable-command-block=false
max-players=69
network-compression-threshold=256
resource-pack-sha1=
max-world-size=29999984
server-port=25565
server-ip=0.0.0.0
spawn-npcs=true
allow-flight=true
level-name=world
view-distance=9
resource-pack=
spawn-animals=true
white-list=false
generate-structures=true
online-mode=false
max-build-height=256
level-seed=
prevent-proxy-connections=false
use-native-transport=true
motd=An RLCraft Server Running in Docker!
enable-rcon=true
rcon.password=badpasswordthatshouldbechanged!

View File

@ -1,124 +0,0 @@
# This is the main configuration file for Spigot.
# As you can see, there's tons to configure. Some options may impact gameplay, so use
# with caution, and make sure you know what each option does before configuring.
# For a reference for any variable inside this file, check out the Spigot wiki at
# http://www.spigotmc.org/wiki/spigot-configuration/
#
# If you need help with the configuration or have any questions related to Spigot,
# join us at the IRC or drop by our forums and leave a post.
#
# IRC: #spigot @ irc.spi.gt ( http://www.spigotmc.org/pages/irc/ )
# Forums: http://www.spigotmc.org/
config-version: 11
stats:
disable-saving: false
forced-stats: {}
commands:
tab-complete: 0
log: true
spam-exclusions:
- /skill
replace-commands:
- setblock
- summon
- testforblock
- tellraw
silent-commandblock-console: false
messages:
whitelist: You are not whitelisted on this server!
unknown-command: Unknown command. Type "/help" for help.
server-full: The server is full!
outdated-client: Outdated client! Please use {0}
outdated-server: Outdated server! I'm still on {0}
restart: Server is restarting
settings:
attribute:
maxHealth:
max: 2048.0
movementSpeed:
max: 2048.0
attackDamage:
max: 2048.0
timeout-time: 60
restart-on-crash: true
restart-script: ./start.sh
netty-threads: 4
bungeecord: true
late-bind: false
sample-count: 12
filter-creative-items: true
user-cache-size: 1000
int-cache-limit: 1024
moved-wrongly-threshold: 0.0625
moved-too-quickly-multiplier: 10.0
item-dirty-ticks: 20
save-user-cache-on-stop-only: false
player-shuffle: 0
advancements:
disable-saving: false
disabled:
- minecraft:story/disabled
world-settings:
default:
verbose: true
save-structure-info: true
mob-spawn-range: 4
growth:
cactus-modifier: 100
cane-modifier: 100
melon-modifier: 100
mushroom-modifier: 100
pumpkin-modifier: 100
sapling-modifier: 100
wheat-modifier: 100
netherwart-modifier: 100
vine-modifier: 100
cocoa-modifier: 100
entity-activation-range:
animals: 32
monsters: 32
misc: 16
water: 16
tick-inactive-villagers: true
ticks-per:
hopper-transfer: 8
hopper-check: 1
hopper-amount: 1
random-light-updates: false
dragon-death-sound-radius: 0
seed-village: 10387312
seed-feature: 14357617
seed-monument: 10387313
seed-slime: 987234911
hunger:
jump-walk-exhaustion: 0.05
jump-sprint-exhaustion: 0.2
combat-exhaustion: 0.1
regen-exhaustion: 6.0
swim-multiplier: 0.01
sprint-multiplier: 0.1
other-multiplier: 0.0
max-tnt-per-tick: 100
max-tick-time:
tile: 50
entity: 50
squid-spawn-range:
min: 45.0
merge-radius:
item: 2.5
exp: 3.0
hanging-tick-frequency: 100
nerf-spawner-mobs: false
zombie-aggressive-towards-villager: true
entity-tracking-range:
players: 48
animals: 48
monsters: 48
misc: 32
other: 64
item-despawn-rate: 6000
arrow-despawn-rate: 1200
enable-zombie-pigmen-portal-spawns: true
wither-spawn-sound-radius: 0
view-distance: 10

View File

@ -1,12 +0,0 @@
FROM debian:10
RUN apt update
RUN apt install -y curl
RUN curl -so /etc/apt/trusted.gpg.d/oxen.gpg https://deb.oxen.io/pub.gpg
RUN echo "deb https://deb.oxen.io buster main" | tee /etc/apt/sources.list.d/oxen.list
RUN apt update -y && apt upgrade -y
RUN apt install -y oxen-service-node
CMD [ "oxend", "--non-interactive" ]

View File

@ -1,17 +0,0 @@
FROM openjdk:17-slim
ENV MC_VERSION="latest" \
PAPER_BUILD="latest" \
MC_RAM="4G" \
JAVA_OPTS=""
ADD papermc.sh .
RUN apt-get update \
&& apt-get install -y wget \
&& apt-get install -y jq \
&& mkdir /papermc
CMD ["sh", "./papermc.sh"]
EXPOSE 25565
VOLUME /papermc

View File

@ -1,31 +0,0 @@
#!/bin/bash
cd papermc
urlPrefix=https://papermc.io/api/v2/projects/paper
if [ ${MC_VERSION} = latest ]; then
MC_VERSION=$(wget -qO - $urlPrefix | jq -r '.versions[-1]') # "-r" is needed because the output has quotes otherwise
fi
urlPrefix=${urlPrefix}/versions/${MC_VERSION}
if [ ${PAPER_BUILD} = latest ]; then
PAPER_BUILD=$(wget -qO - $urlPrefix | jq '.builds[-1]')
fi
JAR_NAME=papermc-${MC_VERSION}-${PAPER_BUILD}.jar
if [ ! -e ${JAR_NAME} ]; then
rm -f *.jar
wget ${urlPrefix}/builds/${PAPER_BUILD}/downloads/paper-${MC_VERSION}-${PAPER_BUILD}.jar -O ${JAR_NAME}
if [ ! -e eula.txt ]; then
java -jar ${JAR_NAME}
sed -i 's/false/true/g' eula.txt
fi
fi
#exec java -server -Xms${MC_RAM} -Xmx${MC_RAM} ${JAVA_OPTS} -jar ${JAR_NAME} nogui
exec java -Xms${MC_RAM} -Xmx${MC_RAM} -XX:+UseG1GC \
-XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 \
-XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC \
-XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 \
-XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 \
-XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 \
-XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 \
${JAVA_OPTS} -jar ${JAR_NAME} nogui

View File

@ -1,5 +0,0 @@
FROM kalilinux/kali-bleeding-edge:latest
RUN apt update && apt -y upgrade
RUN apt -y install metasploit-framework nmap msfpc

View File

@ -1,7 +0,0 @@
FROM siverten/magma:latest
ENV MC_RAM="2G"
COPY ./rlcraft ./
EXPOSE 25565
EXPOSE 25575
VOLUME [ "/magma/plugins", "/magma/config", "/magma/world", "/magma/logs" ]
CMD java -server -Xms${MC_RAM} -Xmx${MC_RAM} -Dfml.queryResult=confirm -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -Djline.terminal=jline.UnsupportedTerminal -jar Magma-*-server.jar nogui

View File

@ -1,5 +0,0 @@
FROM alpine:latest
RUN apk update && apk upgrade
RUN apk add tor
EXPOSE 9030 9050 9051 9090
CMD /usr/bin/tor

View File

@ -1,18 +0,0 @@
#FROM mono:slim
FROM frolvlad/alpine-mono:latest
ENV TSHOCK_VERSION=latest
#RUN apt -y update && apt -y upgrade &&\
# apt install -y wget unzip
RUN apk update && apk upgrade &&\
apk add curl
COPY ./start.sh /start
COPY ./install.sh /
RUN sh /install.sh
RUN rm /install.sh
VOLUME ["/world", "/config", "/logs", "/plugins"]
WORKDIR /tshock
EXPOSE 7777
ENTRYPOINT ["/start"]

View File

@ -1,15 +0,0 @@
#!/bin/bash
# tshock install script for docker container
get_latest() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
mkdir /world /config /logs /plugins /tshock
cd /tshock
[ "$TSHOCK_VERSION" == "latest" ] && TSHOCK_VERSION=`get_latest "Pryaxis/TShock"`
wget https://github.com/Pryaxis/TShock/releases/download/$TSHOCK_VERSION/TShock${TSHOCK_VERSION//v}_Terraria1.4.2.3.zip
unzip *.zip
rm *.zip
chmod +x /tshock/TerrariaServer.exe
chmod +x /start

View File

@ -1,5 +0,0 @@
#!/bin/sh
# tshock startup script
set -e
[ "$(ls -A /plugins)" ] && cp -f /plugins/* /tshock/ServerPlugins
exec mono --server --gc=sgen -O=all TerrariaServer.exe -configpath /config -worldpath /world -logpath /logs "$@"

View File

@ -1,35 +0,0 @@
ARG WATERFALL_VERSION=latest
ARG JAVA_VERSION=11
FROM alpine AS tools
RUN apk add --update-cache --no-cache \
curl \
jq
FROM tools AS waterfall
RUN if test -z "${WATERFALL_VERSION}" || test "${WATERFALL_VERSION}" == "latest" || test "${WATERFALL_VERSION}" == "master"; then \
echo "### Fetching latest version"; \
WATERFALL_VERSION=$(\
curl --silent --location https://papermc.io/api/v1/waterfall/ | \
jq --raw-output '.versions[0]' \
); \
fi && \
echo "### Using version <${WATERFALL_VERSION}>" && \
WATERFALL_VERSION_PATCH=$(\
curl --silent --location https://papermc.io/api/v1/waterfall/${WATERFALL_VERSION}/ | \
jq --raw-output '.builds.latest' \
) && \
echo "### Using patch <${WATERFALL_VERSION_PATCH}>" && \
curl --silent --location --fail --output /waterfall.jar https://papermc.io/api/v1/waterfall/${WATERFALL_VERSION}/${WATERFALL_VERSION_PATCH}/download
FROM openjdk:${JAVA_VERSION}-jre
RUN useradd --create-home --shell /bin/bash minecraft \
&& mkdir -p /opt/waterfall /waterfall \
&& chown -R minecraft /waterfall/
COPY --from=waterfall /waterfall.jar /opt/waterfall/
USER minecraft
WORKDIR /waterfall
VOLUME /waterfall
EXPOSE 25565
ENV JAVA_MEM=1G
CMD java -Xms${JAVA_MEM} -Xmx${JAVA_MEM} -jar /opt/waterfall/waterfall.jar

View File

@ -1,5 +0,0 @@
FROM alpine:latest
RUN apk add python3
COPY ./ /opt
WORKDIR /opt
CMD ./miner.py -m1

View File

@ -1 +0,0 @@
"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,

View File

@ -1 +0,0 @@
"cpu_threads_conf": [{"low_power_mode": 5, "affine_to_cpu": false}, {"low_power_mode": 5, "affine_to_cpu": false}],

View File

@ -1,112 +0,0 @@
#!/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:])

View File

@ -1 +0,0 @@
"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",

Binary file not shown.