2020-08-10 01:37:13 +02:00
|
|
|
{{ ansible_managed | comment }}
|
|
|
|
|
|
|
|
# Infrastructure
|
|
|
|
# Ansible instructions to deploy the infrastructure
|
|
|
|
# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern
|
|
|
|
# Copyright (C) 2020 Saibotk
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
version: '2.1'
|
|
|
|
|
|
|
|
services:
|
|
|
|
minecraft:
|
2021-11-30 21:00:22 +01:00
|
|
|
image: docker.io/itzg/minecraft-server:{{ minecraft_image_tag }}
|
2020-08-10 01:37:13 +02:00
|
|
|
ports:
|
|
|
|
- "{{ minecraft_server_port }}:25565"
|
2021-11-30 21:01:05 +01:00
|
|
|
{% for item in minecraft_additional_ports %}
|
|
|
|
- "{{ item }}"
|
|
|
|
{% endfor %}
|
2020-08-10 01:37:13 +02:00
|
|
|
volumes:
|
|
|
|
- "{{ minecraft_data_location }}:/data"
|
|
|
|
environment:
|
|
|
|
EULA: "TRUE"
|
|
|
|
ENABLE_RCON: "true"
|
|
|
|
RCON_PASSWORD: "{{ minecraft_rcon_password }}"
|
|
|
|
RCON_PORT: 28016
|
|
|
|
# enable env variable replacement
|
|
|
|
REPLACE_ENV_VARIABLES: "TRUE"
|
|
|
|
# define an optional prefix for your env variables you want to replace
|
|
|
|
ENV_VARIABLE_PREFIX: "CFG_"
|
|
|
|
|
|
|
|
{% for key, value in minecraft_config.items() %}
|
|
|
|
{{ key | upper }}: "{{ value }}"
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
networks:
|
|
|
|
minecraft-backend:
|
|
|
|
|
|
|
|
restart: always
|
|
|
|
|
|
|
|
{% if minecraft_enable_rcon_web %}
|
|
|
|
rcon:
|
|
|
|
image: docker.io/itzg/rcon
|
|
|
|
labels:
|
|
|
|
- "traefik.enable=true"
|
|
|
|
|
|
|
|
- "traefik.http.routers.minecraft-websocket.rule=Host(`{{ minecraft_rcon_domain }}`) && PathPrefix(`/rcon-websocket`)"
|
|
|
|
- "traefik.http.routers.minecraft-websocket.entrypoints=websecure"
|
|
|
|
- "traefik.http.routers.minecraft-websocket.tls.certresolver={{ minecraft_rcon_certresolver }}"
|
|
|
|
- "traefik.http.routers.minecraft-websocket.middlewares=minecraft,compress,minecraft-websocket-stripprefix"
|
|
|
|
- "traefik.http.routers.minecraft-websocket.service=minecraft-websocket"
|
|
|
|
- "traefik.http.services.minecraft-websocket.loadbalancer.server.port=4327"
|
|
|
|
- "traefik.http.middlewares.minecraft-websocket-stripprefix.stripprefix.prefixes=/rcon-websocket"
|
|
|
|
|
|
|
|
- "traefik.http.routers.minecraft.rule=Host(`{{ minecraft_rcon_domain }}`) && PathPrefix(`/`)"
|
|
|
|
- "traefik.http.routers.minecraft.entrypoints=websecure"
|
|
|
|
- "traefik.http.routers.minecraft.tls.certresolver={{ minecraft_rcon_certresolver }}"
|
|
|
|
- "traefik.http.routers.minecraft.middlewares=minecraft,compress"
|
|
|
|
- "traefik.http.routers.minecraft.service=minecraft"
|
|
|
|
- "traefik.http.services.minecraft.loadbalancer.server.port=4326"
|
|
|
|
- "traefik.http.middlewares.minecraft.headers.sslredirect=true"
|
|
|
|
- "traefik.http.middlewares.minecraft.headers.stsSeconds=63072000"
|
|
|
|
- "traefik.http.middlewares.minecraft.headers.referrerPolicy=no-referrer"
|
|
|
|
|
|
|
|
{% if proxy_network is defined %}
|
|
|
|
- "traefik.docker.network={{ proxy_network }}"
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- "{{ minecraft_rcon_location }}:/opt/rcon-web-admin/db"
|
|
|
|
networks:
|
|
|
|
minecraft-backend:
|
|
|
|
{% if proxy_network is defined %}
|
|
|
|
{{ proxy_network }}:
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
restart: always
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
networks:
|
|
|
|
minecraft-backend:
|
|
|
|
driver: bridge
|
|
|
|
{% if minecraft_ipv6 is defined and minecraft_ipv6.enabled %}
|
|
|
|
ipam:
|
|
|
|
driver: default
|
|
|
|
config:
|
|
|
|
- subnet: {{ minecraft_ipv6.subnet }}
|
|
|
|
enable_ipv6: true
|
|
|
|
{% endif %}
|
|
|
|
{% if proxy_network is defined and minecraft_enable_rcon_web %}
|
|
|
|
{{ proxy_network }}:
|
|
|
|
external: true
|
|
|
|
{% endif %}
|