Remove broken minecraft server implementation

This commit is contained in:
Christine Dodrill 2015-05-01 17:41:48 -07:00
parent 764fb6543f
commit 99bf16f4ed
15 changed files with 0 additions and 396 deletions

View File

@ -1,6 +0,0 @@
FROM xena/alpine:edge
ADD start.sh /
CMD /start.sh

View File

@ -1,4 +0,0 @@
#!/bin/sh
tar czf "/mnt/host/backup".tgz /minecraft/server/*

View File

@ -1,6 +0,0 @@
FROM xena/alpine:3.0
ADD setup.sh /setup.sh
CMD /setup.sh

View File

@ -1,7 +0,0 @@
#!/bin/sh
adduser minecraft -D
chown -R minecraft /minecraft/server
chmod -R 777 /minecraft/server

View File

@ -1,12 +0,0 @@
FROM busybox
VOLUME /minecraft/server
ADD bukkit.yml /minecraft/server/
ADD server.properties /minecraft/server/
ADD start.sh /minecraft/
RUN chmod 777 /minecraft/start.sh
RUN chmod 777 /minecraft/server
CMD /minecraft/start.sh

View File

@ -1,37 +0,0 @@
settings:
allow-end: true
warn-on-overload: true
permissions-file: permissions.yml
update-folder: update
ping-packet-limit: 100
use-exact-login-location: false
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
auto-updater:
enabled: false
preferred-channel: beta
host: dl.bukkit.org
suggest-channels: true
aliases: now-in-commands.yml
database:
username: bukkit
isolation: SERIALIZABLE
driver: org.sqlite.JDBC
password: walrus
url: jdbc:sqlite:{DIR}{NAME}.db

View File

@ -1,33 +0,0 @@
generator-settings=
op-permission-level=4
allow-nether=true
level-name=world
enable-query=false
allow-flight=false
announce-player-achievements=true
server-port=25565
level-type=DEFAULT
enable-rcon=false
force-gamemode=false
level-seed=
server-ip=
max-build-height=256
spawn-npcs=true
white-list=false
spawn-animals=true
snooper-enabled=true
hardcore=false
online-mode=true
resource-pack=
pvp=true
difficulty=1
enable-command-block=false
player-idle-timeout=0
gamemode=0
max-players=10
spawn-monsters=true
view-distance=10
generate-structures=true
spawn-protection=16
motd=A Minecraft Server

View File

@ -1,2 +0,0 @@
adduser -D minecraft
chown -R minecraft /minecraft/server

View File

@ -1,182 +0,0 @@
#!/usr/bin/python2
# Copyright (C) 2014 Christine Dodrill <xena@yolo-swag.com> All rights reserved.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
#
import baker
import docker
import json
import os
import subprocess
import time
client = docker.Client()
@baker.command
def build():
"""
Builds the docker images
"""
client.build(path="server", tag="xena/minecraft:server")
client.build(path="data", tag="xena/minecraft:data")
client.build(path="data-ambassador", tag="xena/minecraft:data-amb")
client.build(path="backup", tag="xena/minecraft:backup")
@baker.command
def establish(prefix):
"""
Establish a server name and setup its data container.
The prefix prefixes the server container names.
"""
spawn_data(prefix)
spawn(prefix)
@baker.command
def spawn(prefix):
"""
Respawn a server with prefix name
"""
server_id = client.create_container("xena/minecraft:server", name="%s-mc-server" % prefix,
ports=["25565"], stdin_open=True, tty=True)
client.start(server_id, publish_all_ports=True, volumes_from="%s-mc-data" % prefix)
print "Server %s started" % prefix
portinfo(prefix)
@baker.command
def spawn_data(prefix):
"""
Spawns the data container for a minecraft server
"""
data_id = client.create_container("xena/minecraft:data", name="%s-mc-data" % prefix,
detach=True)
client.start(data_id)
amb_id = client.create_container("xena/minecraft:data-amb", detach=False)
client.start(amb_id, volumes_from="%s-mc-data" % prefix)
client.wait(amb_id)
client.remove_container(amb_id)
print "Data for %s started and permissions set" % prefix
@baker.command
def addop(prefix, opname):
"""
Arbitrarily add a server operator
"""
subprocess.call(["bash", "scripts/addop.sh", opname, prefix])
print "Op %s on %s added." % (opname, prefix)
@baker.command
def portinfo(prefix):
"""
Gets the local and nonpersistent ip/port numbers for a server at prefix
"""
server_id = "%s-mc-server" % prefix
ip = None
port = None
container = client.inspect_container(server_id)
ip = container["NetworkSettings"]["IPAddress"]
port = container["NetworkSettings"]["Ports"]["25565/tcp"][0]["HostPort"]
print "IP: %s" % ip
print "Port: %s" % port
@baker.command
def logs(prefix):
"""
Get logs for a prefix
"""
subprocess.call(["docker", "logs", "%s-mc-server" % prefix])
@baker.command
def kill(prefix, purge=False):
"""
Kills a minecraft server, optionally purging it
"""
server_id = "%s-mc-server" % prefix
subprocess.call(["bash", "scripts/kill-server.sh", prefix])
client.stop(server_id)
client.remove_container(server_id)
print "stopped %s" % server_id
if purge:
data_id = "%s-mc-data" % prefix
client.stop(data_id)
client.remove_container(data_id)
print "Data for %s removed" % prefix
@baker.command
def backup(prefix, mega=False):
"""
Backup a minecraft server.
"""
subprocess.call(["bash", "scripts/backup.sh", prefix])
name = "%s-%s.tgz" % (prefix, time.time())
os.rename("backup.tgz", name)
print "Backup for %s written to %s." % (prefix, name)
if mega:
from mega import Mega
config = {}
with open(os.getenv("HOME") + "/.config/mineupload/conf.json", "r") as fin:
config = json.loads(fin.read())
username, password = config["u"], config["p"]
print "Logging into mega..."
mega = Mega({"verbose": True})
m = mega.login(username, password)
print "Uploading %s to mega..." % name
fpointer = m.upload(name)
print "URL: %s" % m.get_upload_link(fpointer)
print "Local copy removed"
os.remove(name)
baker.run()

View File

@ -1,17 +0,0 @@
OP="$1"
PREFIX="$2"
if [ "$OP" = "" ]
then
exit -1
fi
if [ "$PREFIX" = "" ]
then
exit -1
fi
echo "Trying to op $OP on $PREFIX"
echo "op $OP" | docker attach "$PREFIX"-mc-server

View File

@ -1 +0,0 @@
docker run --rm -v `pwd`:/mnt/host --volumes-from "$1"-mc-data xena/minecraft:backup

View File

@ -1,10 +0,0 @@
PREFIX="$1"
if [ "$PREFIX" = "" ]
then
exit -1
fi
echo "save-all" | docker attach $PREFIX-mc-server
echo "stop" | docker attach $PREFIX-mc-server

View File

@ -1,48 +0,0 @@
# Copyright (C) 2014 Christine Dodrill <xena@yolo-swag.com> All rights reserved.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source
# distribution.
#
from mega import Mega
import json
import os
import sys
mega = Mega()
if len(sys.argv) > 2:
print "Need file to upload"
sys.exit(-1)
fname = sys.argv[1]
config = {}
with open(os.getenv("HOME") + "/.config/mineupload/conf.json", "r") as fin:
config = json.loads(fin.read())
username, password = config["u"], config["p"]
m = mega.login(username, password)
fpointer = m.upload(fname)
print m.get_upload_link(fpointer)

View File

@ -1,27 +0,0 @@
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install openjdk-7-jre-headless
RUN apt-get -y install wget
RUN mkdir -p /minecraft/server
RUN adduser minecraft --home /minecraft/user --disabled-password --gecos "Minecraft daemon"
RUN chmod 777 /minecraft/server
RUN chown minecraft /minecraft/server
RUN wget -O /minecraft/server.jar http://dl.bukkit.org/latest-beta/craftbukkit-beta.jar
EXPOSE 25565
ADD start.sh /minecraft/start.sh
RUN chmod 777 /minecraft/start.sh
USER minecraft
CMD /minecraft/start.sh

View File

@ -1,4 +0,0 @@
cd /minecraft/server
java -jar /minecraft/server.jar