Update to alpine linux base

Remove minecraft skeleton directory
Use docker for minecraft server, overviewer, and caddy http server
provision.sh script should work outside of vagrant
master
Andrew Coleman 2017-05-10 13:01:27 -04:00
parent 252ccba86d
commit f610c0415c
14 changed files with 72 additions and 131 deletions

32
Vagrantfile vendored
View File

@ -4,36 +4,14 @@ 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.vm.box = 'jpbriquet/alpine2docker'
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: 8088, guest: 8088
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'
config.vm.provider :virtualbox do |p|
p.memory = MEMSIZE
p.cpus = CPUS
end
config.vm.provision 'shell', run: 'once', inline: '/vagrant/provision.sh'

View File

@ -1 +0,0 @@
[]

View File

@ -1 +0,0 @@
[]

View File

@ -1,3 +0,0 @@
#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

View File

@ -1 +0,0 @@
[]

View File

@ -1,39 +0,0 @@
#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

View File

@ -1 +0,0 @@
[]

View File

@ -1 +0,0 @@
[]

27
overviewer/Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM ubuntu:trusty
MAINTAINER Andrew Coleman <penguincoder@gmail.com>
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y apt-transport-https apt-utils cron gettext-base lsb-release wget && \
echo "deb https://overviewer.org/debian ./" > /etc/apt/sources.list.d/overviewer.list && \
wget -q -O - https://overviewer.org/debian/overviewer.gpg.asc | apt-key add - && \
apt-get update && \
apt-get install -y minecraft-overviewer && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
useradd --create-home --uid 1000 --gid 100 notch
USER notch
ENV MINECRAFT_VERSION 1.11
RUN mkdir -p /home/notch/.minecraft/versions/${MINECRAFT_VERSION} && \
wget -q -P /home/notch/.minecraft/versions/${MINECRAFT_VERSION} https://s3.amazonaws.com/Minecraft.Download/versions/${MINECRAFT_VERSION}/${MINECRAFT_VERSION}.jar
VOLUME /map
VOLUME /data
ADD config.py /
USER root
RUN echo "15,30,45,60 * * * * notch overviewer.py --config=/config.py >> /var/log/overviewer.log 2>&1" >> /etc/crontab && \
touch /var/log/overviewer.log && \
chown notch:users /var/log/overviewer.log
CMD cron && tail -f /var/log/overviewer.log

View File

@ -1,8 +1,7 @@
outputdir = "/home/notch/mc-overviewer/render"
texturepath = "/home/notch/mc-overviewer/1.8.jar"
outputdir = "/map"
rendermode = "smooth_lighting"
world_name = "House Server"
worlds[world_name] = "/home/notch/minecraft/world"
worlds[world_name] = "/data/world"
renders["North"] = {
'world': world_name,
'title': 'North',

View File

@ -1,59 +1,43 @@
#!/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
MC_HOME=/home/alpine
# 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
docker run \
--restart always \
--detach \
--name minecraft \
--publish 25565:25565 \
--env EULA=true \
--env DIFFICULTY=normal \
--env OPS=penguincoder,cha0t1k \
--env ALLOW_NETHER=true \
--env ANNOUNCE_PLAYER_ACHIEVEMENTS=true \
--env GENERATE_STRUCTURES=true \
--env MEMORY=2G \
--volume ${MC_HOME}/minecraft:/data \
itzg/minecraft-server
# 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/
cd $(dirname $0)/overviewer && \
docker build -t overviewer . && \
docker run \
--rm \
--volume ${MC_HOME}/minecraft:/data \
--volume ${MC_HOME}/overviewer:/map \
overviewer \
su - notch -c "overviewer.py --config=/config.py" && \
docker run \
--detach \
--restart always \
--name overviewer \
--volume ${MC_HOME}/minecraft:/data \
--volume ${MC_HOME}/overviewer:/map \
overviewer
# 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
docker pull zzrot/alpine-caddy
docker run \
--detach \
--restart always \
--name caddy \
--publish 8088:80 \
--volume ${MC_HOME}/overviewer:/var/www/html \
zzrot/alpine-caddy