Initial commit of vagrant + minecraft
commit
252ccba86d
|
@ -0,0 +1 @@
|
|||
.vagrant
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Andrew Coleman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -0,0 +1,30 @@
|
|||
# Vagrant + Minecraft Server
|
||||
|
||||
## Why?
|
||||
|
||||
There are simple servers for most Unix and Windows operating systems, sure, but do you want the hassle of installing Java and its constant need for updates? Do you want to manage starting the actual server itself? Probably not. I know I don't want to.
|
||||
|
||||
This is also helpful to give to your buddies so they can run their own local server, or it's very handy for a LAN party.
|
||||
|
||||
## How?
|
||||
|
||||
* Install [Vagrant](http://vagrantup.com)
|
||||
* Install [VirtualBox](https://www.virtualbox.org/) if you don't already have one.
|
||||
* Clone this repo
|
||||
* `vagrant up`
|
||||
|
||||
## What this provides
|
||||
|
||||
This repository gives you access to a fresh-built VM hosting the newest version of vanilla Minecraft. It runs the server out of memory and will periodically write new changes to disk. It supports log rotation and daily backups of the server. It also generates a Google Map of your world and keeps it up to date daily. There is nothing for you to do or configure. It Just Works(TM).
|
||||
|
||||
### From your machine
|
||||
|
||||
* Map: http://localhost:8088
|
||||
* Server: localhost:25565
|
||||
|
||||
### From other machines
|
||||
|
||||
* Map: http://your-ip-or-dns:8088
|
||||
* Server: your-ip-or-dns:25565
|
||||
|
||||
You will need to manage your local firewall settings accordingly. This process works much better if you have local DNS resolution from a fine product like [pfSense](http://pfsense.org) or [DD-WRT](http://www.dd-wrt.com/).
|
|
@ -0,0 +1,40 @@
|
|||
VAGRANTFILE_API_VERSION = '2'
|
||||
MEMSIZE = 4096
|
||||
CPUS = 4
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.define 'mc-house-server'
|
||||
config.vm.hostname = 'mc-house-server'
|
||||
config.vm.box = 'ubuntu/trusty64'
|
||||
config.ssh.forward_agent = true
|
||||
config.vm.network :private_network, type: 'dhcp'
|
||||
config.vm.network :forwarded_port, host: 8088, guest: 80
|
||||
config.vm.network :forwarded_port, host: 25565, guest: 25565
|
||||
|
||||
config.vm.provider :libvirt do |provider, override|
|
||||
override.vm.box = 'baremettle/ubuntu-14.04'
|
||||
provider.memory = MEMSIZE
|
||||
provider.cpus = CPUS
|
||||
end
|
||||
|
||||
%w(virtualbox parallels).each do |provider|
|
||||
config.vm.provider provider do |p|
|
||||
p.memory = MEMSIZE
|
||||
p.cpus = CPUS
|
||||
end
|
||||
end
|
||||
|
||||
%w(vmware_fusion vmware_workstation).each do |provider|
|
||||
config.vm.provider provider do |p, override|
|
||||
override.vm.box = 'phusion/ubuntu-14.04-amd64'
|
||||
p.vmx["memsize"] = MEMSIZE
|
||||
p.vmx["numvcpus"] = CPUS
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.provider :parallels do |parallels, override|
|
||||
override.vm.box = 'parallels/ubuntu-14.04'
|
||||
end
|
||||
|
||||
config.vm.provision 'shell', run: 'once', inline: '/vagrant/provision.sh'
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
02 05 * * * /etc/init.d/minecraft backup
|
||||
55 04 * * * /etc/init.d/minecraft log-roll
|
||||
*/30 * * * * /etc/init.d/minecraft to-disk
|
||||
31 05 * * * /etc/init.d/minecraft overviewer
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
VERSION=${1-1.8}
|
||||
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/${VERSION}/${VERSION}.jar -P /home/notch/mc-overviewer/
|
|
@ -0,0 +1,130 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Settings file for minecraft-init
|
||||
# ================================
|
||||
#
|
||||
# Make a copy of this file named config
|
||||
# and edit the variables to your needs.
|
||||
#
|
||||
|
||||
# Name of vanilla server jar (no need to change if you're running craftbukkit and vice versa)
|
||||
MC_JAR="minecraft_server.jar"
|
||||
|
||||
# Name of craftbukkit jar
|
||||
CB_JAR="craftbukkit.jar"
|
||||
|
||||
# Define the release of CraftBukkit to use (stable or unstable)
|
||||
CB_RELEASE="stable"
|
||||
|
||||
# Name of server.jar to use (either $MC_JAR or $CB_JAR)
|
||||
SERVICE=$MC_JAR
|
||||
|
||||
# Name to use for the screen instance
|
||||
SCREEN="server_screen"
|
||||
|
||||
# User that should run the server
|
||||
USERNAME="notch"
|
||||
|
||||
# Path to minecraft server directory
|
||||
MCPATH="/home/${USERNAME}/minecraft"
|
||||
|
||||
# Path to server log file ($MCPATH/server.log on older versions)
|
||||
SERVERLOG="${MCPATH}/logs/latest.log"
|
||||
|
||||
# Where the worlds are located on the disk. Can not be the same as MCPATH.
|
||||
# You need to move your worlds to this directory manually, the script
|
||||
# will then handle the nessessay symlinks.
|
||||
WORLDSTORAGE="${MCPATH}/worlds"
|
||||
|
||||
# Number of CPUs/cores to use
|
||||
CPU_COUNT=2
|
||||
|
||||
# Initial memory usage
|
||||
INITMEM="2048M"
|
||||
|
||||
# Maximum amount of memory to use
|
||||
# Remember: give the ramdisk enough space, subtract from the total amount
|
||||
# of RAM available the size of your map and the RAM-consumption of your base system.
|
||||
MAXMEM="2048M"
|
||||
|
||||
# Whether to output commands for the plugin ConsoleLikeChat ($1 is the command to run)
|
||||
FORMAT='$1'
|
||||
|
||||
# Settings for backups
|
||||
# ===============================
|
||||
|
||||
# Location for world backups
|
||||
BACKUPPATH="/home/${USERNAME}/mcbackup/worlds"
|
||||
|
||||
# Where the whole minecraft directory is copied when whole-backup is executed
|
||||
# whole-backup is a complete uncompressed backup of the whole server folder.
|
||||
WHOLEBACKUP="/home/${USERNAME}/mcbackup/server"
|
||||
|
||||
# Format for world backup (tar or zip).
|
||||
BACKUPFORMAT="tar"
|
||||
|
||||
# Normally backups will be put in a subfolder to $BACKUPPATH with todays date
|
||||
# and the backups themselves will have a timestamp.
|
||||
|
||||
# But if BACKUPSCRIPTCOMPATIBLE is set the world backups will be put directly
|
||||
# in $BACKUPPATH without timestamp to be compatible with
|
||||
# [backup rotation script](https://github.com/adamfeuer/rotate-backups)
|
||||
#
|
||||
BACKUPSCRIPTCOMPATIBLE=YES
|
||||
|
||||
# If WORLDEDITCOMPATIBLE is set the world backups will be created compatible to WorldEdit
|
||||
# in $BACKUPPATH as WORLD_NAME/DATE.(tar.bz2|zip) with the requested directory structure
|
||||
#
|
||||
# WORLDEDITCOMPATIBLE=YES
|
||||
|
||||
# Compress the whole backup with bzip2?
|
||||
# Note that this may not save a lot of disk space since there can be a lot of files
|
||||
# in your server directory, that are already compressed, but it can slow down the
|
||||
# backup a bit. This highly depends on the plugins you're using.
|
||||
#
|
||||
# For example: The png files generated by Dynmap are already compressed and still use
|
||||
# a lot of space in your server directory, so the compression ratio of the compressed
|
||||
# backup will not be very high.
|
||||
COMPRESS_WHOLEBACKUP=YES
|
||||
|
||||
|
||||
# Settings for log rolling
|
||||
# ===============================
|
||||
|
||||
# Location for old logs
|
||||
# Used by the log-roll command
|
||||
LOGPATH="/home/${USERNAME}/mcbackup/logs"
|
||||
|
||||
# Whether or not to gzip logs (must be commented out for no - DO NOT CHANGE TO NO)
|
||||
#
|
||||
GZIPLOGS=YES
|
||||
|
||||
# What to append to the logfile name (Leave blank for nothing)
|
||||
LOGFILEAPPEND="logfile_"
|
||||
|
||||
|
||||
# Settings for overviewer command
|
||||
# ===============================
|
||||
|
||||
# Where the Map is generated
|
||||
OUTPUTMAP="/home/${USERNAME}/mc-overviewer/render"
|
||||
|
||||
# Path to Minecraft-Overviewer
|
||||
OVPATH="/home/${USERNAME}/mc-overviewer/Minecraft-Overviewer"
|
||||
|
||||
# Path for the config file of Overviewer
|
||||
OVCONFIGPATH="/home/${USERNAME}/mc-overviewer"
|
||||
|
||||
# Name of Overviewer config file
|
||||
OVCONFIGNAME="config.py"
|
||||
|
||||
# Path for backup worlds
|
||||
OVBACKUP="/home/${USERNAME}/mc-overviewer/overviewerbackups"
|
||||
|
||||
# Things to leave alone ;)
|
||||
# =====================
|
||||
|
||||
INVOCATION="java -Xmx$MAXMEM -Xms$INITMEM -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $SERVICE nogui"
|
||||
|
||||
# Path to the the mounted ramdisk (the default will work in most senarios).
|
||||
RAMDISK="/dev/shm"
|
|
@ -0,0 +1,33 @@
|
|||
outputdir = "/home/notch/mc-overviewer/render"
|
||||
texturepath = "/home/notch/mc-overviewer/1.8.jar"
|
||||
rendermode = "smooth_lighting"
|
||||
world_name = "House Server"
|
||||
worlds[world_name] = "/home/notch/minecraft/world"
|
||||
renders["North"] = {
|
||||
'world': world_name,
|
||||
'title': 'North',
|
||||
'dimension': "overworld",
|
||||
'rendermode': rendermode,
|
||||
'northdirection': 'upper-left'
|
||||
}
|
||||
renders["East"] = {
|
||||
'world': world_name,
|
||||
'title': 'East',
|
||||
'dimension': "overworld",
|
||||
'rendermode': rendermode,
|
||||
'northdirection': 'upper-right'
|
||||
}
|
||||
renders["South"] = {
|
||||
'world': world_name,
|
||||
'title': 'South',
|
||||
'dimension': "overworld",
|
||||
'rendermode': rendermode,
|
||||
'northdirection': 'lower-right'
|
||||
}
|
||||
renders["West"] = {
|
||||
'world': world_name,
|
||||
'title': 'West',
|
||||
'dimension': "overworld",
|
||||
'rendermode': rendermode,
|
||||
'northdirection': 'lower-left'
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,3 @@
|
|||
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
|
||||
#Thu Mar 26 00:46:00 CDT 2015
|
||||
eula=true
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,39 @@
|
|||
#Minecraft server properties
|
||||
#Thu Mar 26 00:52:49 CDT 2015
|
||||
spawn-protection=16
|
||||
max-tick-time=60000
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
enable-query=false
|
||||
player-idle-timeout=0
|
||||
difficulty=1
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
resource-pack-hash=
|
||||
announce-player-achievements=true
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=DEFAULT
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=20
|
||||
network-compression-threshold=256
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=
|
||||
spawn-npcs=true
|
||||
allow-flight=false
|
||||
level-name=world
|
||||
view-distance=10
|
||||
resource-pack=
|
||||
spawn-animals=true
|
||||
white-list=false
|
||||
generate-structures=true
|
||||
online-mode=true
|
||||
max-build-height=256
|
||||
level-seed=
|
||||
use-native-transport=true
|
||||
enable-rcon=false
|
||||
motd=House Minecraft Server
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,13 @@
|
|||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
|
||||
root /home/notch/mc-overviewer/render;
|
||||
index index.html;
|
||||
|
||||
server_name mc-house-server;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
MINECRAFT_VERSION=1.8.3
|
||||
MINECRAFT_MAJOR=1.8
|
||||
|
||||
echo "Performing initial setup"
|
||||
groupadd -r notch && useradd -r -m -g notch notch
|
||||
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
apt-get install -y software-properties-common
|
||||
add-apt-repository ppa:webupd8team/java
|
||||
apt-get update
|
||||
echo 'oracle-java8-installer shared/accepted-oracle-license-v1-1 select true' | debconf-set-selections
|
||||
apt-get install -y vim build-essential python-imaging python-dev python-numpy git htop screen rsync oracle-java8-installer oracle-java8-set-default nginx-light
|
||||
|
||||
# minecraft server
|
||||
cd /home/notch
|
||||
cp -avr /vagrant/minecraft .
|
||||
echo "Downloading Minecraft official server..."
|
||||
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/${MINECRAFT_VERSION}/minecraft_server.${MINECRAFT_VERSION}.jar
|
||||
mv *.jar minecraft/
|
||||
cd minecraft
|
||||
ln -s $(ls minecraft_server.*.jar | head -n 1) minecraft_server.jar
|
||||
|
||||
# minecraft init
|
||||
cd /home/notch
|
||||
echo "Installing Minecraft init script"
|
||||
git clone https://github.com/Ahtenus/minecraft-init.git
|
||||
chmod 755 minecraft
|
||||
cp /vagrant/mc-init-config ./minecraft-init/config
|
||||
ln -s /home/notch/minecraft-init/minecraft /etc/init.d/
|
||||
|
||||
# minecraft overviewer
|
||||
echo "Installing Minecraft Overviewer"
|
||||
cd /home/notch
|
||||
mkdir mc-overviewer
|
||||
cd mc-overviewer
|
||||
git clone git://github.com/overviewer/Minecraft-Overviewer.git
|
||||
cp /vagrant/mc-overviewer-config.py ./config.py
|
||||
cd Minecraft-Overviewer
|
||||
python setup.py build
|
||||
|
||||
# minecraft overviewer texture pack
|
||||
cd /home/notch/mc-overviewer
|
||||
echo "Downloading Minecraft client for texture pack..."
|
||||
cp /vagrant/get-texture-pack.sh .
|
||||
./get-texture-pack.sh ${MINECRAFT_MAJOR}
|
||||
|
||||
echo "Starting Minecraft server..."
|
||||
chown -R notch:notch /home/notch
|
||||
update-rc.d minecraft defaults
|
||||
service minecraft start
|
||||
|
||||
echo "Installing crontab for automation"
|
||||
crontab -u notch /vagrant/crontab
|
||||
|
||||
echo "Configuring nginx to serve overviewer map"
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
cp /vagrant/nginx-minecraft-overviewer /etc/nginx/sites-available/
|
||||
ln -s /etc/nginx/sites-available/nginx-minecraft-overviewer /etc/nginx/sites-enabled/
|
||||
service nginx restart
|
Loading…
Reference in New Issue