From 99bf16f4edb7f6a77995075c4b71fcd7d1df2f4b Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 1 May 2015 17:41:48 -0700 Subject: [PATCH] Remove broken minecraft server implementation --- games/minecraft/backup/Dockerfile | 6 - games/minecraft/backup/start.sh | 4 - games/minecraft/data-ambassador/Dockerfile | 6 - games/minecraft/data-ambassador/setup.sh | 7 - games/minecraft/data/Dockerfile | 12 -- games/minecraft/data/bukkit.yml | 37 ----- games/minecraft/data/server.properties | 33 ---- games/minecraft/data/start.sh | 2 - games/minecraft/minecraft.py | 182 --------------------- games/minecraft/scripts/addop.sh | 17 -- games/minecraft/scripts/backup.sh | 1 - games/minecraft/scripts/kill-server.sh | 10 -- games/minecraft/scripts/megaupload.py | 48 ------ games/minecraft/server/Dockerfile | 27 --- games/minecraft/server/start.sh | 4 - 15 files changed, 396 deletions(-) delete mode 100644 games/minecraft/backup/Dockerfile delete mode 100755 games/minecraft/backup/start.sh delete mode 100644 games/minecraft/data-ambassador/Dockerfile delete mode 100755 games/minecraft/data-ambassador/setup.sh delete mode 100644 games/minecraft/data/Dockerfile delete mode 100644 games/minecraft/data/bukkit.yml delete mode 100644 games/minecraft/data/server.properties delete mode 100644 games/minecraft/data/start.sh delete mode 100755 games/minecraft/minecraft.py delete mode 100755 games/minecraft/scripts/addop.sh delete mode 100755 games/minecraft/scripts/backup.sh delete mode 100755 games/minecraft/scripts/kill-server.sh delete mode 100644 games/minecraft/scripts/megaupload.py delete mode 100644 games/minecraft/server/Dockerfile delete mode 100644 games/minecraft/server/start.sh diff --git a/games/minecraft/backup/Dockerfile b/games/minecraft/backup/Dockerfile deleted file mode 100644 index 205660e..0000000 --- a/games/minecraft/backup/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM xena/alpine:edge - -ADD start.sh / - -CMD /start.sh - diff --git a/games/minecraft/backup/start.sh b/games/minecraft/backup/start.sh deleted file mode 100755 index 7eb69da..0000000 --- a/games/minecraft/backup/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -tar czf "/mnt/host/backup".tgz /minecraft/server/* - diff --git a/games/minecraft/data-ambassador/Dockerfile b/games/minecraft/data-ambassador/Dockerfile deleted file mode 100644 index 71274ff..0000000 --- a/games/minecraft/data-ambassador/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM xena/alpine:3.0 - -ADD setup.sh /setup.sh - -CMD /setup.sh - diff --git a/games/minecraft/data-ambassador/setup.sh b/games/minecraft/data-ambassador/setup.sh deleted file mode 100755 index 67379b1..0000000 --- a/games/minecraft/data-ambassador/setup.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -adduser minecraft -D - -chown -R minecraft /minecraft/server -chmod -R 777 /minecraft/server - diff --git a/games/minecraft/data/Dockerfile b/games/minecraft/data/Dockerfile deleted file mode 100644 index 69461b8..0000000 --- a/games/minecraft/data/Dockerfile +++ /dev/null @@ -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 diff --git a/games/minecraft/data/bukkit.yml b/games/minecraft/data/bukkit.yml deleted file mode 100644 index ced5c1a..0000000 --- a/games/minecraft/data/bukkit.yml +++ /dev/null @@ -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 - diff --git a/games/minecraft/data/server.properties b/games/minecraft/data/server.properties deleted file mode 100644 index 04ff5ea..0000000 --- a/games/minecraft/data/server.properties +++ /dev/null @@ -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 - diff --git a/games/minecraft/data/start.sh b/games/minecraft/data/start.sh deleted file mode 100644 index c315182..0000000 --- a/games/minecraft/data/start.sh +++ /dev/null @@ -1,2 +0,0 @@ -adduser -D minecraft -chown -R minecraft /minecraft/server diff --git a/games/minecraft/minecraft.py b/games/minecraft/minecraft.py deleted file mode 100755 index c546e35..0000000 --- a/games/minecraft/minecraft.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/python2 - -# Copyright (C) 2014 Christine Dodrill 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() - diff --git a/games/minecraft/scripts/addop.sh b/games/minecraft/scripts/addop.sh deleted file mode 100755 index 6ac11b3..0000000 --- a/games/minecraft/scripts/addop.sh +++ /dev/null @@ -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 - diff --git a/games/minecraft/scripts/backup.sh b/games/minecraft/scripts/backup.sh deleted file mode 100755 index 9feec18..0000000 --- a/games/minecraft/scripts/backup.sh +++ /dev/null @@ -1 +0,0 @@ -docker run --rm -v `pwd`:/mnt/host --volumes-from "$1"-mc-data xena/minecraft:backup diff --git a/games/minecraft/scripts/kill-server.sh b/games/minecraft/scripts/kill-server.sh deleted file mode 100755 index cc4f23f..0000000 --- a/games/minecraft/scripts/kill-server.sh +++ /dev/null @@ -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 - diff --git a/games/minecraft/scripts/megaupload.py b/games/minecraft/scripts/megaupload.py deleted file mode 100644 index 35e3c6e..0000000 --- a/games/minecraft/scripts/megaupload.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2014 Christine Dodrill 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) - diff --git a/games/minecraft/server/Dockerfile b/games/minecraft/server/Dockerfile deleted file mode 100644 index d824520..0000000 --- a/games/minecraft/server/Dockerfile +++ /dev/null @@ -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 - diff --git a/games/minecraft/server/start.sh b/games/minecraft/server/start.sh deleted file mode 100644 index 1c53e34..0000000 --- a/games/minecraft/server/start.sh +++ /dev/null @@ -1,4 +0,0 @@ -cd /minecraft/server - -java -jar /minecraft/server.jar -