96 lines
2.7 KiB
Python
96 lines
2.7 KiB
Python
from bundlewrap.metadata import atomic
|
|
|
|
defaults = {
|
|
'apt': {
|
|
'packages': {
|
|
'openjdk-17-jre': {},
|
|
},
|
|
},
|
|
'backups': {
|
|
'paths': {
|
|
'/home/minecraft',
|
|
},
|
|
},
|
|
'minecraft': {
|
|
'java_opts': {
|
|
# https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
|
|
'-Daikars.new.flags': 'true',
|
|
'-Dusing.aikars.flags': 'https://mcflags.emc.gs',
|
|
'-XX:+AlwaysPreTouch': None,
|
|
'-XX:+DisableExplicitGC': None,
|
|
'-XX:+ParallelRefProcEnabled': None,
|
|
'-XX:+PerfDisableSharedMem': None,
|
|
'-XX:+UnlockExperimentalVMOptions': None,
|
|
'-XX:G1HeapRegionSize': '16M',
|
|
'-XX:G1HeapWastePercent': 5,
|
|
'-XX:G1MaxNewSizePercent': 50,
|
|
'-XX:G1MixedGCCountTarget': 4,
|
|
'-XX:G1MixedGCLiveThresholdPercent': 90,
|
|
'-XX:G1NewSizePercent': 40,
|
|
'-XX:G1RSetUpdatingPauseTimePercent': 5,
|
|
'-XX:G1ReservePercent': 15,
|
|
'-XX:InitiatingHeapOccupancyPercent': 20,
|
|
'-XX:MaxGCPauseMillis': 200,
|
|
'-XX:MaxTenuringThreshold': 1,
|
|
'-XX:SurvivorRatio': 32,
|
|
},
|
|
},
|
|
'users': {
|
|
'minecraft': {},
|
|
},
|
|
'zfs': {
|
|
'datasets': {
|
|
'tank/minecraft': {},
|
|
'tank/minecraft/overworld': {
|
|
'mountpoint': '/home/minecraft/world',
|
|
'compression': 'on',
|
|
'needed_by': {
|
|
'directory:/home/minecraft/world',
|
|
},
|
|
},
|
|
'tank/minecraft/nether': {
|
|
'mountpoint': '/home/minecraft/world_nether',
|
|
'compression': 'on',
|
|
'needed_by': {
|
|
'directory:/home/minecraft/world_nether',
|
|
},
|
|
},
|
|
'tank/minecraft/end': {
|
|
'mountpoint': '/home/minecraft/world_the_end',
|
|
'compression': 'on',
|
|
'needed_by': {
|
|
'directory:/home/minecraft/world_the_end',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
'minecraft/java_opts',
|
|
)
|
|
def heap_to_java_opts(metadata):
|
|
heap_mb = metadata.get('minecraft/heap_mb')
|
|
|
|
return {
|
|
'minecraft': {
|
|
'java_opts': {
|
|
f'-Xms{heap_mb}M': None,
|
|
f'-Xmx{heap_mb}M': None,
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
'firewall/port_rules/25565',
|
|
)
|
|
def firewall(metadata):
|
|
return {
|
|
'firewall': {
|
|
'port_rules': {
|
|
'25565': atomic(metadata.get('minecraft/restrict-to', set())),
|
|
},
|
|
},
|
|
}
|