Install a Minecraft Server in a Raspberry Pi or any server with Ubuntu or as container in microk8s or any Kubernetes compatible cluster.
Ubuntu Server for Raspberry Pi 4 or Ubuntu Server Standard
Workstation with Ansible 2.9 installed
- Edit /var/snap/microk8s/current/args/containerd file and change --root and --state folders to /mnt/
$ sudo cat /var/snap/microk8s/current/args/containerd
--config ${SNAP_DATA}/args/containerd.toml
--root /mnt/var/lib/containerd
--state /mnt/run/containerd
--address ${SNAP_COMMON}/run/containerd.sock- K8s was complaining that the cgroup memory was not enabled.
Looking at /proc/cgroups was showing memeory disabled.
Edit /boot/firmware/nobtcmd.txt file, appending cgroup_enable=memory cgroup_memory=1. and rebooting.
ansible_user=pi // System user minecraft_user=pi // Minecraft Server user minecraft_server=spigot.jar // executable version for running server max_player=5 // simultaneous players in Server distance=04 // Draw distance of the server memory=364 // RAM for run the server
Better if you add to $HOME/.ssh/config the following entry:
Host 192.168.1.132
PreferredAuthentications publickey
IdentityFile ~/.ssh/raspi
user ubuntu$ cd minecraft/files
$ docker build -t juanviz/rpi-minecraft-spigot .
$ docker images
$ juanviz/rpi-minecraft-alpine-spigot latest bd3ef31059fe 23 minutes ago 232MB
$ docker tag bd3ef31059fe juanviz/rpi-minecraft-alpine-spigot
$ docker push juanviz/rpi-minecraft-alpine-spigotIncluding an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: '{{host}}'
roles:
- /Users/jvherrera/repositories/minecraft_ansible/minecraft
ansible-playbook -i inventory.yml -u ubuntu minecraft.yml --extra-vars "host=pi mode=pi boot=yes"
ansible-playbook -i inventory.yml -u ubuntu minecraft.yml --extra-vars "host=ec2 mode=pi boot=yes"
ansible-playbook -i inventory.yml -u ubuntu minecraft.yml --extra-vars "host=pi mode=k8s"minecraft.net ansible.com Raspberry Pi https://www.spigotmc.org/wiki/spigot-installation/#linux http://minecraft.gamepedia.com/Pi_Edition https://www.raspberrypi.org/learning/getting-started-with-minecraft-pi/worksheet/ https://pimylifeup.com/raspberry-pi-minecraft-server/ https://hub.docker.com/r/ulsmith/rpi-minecraft-alpine-spigot EC2 https://qwiklabs.com/focuses/2628?locale=en
BSD
@jvicenteherrera juanvicenteherrera.es