Merge branch 'master' of gitlab.com:rusty-bever/deployment
commit
faa50b0dec
|
@ -0,0 +1,38 @@
|
|||
version: '3.4'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: 'git.rustybever.be/chewing_bever/tshock:4.5.18'
|
||||
build:
|
||||
context: tshock
|
||||
args:
|
||||
- 'RELEASE_TAG=v4.5.18'
|
||||
|
||||
# These are necessary to make the console work
|
||||
stdin_open: true
|
||||
tty: true
|
||||
|
||||
deploy:
|
||||
mode: 'replicated'
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
- 'node.labels.class==gitea'
|
||||
# This makes sure the server can never choke my Gitea completely
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.0'
|
||||
|
||||
environment:
|
||||
- 'AUTOCREATE=2'
|
||||
ports:
|
||||
- '7777:7777'
|
||||
volumes:
|
||||
- 'logs:/app/logs'
|
||||
- 'config:/app/config'
|
||||
- 'worlds:/app/worlds'
|
||||
|
||||
volumes:
|
||||
logs:
|
||||
config:
|
||||
worlds:
|
|
@ -0,0 +1,45 @@
|
|||
FROM alpine AS base
|
||||
|
||||
# Build arguments
|
||||
ARG RELEASE_TAG
|
||||
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 .. && \
|
||||
cd .. && \
|
||||
curl -s "https://api.github.com/repos/Pryaxis/TShock/releases/tags/${RELEASE_TAG}" | \
|
||||
grep "browser_download_url" | \
|
||||
grep -o "https[^\"]\+" | \
|
||||
xargs curl -sLo tshock.zip && \
|
||||
unzip -d tshock tshock.zip && \
|
||||
rm tshock.zip
|
||||
|
||||
|
||||
FROM mono:6.12.0.182
|
||||
|
||||
RUN useradd -m terraria && \
|
||||
mkdir /app && \
|
||||
chown -R terraria /app
|
||||
|
||||
USER terraria
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=base /app/tshock /app/dumb-init /app/
|
||||
|
||||
# Create worlds directory & symlink it
|
||||
RUN mkdir -p worlds logs config "$HOME/.local/share/Terraria" && \
|
||||
ln -s /app/worlds "$HOME/.local/share/Terraria/Worlds"
|
||||
|
||||
ENTRYPOINT ["/app/dumb-init", "--"]
|
||||
CMD mono /app/TerrariaServer.exe \
|
||||
-configpath /app/config \
|
||||
-logpath /app/logs \
|
||||
-autocreate "$AUTOCREATE" \
|
||||
-world /app/worlds/Main.wld
|
|
@ -0,0 +1,29 @@
|
|||
# Build arguments
|
||||
The only required build argument is `RELEASE_TAG`. This is the GitHub tag of
|
||||
the release you wish to use. The releases can be found
|
||||
[here](https://github.com/Pryaxis/TShock/releases). The release tag is the
|
||||
identifier on the left. It should look something like `v4.4.0-pre15`. You can
|
||||
then specify the variable in the `.env` file: e.g. `RELEASE_TAG=v4.4.0-pre15`
|
||||
|
||||
# Environment variables
|
||||
The only provided environment variable is `AUTOCREATE`. This should be either
|
||||
`1`, `2` or `3`. It specifies how big the generated world should, e.g. small,
|
||||
medium or large. If a world file already exists, the existing file is used
|
||||
instead of generating a new one.
|
||||
|
||||
# Mount points
|
||||
There a three useful mount points defined:
|
||||
|
||||
* `/terraria/config`: this is where the server config files are located
|
||||
* `/terraria/logs`: the server log files are dumped here
|
||||
* `/terraria/worlds`: this is where the world files are stored
|
||||
|
||||
You can mount these directories somewhere in the host file system by specifying
|
||||
the mount paths in the `.env` file. These can be both absolute or relative
|
||||
paths.
|
||||
|
||||
# Other config variables
|
||||
You can specify the port using the `PORT` variable. This configures which port
|
||||
on the host system should be exposed for the Terraria server. This is also the
|
||||
port you need to enter into the Terraria client in order to connect to the
|
||||
server. The default port for Terraria servers is `7777`.
|
Loading…
Reference in New Issue