added boomhut play and papermc role
parent
27c333bb55
commit
dc538a3971
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
- hosts: boomhut
|
||||
gather_facts: false
|
||||
become: true
|
||||
roles:
|
||||
- 'any.common.python'
|
||||
- 'any.common.debian-user'
|
||||
tags: first
|
||||
|
||||
- hosts: boomhut
|
||||
become: true
|
||||
roles:
|
||||
# - 'any.common.debian-repositories'
|
||||
- 'any.tools.default'
|
||||
- 'any.tools.restic'
|
||||
# First change SSH settings before enabling firewall
|
||||
- 'any.common.ssh'
|
||||
- 'any.tools.ufw'
|
||||
tags: base
|
||||
|
||||
- hosts: boomhut
|
||||
become: true
|
||||
roles:
|
||||
- 'any.software.papermc-podman'
|
||||
tags: papermc
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
ARG BASE_IMAGE
|
||||
|
||||
# Build dumb-init
|
||||
FROM alpine AS dumb-init-builder
|
||||
|
||||
ARG DI_VER=1.2.5
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Build dumb-init & download tshock
|
||||
RUN apk add --update --no-cache build-base unzip curl && \
|
||||
curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
|
||||
cd "dumb-init-${DI_VER}" && \
|
||||
make SHELL=/bin/sh && \
|
||||
mv dumb-init ..
|
||||
|
||||
|
||||
# We use ${:-} instead of a default value because the argument is always passed
|
||||
# to the build, it'll just be blank most likely
|
||||
FROM ${BASE_IMAGE:-'eclipse-temurin:21-jre-alpine'}
|
||||
|
||||
# Build arguments
|
||||
ARG MC_VERSION
|
||||
ARG PAPERMC_VERSION
|
||||
|
||||
COPY ./alex /bin/alex
|
||||
|
||||
# Install alex binary
|
||||
# ADD "https://git.rustybever.be/api/packages/Chewing_Bever/generic/alex/0.4.0/alex-linux-amd64" /bin/alex
|
||||
|
||||
# RUN chmod +x /bin/alex && \
|
||||
# addgroup -Sg 1000 paper && \
|
||||
# adduser -SHG paper -u 1000 paper
|
||||
|
||||
# Create worlds and config directory
|
||||
WORKDIR /app
|
||||
RUN mkdir -p worlds config/cache backups
|
||||
|
||||
# Download server file
|
||||
# ADD "https://papermc.io/api/v2/projects/paper/versions/$MC_VERSION/builds/$PAPERMC_VERSION/downloads/paper-$MC_VERSION-$PAPERMC_VERSION.jar" server.jar
|
||||
ADD "https://fill-data.papermc.io/v1/objects/0b32aa197452047a51772af05bb9fddc264304ad780dca87425a726d68f89149/paper-1.21.10-127.jar" server.jar
|
||||
|
||||
# Make sure the server user can access all necessary folders
|
||||
# RUN chown -R paper:paper /app
|
||||
|
||||
# Store the cache in an anonymous volume, which means it won't get stored in the other volumes
|
||||
# VOLUME /app/config/cache
|
||||
|
||||
ENV ALEX_JAR=/app/server.jar \
|
||||
ALEX_CONFIG=/app/config \
|
||||
ALEX_WORLD=/app/worlds \
|
||||
ALEX_BACKUP=/app/backups \
|
||||
ALEX_SERVER=paper \
|
||||
ALEX_SERVER_VERSION="${MC_VERSION}-${PAPERMC_VERSION}"
|
||||
|
||||
# Document exposed ports
|
||||
EXPOSE 25565
|
||||
|
||||
# Switch to non-root user
|
||||
# USER paper:paper
|
||||
|
||||
COPY --from=dumb-init-builder /app/dumb-init /dumb-init
|
||||
|
||||
ENTRYPOINT ["/dumb-init", "--"]
|
||||
CMD /bin/alex run
|
||||
|
||||
# HEALTHCHECK --interval=30s --timeout=5s --start-period=1m --retries=5 \
|
||||
# CMD mcstatus localhost:25565 ping
|
||||
Binary file not shown.
|
|
@ -0,0 +1,23 @@
|
|||
# vim: ft=systemd
|
||||
[Unit]
|
||||
Description=Self-hostable Minecraft server
|
||||
|
||||
[Container]
|
||||
Image=papermc:1.21.10
|
||||
EnvironmentFile=/etc/papermc/papermc.env
|
||||
Pull=never
|
||||
|
||||
PodmanArgs=--tty
|
||||
|
||||
PublishPort=25565:25565
|
||||
|
||||
Volume=/data/papermc/config:/app/config
|
||||
Volume=/data/papermc/worlds:/app/worlds
|
||||
Volume=/data/papermc/backups:/app/backups
|
||||
Volume=/data/papermc/cache:/app/config/cache
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
ALEX_XMS=4096
|
||||
ALEX_XMX=6144
|
||||
ALEX_LAYERS=30min,30,1,48;daily,1440,7,1
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
- name: Ensure data directory is present
|
||||
ansible.builtin.file:
|
||||
path: '/data/papermc/{{ item }}'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: 'debian'
|
||||
group: 'debian'
|
||||
loop:
|
||||
- 'cache'
|
||||
- 'worlds'
|
||||
- 'config'
|
||||
- 'backups'
|
||||
|
||||
- name: Ensure configuration directory is present
|
||||
ansible.builtin.file:
|
||||
path: '/etc/papermc'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Ensure files are present
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item }}'
|
||||
dest: '/etc/papermc/{{ item }}'
|
||||
mode: '0644'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
loop:
|
||||
- 'papermc.env'
|
||||
- 'Dockerfile'
|
||||
- 'alex'
|
||||
|
||||
- name: Ensure user configuration directory is present
|
||||
ansible.builtin.file:
|
||||
path: '/home/debian/.config/containers/systemd'
|
||||
state: directory
|
||||
owner: 'debian'
|
||||
group: 'debian'
|
||||
mode: '0755'
|
||||
|
||||
- name: Ensure Container unit files are present
|
||||
ansible.builtin.copy:
|
||||
src: "papermc.container"
|
||||
dest: "/home/debian/.config/containers/systemd/papermc.container"
|
||||
mode: '0644'
|
||||
owner: 'debian'
|
||||
group: 'debian'
|
||||
register: res
|
||||
|
||||
- name: systemd-reload
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
scope: "user"
|
||||
when: 'res.changed'
|
||||
Loading…
Reference in New Issue