minecraft

This commit is contained in:
mwiegand 2021-09-13 10:38:02 +02:00
parent 5dcf412a97
commit 25ba946216
4 changed files with 90 additions and 4 deletions

16
bundles/java/metadata.py Normal file
View file

@ -0,0 +1,16 @@
assert node.os == 'debian'
if node.os_version == (10,):
version = 11
elif node.os_version == (11,):
version = 17
else:
raise Exception('java bundle doesnt support this os and version')
defaults = {
'apt': {
'packages': {
f'openjdk-{version}-jre': {},
}
}
}

View file

@ -0,0 +1,31 @@
users = {
'minecraft': {},
}
directories = {
'/opt/minecraft': {
'owner': 'minecraft',
},
}
downloads = {
'/opt/minecraft/server.jar': {
'url': node.metadata.get('minecraft/download'),
'sha256': node.metadata.get('minecraft/sha256'),
}
}
files = {
'/opt/minecraft/eula.txt': {
'content': 'eula=true',
}
}
svc_systemd = {
'minecraft': {
'needs': {
'file:/opt/minecraft/eula.txt',
'download:/opt/minecraft/server.jar',
},
},
}

View file

@ -0,0 +1,20 @@
assert node.has_bundle('java')
defaults = {
'systemd': {
'units': {
'minecraft.service': {
'Unit': {
'Description': 'minecraft',
'After': 'network.target',
},
'Service': {
'User': 'minecraft',
'WorkingDirectory': '/opt/minecraft',
'ExecStart': '/usr/bin/java -Xms1024M -Xmx2560M -jar /opt/minecraft/server.jar nogui',
'Restart': 'always',
},
},
},
},
}

View file

@ -1,14 +1,33 @@
{
'dummy': True,
'hostname': '159.69.93.165',
'groups': [
'backup',
'debian-10',
'debian-11',
],
'bundles': [
'steam',
'l4d2',
# 'steam',
# 'l4d2',
'java',
'minecraft',
],
'metadata': {
'id': '353bb086-f3ce-4f36-8533-e91786c91ed9',
'network': {
'internal': {
'interface': 'ens10',
'ipv4': '10.0.10.3/24',
},
'external': {
'interface': 'eth0',
'ipv4': '159.69.93.165/32',
'ipv6': '2a01:4f8:c2c:867::2/64',
'gateway4': '172.31.1.1',
'gateway6': 'fe80::1',
}
},
'minecraft': {
'download': 'https://launcher.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar',
'sha256': 'e8c211b41317a9f5a780c98a89592ecb72eb39a6e475d4ac9657e5bc9ffaf55f',
},
},
}