Created
August 27, 2013 12:10
-
-
Save spikegrobstein/6352715 to your computer and use it in GitHub Desktop.
Getting mcwrapper working with Docker (docker.io)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example configuration for mcwrapper: mcwrapper.conf | |
# this file can live in any of the following places (in order of priority): | |
# - the value of MCWRAPPER_CONFIG_PATH env variable | |
# - the current working directory as "mcwrapper.conf" | |
# - ~/.mcwrapper.conf | |
# - /etc/mcwrapper.conf | |
# | |
# Configuration is actual Bash. You can use conditionals... not that you would. | |
. "/root/minecraft/minecraft-docker" | |
## All non-absolute paths are relative to mcwrapper. | |
# MINECRAFT_SERVER_PATH -- path to the minecraft_server.jar | |
# default: either minecraft_server.jar in same directory or one level up. | |
MINECRAFT_SERVER_PATH="/home/minecraft/minecraft_server.jar" | |
# JAVA_BIN -- the java binary. | |
# default: 'java' binary in your path. | |
# change this if you'd like to use a different java binary. | |
JAVA_BIN='java' | |
# Java VM settings (increasing these never hurts) | |
# these are suggested settings from minecraft.net | |
MX_SIZE="512M" | |
MS_SIZE="512M" | |
# PID_FILE -- where mcwrapper stores the Minecraft server pid. | |
# default: mcwrapper.pid | |
PID_FILE="mcwrapper.pid" | |
# COMMAND_PIPE -- the mcwrapper FIFO | |
# default: command_input | |
COMMAND_PIPE="${WORKING_DIR}/command_input" | |
# Backup configuration: | |
# directory to store backups | |
# can be relative or absolute. if relative, it's relative to mcwrapper | |
# default: 'backups' | |
#BACKUP_DIRECTORY_PATH="backups" | |
# how many backups to keep in the backups directory | |
# (we automatically delete old backups) | |
# set to -1 to retain ALL backups (never delete) | |
# set to 0 to completely disable backups. | |
#BACKUPS_TO_KEEP=5 | |
# set backup name to | |
# +%Y%m%d -- just the datestamp; no time. | |
# +%Y%m%d%H%M%S -- full timestamp including hour, minute, second | |
#CURRENT_BACKUP_NAME=`date +%Y%m%d%H%M%S` | |
# How to compress the backup | |
# leave undefined (commented out) to not use compression | |
# accepted values are: tgz, zip | |
#COMPRESS_BACKUP='tgz' | |
# Whether to automatically backup when exiting. | |
# this is only called when you run `mcwrapper stop` | |
# uncomment to backup when exiting. | |
# default: "" | |
#BACKUP_ON_EXIT=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash - | |
ALLOW_ROOT=1 | |
WORKING_DIR=/root/minecraft | |
CONTAINER_ID_FILE="${WORKING_DIR}/mcwrapper.cid" | |
#DOCKER_IMAGE=spikegrobstein/minecraft_server | |
DOCKER_IMAGE=84ad891324ac | |
function start_minecraft_in_background { | |
read_command | docker run -i -cidfile "$CONTAINER_ID_FILE" -v "$WORKING_DIR":/home/minecraft/mcwrapper $DOCKER_IMAGE $MINECRAFT_SERVER_CMD &> /dev/null & | |
} | |
function check_is_running { | |
if [[ ! -e "$CONTAINER_ID_FILE" ]]; then | |
return 1 | |
fi | |
local CONTAINER_ID=$(cat "$CONTAINER_ID_FILE") | |
# see if the container is actually running | |
docker inspect $CONTAINER_ID | grep Running | grep true &> /dev/null | |
} | |
function sanity_check { | |
# do nothing! | |
return | |
} | |
function create_pid { | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment