Getting Started

Note

For all steps (Development,starting the Server and executing tests) the User must accept the Minecraft EULA, by own configured property!
by example setting a envierment property like export mc_accept_eula=true

For A Better Python Depenendency Mananagement it is recommended to configure a own Virtualenv.

Configure Python Virtual Env
 virtualenv -p python3 ~/venvs/ansible-vagrant
 source ~/venvs/ansible-vagrant/bin/activate
 pip install -r requirements.txt
 pre-commit install

Preconditions

For a full configuration you need some “Commons Scripts” from other Repositories, for example the nolte/ansible_playbook-baseline-online-server Project. The Dependencies will be managed by vendir and can be installed with the overlay command.

Install required Dependencies
 vendir sync

The Configuration file for the Dependencies is the vendir.yml.

---
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
  - path: provisioning/ext_debs
    contents:
      - path: ansible_playbook-baseline-online-server
        git:
          url: https://github.com/nolte/ansible_playbook-baseline-online-server.git
          ref: v1.0.4

Local Environment

For local Usage you can use the Vagrant file, located at the Maintenance Directory.

Start the Local Vagrant Machine
 cd local
 vagrant up

The Vagrant Box are configured with a minimal set of features, from the Test Inventory. After successfull starting you can join the server at localhost:25567

Note

The original gameport will mapped in the Vagrant file from 25565 to 25567.

Usefull Commands

  • vagrant ssh (SSH Connect to the Local Vagrant Box)

  • vagrant provision (Reexecute the Installation Steps)

  • vagrant global-status

  • vagrant ssh-config

Public Environment

The Public Env will be hosted at Hetzner Cloud. For Rollout the public environment, you must execute the Terraform and the Ansible sources.

Required Environment Variables
 export HCLOUD_TOKEN_STORAGE_PROJECT=$(pass internet/hetzner.com/projects/personal_storage/token) && \
   export HCLOUD_TOKEN=$(pass internet/hetzner.com/projects/minecraft/terraform-token) && \
   export AWS_ACCESS_KEY_ID=$(pass internet/project/mystoragebox/minio_access_key) && \
   export AWS_SECRET_ACCESS_KEY=$(pass internet/project/mystoragebox/minio_secret_key) && \
   export AWS_S3_ENDPOINT=https://$(curl -s -H "Authorization: Bearer $HCLOUD_TOKEN_STORAGE_PROJECT" 'https://api.hetzner.cloud/v1/servers?name=storagenode' | jq -r '.servers[0].public_net.ipv4.dns_ptr')

Infrastructure

For the Terraform State File, we use a Self Hosted Remote S3 Bucket, Personal Storage.

Long Term Elements

The Long Term Infrastructure Elements, are Ressources like SSH Key, or the Backup Volume. Keep this Part from the Infrastructure, for restore some backup costs ~1€/mon.

Warning

Be carefull with terraform destroy, you will be lost all your restic Backups!

The Ressources from provisioning/infrastructure/longterm will be handled in a seperated Terraform State File.

Computing Elements

The Computing Infrastructure Elements, are Ressources like Attatch Volume and Create the Server.

Note

Do terraform destroy, to save money (~5,83€/mon), or when the Server makes Problems! You can use the Last Backup from the Long Term Infrastructure Elements for restoring, look Restore on Create. So it makes fun to destroy the Ressources from provisioning/infrastructure/computing.

Configure the Server

For this we use the Ansible Playbooks from the Maintenance Directory and the dependencies from the Preconditions.

Install Ansible Galaxy Dependencies
ansible-galaxy install -r provisioning/ext_debs/ansible_playbook-baseline-online-server/requirements.yml && \
 ansible-galaxy install -r provisioning/maintenance/requirements.yml

When you use a external Inventory Folder, define the Environment Variable: export ANSIBLE_INVENTORY=$(pwd)/storagebox/prod/, now you can execute the Master Playbook:

Execute the full Installation
 ansible-playbook provisioning/maintenance/master-configure-system.yml

After the successfull configuration execute the “Testinfra Acception Tests”.