Skip to content
Permalink
Browse files

initial_commit

  • Loading branch information
FirzenYogesh committed May 14, 2019
0 parents commit 6a39d7477711782cb7edcdce4256fe8b7de02da0
Showing with 173 additions and 0 deletions.
  1. +31 −0 Dockerfile
  2. +1 −0 permissions.json.template
  3. +68 −0 server.properties.template
  4. +72 −0 startup.sh
  5. +1 −0 whitelist.json.template
@@ -0,0 +1,31 @@
FROM ubuntu:latest

# setup envs
ENV WORLD='DefaultWorld'
ENV PORT=19132
ENV PORTv6=19133
ENV MINECRAFT_COMMON_PATH='/srv/minecraft'
ARG INSTALL_URL='https://minecraft.azureedge.net/bin-linux/bedrock-server-1.11.2.1.zip'
ENV SERVER_PATH='/srv/bedrock-server'
ENV SERVER_ESSENTIALS='/srv/essentials'

EXPOSE ${PORT}
EXPOSE ${PORTv6}

VOLUME ${MINECRAFT_COMMON_PATH}

# install minecraft server
RUN apt-get update
RUN apt-get install -y unzip curl libcurl4 libssl1.0.0
RUN curl ${INSTALL_URL} --output ${SERVER_PATH}.zip
RUN unzip ${SERVER_PATH}.zip -d ${SERVER_PATH}
RUN rm ${SERVER_PATH}.zip

# server essentials
COPY server.properties.template ${SERVER_ESSENTIALS}/_templates/server.properties.template
COPY permissions.json.template ${SERVER_ESSENTIALS}/_templates/permissions.json.template
COPY whitelist.json.template ${SERVER_ESSENTIALS}/_templates/whitelist.json.template

COPY startup.sh /srv/essentials/startup.sh
RUN chmod a+x /srv/essentials/startup.sh
ENTRYPOINT [ "/srv/essentials/startup.sh" ]
@@ -0,0 +1 @@
[]
@@ -0,0 +1,68 @@
server-name=Dedicated Server
# Used as the server name
# Allowed values: Any string

gamemode=survival
# Sets the game mode for new players.
# Allowed values: "survival", "creative", or "adventure"

difficulty=normal
# Sets the difficulty of the world.
# Allowed values: "peaceful", "easy", "normal", or "hard"

allow-cheats=false
# If true then cheats like commands can be used.
# Allowed values: "true" or "false"

max-players=10
# The maximum number of players that can play on the server.
# Allowed values: Any positive integer

online-mode=true
# If true then all connected players must be authenticated to Xbox Live.
# Clients connecting to remote (non-LAN) servers will always require Xbox Live authentication regardless of this setting.
# If the server accepts connections from the Internet, then it's highly recommended to enable online-mode.
# Allowed values: "true" or "false"

white-list=false
# If true then all connected players must be listed in the separate whitelist.json file.
# Allowed values: "true" or "false"

server-port=19132
# Which IPv4 port the server should listen to.
# Allowed values: Integers in the range [1, 65535]

server-portv6=19133
# Which IPv6 port the server should listen to.
# Allowed values: Integers in the range [1, 65535]

view-distance=10
# The maximum allowed view distance in number of chunks.
# Allowed values: Any positive integer.

tick-distance=4
# The world will be ticked this many chunks away from any player.
# Allowed values: Integers in the range [4, 12]

player-idle-timeout=60
# After a player has idled for this many minutes they will be kicked. If set to 0 then players can idle indefinitely.
# Allowed values: Any non-negative integer.

max-threads=8
# Maximum number of threads the server will try to use. If set to 0 or removed then it will use as many as possible.
# Allowed values: Any positive integer.

level-name=world
# Allowed values: Any string

level-seed=
# Use to randomize the world
# Allowed values: Any string

default-player-permission-level=member
# Permission level for new players joining for the first time.
# Allowed values: "visitor", "member", "operator"

texturepack-required=true
# Force clients to use texture packs in the current world
# Allowed values: "true" or "false"
@@ -0,0 +1,72 @@
#! /bin/bash

# prepare all the common files and folders

# if the directories do not exist, create it
mkdir -p -- "${MINECRAFT_COMMON_PATH}/worlds"
mkdir -p -- "${MINECRAFT_COMMON_PATH}/premium_cache"
mkdir -p -- "${MINECRAFT_COMMON_PATH}/world_templates"

# copy the existing packs to the common path
cp -r "${SERVER_PATH}/resource_packs" "${MINECRAFT_COMMON_PATH}/"
cp -r "${SERVER_PATH}/behavior_packs" "${MINECRAFT_COMMON_PATH}/"

# if the files do not exist, create it
if ! [ -f "${MINECRAFT_COMMON_PATH}/invalid_known_packs.json" ]; then
echo "[]" > "${MINECRAFT_COMMON_PATH}/invalid_known_packs.json"
fi

if ! [ -f "${MINECRAFT_COMMON_PATH}/valid_known_packs.json" ]; then
echo "[]" > "${MINECRAFT_COMMON_PATH}/valid_known_packs.json"
fi

# if custom properties folder does not exist, create it
mkdir -p -- "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}"

# use the templates if custom properties are not there
if ! [ -f "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/server.properties" ]; then
cp "${SERVER_ESSENTIALS}/_templates/server.properties.template" "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/server.properties"
fi

if ! [ -f "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/permissions.json" ]; then
cp "${SERVER_ESSENTIALS}/_templates/permissions.json.template" "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/permissions.json"
fi

if ! [ -f "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/whitelist.json" ]; then
cp "${SERVER_ESSENTIALS}/_templates/whitelist.json.template" "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/whitelist.json"
fi

# replace the template if necessary
sed -i -e "s/=world/=$WORLD/g" "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/server.properties"
sed -i -e "s/=19132/=$PORT/g" "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/server.properties"
sed -i -e "s/=19133/=$PORTv6/g" "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/server.properties"

# remove the existing files and folders
rm -rf "${SERVER_PATH}/worlds"
rm -rf "${SERVER_PATH}/resource_packs"
rm -rf "${SERVER_PATH}/behavior_packs"
rm -rf "${SERVER_PATH}/premium_cache"
rm -rf "${SERVER_PATH}/world_templates"
rm -f "${SERVER_PATH}/server.properties"
rm -f "${SERVER_PATH}/permissions.json"
rm -f "${SERVER_PATH}/whitelist.json"
rm -f "${SERVER_PATH}/valid_known_packs.json"
rm -f "${SERVER_PATH}/invalid_known_packs.json"

# create soft links to the common files and folders
ln -s "${MINECRAFT_COMMON_PATH}/worlds" "${SERVER_PATH}/worlds"
ln -s "${MINECRAFT_COMMON_PATH}/resource_packs" "${SERVER_PATH}/resource_packs"
ln -s "${MINECRAFT_COMMON_PATH}/behavior_packs" "${SERVER_PATH}/behavior_packs"
ln -s "${MINECRAFT_COMMON_PATH}/premium_cache" "${SERVER_PATH}/premium_cache"
ln -s "${MINECRAFT_COMMON_PATH}/world_templates" "${SERVER_PATH}/world_templates"
ln -s "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/server.properties" "${SERVER_PATH}/server.properties"
ln -s "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/permissions.json" "${SERVER_PATH}/permissions.json"
ln -s "${MINECRAFT_COMMON_PATH}/properties_for_the_worlds/${WORLD}/whitelist.json" "${SERVER_PATH}/whitelist.json"
ln -s "${MINECRAFT_COMMON_PATH}/valid_known_packs.json" "${SERVER_PATH}/valid_known_packs.json"
ln -s "${MINECRAFT_COMMON_PATH}/invalid_known_packs.json" "${SERVER_PATH}/invalid_known_packs.json"

echo "Starting server: ${WORLD} on ${HOSTNAME}:${PORT} ..."

cd ${SERVER_PATH}

LD_LIBRARY_PATH=. ./bedrock_server
@@ -0,0 +1 @@
[]

0 comments on commit 6a39d74

Please sign in to comment.
You can’t perform that action at this time.