Skip to content

First attempt at creating a user space script. #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.env
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
Expand Down
17 changes: 15 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{
"cSpell.words": [
"arkmanager"
]
"arkmanager",
"BATTLEYE",
"cifs",
"CROSSPLAY",
"fjordur",
"healthcheck",
"RCON",
"theisland"
],
"gitlens.autolinks": [
{
"prefix": "#",
"url": "https://github.com/fossum/ark-cluster/issues/<num>"
}
],
}
10 changes: 8 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "Build Image",
"type": "shell",
"command": "docker build -t ark-cluster .",
"command": "docker build -t fossum/ark-cluster:dev .",
"problemMatcher": [],
"group": {
"kind": "build",
Expand All @@ -16,7 +16,13 @@
{
"label": "Run Image",
"type": "shell",
"command": "docker stop ark; docker rm ark; docker run -v ${pwd}/ark:/ark -p 7777:7777/udp -p 7778:7778/udp -p 32330:32330 -p 27015:27015/udp -e SESSIONNAME=myserver -e ADMINPASSWORD=\"mypasswordadmin\" --name ark ark-cluster"
"command": "docker stop ark; docker rm ark; docker run -v ${pwd}/ark:/ark -p 7777:7777/udp -p 7778:7778/udp -p 32330:32330 -p 27015:27015/udp -e SESSIONNAME=myserver -e ADMINPASSWORD=\"mypasswordadmin\" --name ark fossum/ark-cluster:dev"
},
{
"label": "Push Dev Image",
"type": "shell",
"command": "docker push fossum/ark-cluster:dev",
"problemMatcher": []
}
]
}
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ENV CRON_AUTO_UPDATE="0 */3 * * *" \
GROUP_ID=1000 \
TZ=UTC \
MAX_BACKUP_SIZE=500 \
SERVERMAP="TheIsland" \
SERVER_MAP="TheIsland" \
SESSION_NAME="ARK Cluster" \
MAX_PLAYERS=20 \
RCON_ENABLE="True" \
Expand All @@ -36,7 +36,8 @@ ENV CRON_AUTO_UPDATE="0 */3 * * *" \
CLUSTER_ID="" \
KILL_PROCESS_TIMEOUT=300 \
KILL_ALL_PROCESSES_TIMEOUT=300 \
TOOLS_GIT_REF=""
TOOLS_GIT_REF="" \
ARK_SERVER_VOLUME="/ark"

# Install Ark Server Tools
# Get tag version or master.
Expand All @@ -63,9 +64,14 @@ RUN mkdir -p /ark \

COPY crontab /home/steam/crontab

# Setup run script
# Add run and user scripts
COPY shared.sh /shared.sh
RUN chmod +x /shared.sh
COPY run.sh /run.sh
RUN chmod +x /run.sh
COPY user-space.sh /user-space.sh
RUN chmod +x /user-space.sh
COPY arkmanager-completion.bash /etc/bash_completion.d/arkmanager-completion.bash

# Skip expose, not all servers will use the same ports.
VOLUME /ark /cluster
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ For example :
After updating the `/my/path/to/ark/crontab` please run the command
`docker exec ark crontab -u steam /ark/crontab`

To add mods, you only need to change the variable ark_GameModIds in *arkmanager.cfg* with a list of your modIds (like this `ark_GameModIds="987654321,1234568"`). If UPDATEONSTART is enable, just restart your docker or use `docker exec ark arkmanager update --update-mods`.
To add mods, you only need to change the variable ark_GameModIds in *arkmanager.cfg* with a list of your modIds (like this `ark_GameModIds="987654321,1234568"`). If UPDATE_ON_START is enabled, just restart your docker or use `docker exec ark arkmanager update --update-mods`.

## Recommended Usages

Expand Down Expand Up @@ -109,19 +109,19 @@ To add mods, you only need to change the variable ark_GameModIds in *arkmanager.
## Variables

- __SESSIONNAME__: Name of your ark server (default: "Ark Docker")
- __SERVERMAP__: Map of your ark server (default: "TheIsland")
- __SERVERPASSWORD__: Password of your ark server (default: "")
- __ADMINPASSWORD__: Admin password of your ark server (default: "adminpassword")
- __SERVERPORT__: Ark server port (can't rebind with docker, it doesn't work) (default: 27015)
- __STEAMPORT__: Steam server port (can't rebind with docker, it doesn't work) (default: 7778)
- __SERVER_MAP__: Map of your ark server (default: "TheIsland")
- __SERVER_PASSWORD__: Password of your ark server (default: "")
- __ADMIN_PASSWORD__: Admin password of your ark server (default: "adminpassword")
- __SERVER_PORT__: Ark server port (can't rebind with docker, it doesn't work) (default: 27015)
- __STEAM_PORT__: Steam server port (can't rebind with docker, it doesn't work) (default: 7778)
- __MAX_PLAYERS__: Number of maximum players (default: 70)
- __BACKUPONSTART__: Backup the server when the container is started. 0: no backup (default: 1)
- __UPDATEPONSTART__: Update the server when the container is started. 0: no update (default: 1)
- __BACKUPONSTOP__: Backup the server when the container is stopped. 0: no backup (default: 1)
- __WARNONSTOP__: Warn the players before the container is stopped. 0: no warning (default: 1)
- __BACKUP_ON_START__: Backup the server when the container is started. 0: no backup (default: 1)
- __UPDATE_ON_START__: Update the server when the container is started. 0: no update (default: 1)
- __BACKUP_ON_STOP__: Backup the server when the container is stopped. 0: no backup (default: 1)
- __WARN_ON_STOP__: Warn the players before the container is stopped. 0: no warning (default: 1)
- __TZ__: container timezone (for crontab). (default: "UTC").
- __UID__: UID of the user used. Owner of the volume /ark (default: 1000)
- __GID__: GID of the user used. Owner of the volume /ark (default: 1000)
- __USER_ID__: UID of the user used. Owner of the volume /ark (default: 1000)
- __GROUP_ID__: GID of the user used. Owner of the volume /ark (default: 1000)

## Volumes

Expand Down
3 changes: 3 additions & 0 deletions arkmanager-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#/usr/bin/env bash

complete -W "upgrade-tools uninstall-tools useconfig remove-mods list-instances Command backup restore broadcast saveworld rconcmd checkupdate checkmodupdate install installmod uninstallmod reinstallmod enablemod disablemod installmods uninstallmods install-cronjob remove-cronjob restart run start stop cancelshutdown status printconfig getpid update" arkmanager
6 changes: 3 additions & 3 deletions arkmanager-user.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ARK server options - use ark_<optionname>=<value>
# comment out these values if you want to define them
# inside your GameUserSettings.ini file
serverMap="${SERVERMAP:=TheIsland}" # server map (default TheIsland)
serverMap="${SERVER_MAP:=TheIsland}" # server map (default TheIsland)
#serverMapModId="469987622" # Uncomment this to specify the Map Mod Id (<fileid> in http://steamcommunity.com/sharedfiles/filedetails/?id=<fileid>)
#ark_TotalConversionMod="496735411" # Uncomment this to specify a total-conversion mod
ark_RCONEnabled="${RCON_ENABLE:=false}" # Enable RCON Protocol
ark_RCONPort="${RCON_PORT:=32330}" # RCON Port
ark_RCONPort="${RCON_PORT:=27020}" # RCON Port
ark_SessionName="${SESSION_NAME:=ARK Docker}" # if your session name needs special characters please use the .ini instead
ark_Port="${GAME_PORT:=7778}" # ARK server port (default 7777)
ark_Port="${GAME_PORT:=7777}" # ARK server port (default 7777)
ark_QueryPort="${QUERY_PORT:=27015}" # ARK query port (default 27015)
ark_ServerPassword="${SERVER_PASSWORD}" # ARK server password, empty: no password required to login
ark_ServerAdminPassword="${ADMIN_PASSWORD}" # ARK server admin password, KEEP IT SAFE!
Expand Down
20 changes: 14 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ version: "3.5"
services:
theisland:
image: fossum/ark-cluster:master

# healthcheck:
# test: arkmanager status | grep 'Server listening:.\+No' && exit 1
# interval: 60s
# retries: 5
# start_period: 600s
# timeout: 10s

deploy:
restart_policy:
condition: on-failure
Expand All @@ -22,14 +30,14 @@ services:
failure_action: rollback

environment:
SERVERMAP: "TheIsland"
SERVER_MAP: "TheIsland"
SESSION_NAME: "ARK Cluster TheIsland"
CRON_AUTO_UPDATE: ${CRON_AUTO_UPDATE:-0 */3 * * *}
CRON_AUTO_BACKUP: ${CRON_AUTO_BACKUP:-0 */1 * * *}
UPDATEONSTART: ${UPDATEONSTART:-1}
BACKUPONSTART: ${BACKUPONSTART:-1}
BACKUPONSTOP: ${BACKUPONSTOP:-1}
WARNONSTOP: ${WARNONSTOP:-1}
UPDATE_ON_START: ${UPDATEONSTART:-1}
BACKUP_ON_START: ${BACKUPONSTART:-1}
BACKUP_ON_STOP: ${BACKUPONSTOP:-1}
WARN_ON_STOP: ${WARNONSTOP:-1}
USER_ID: ${USER_ID:-1000}
GROUP_ID: ${GROUP_ID:-1000}
TZ: ${TZ:-UTC}
Expand Down Expand Up @@ -76,7 +84,7 @@ services:
order: stop-first
failure_action: rollback
environment:
SERVERMAP: "Valguero_P"
SERVER_MAP: "Valguero_P"
SESSION_NAME: "ARK Cluster"
RCON_PORT: ${RCON_PORT:-32331}
GAME_PORT: ${GAME_PORT:-7779}
Expand Down
144 changes: 144 additions & 0 deletions personal-stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
version: "3.5"

services:
theisland:
image: fossum/ark-cluster:dev
# healthcheck:
# test: arkmanager status | grep 'Server listening:.\+No' && exit 1
# interval: 60s
# retries: 5
# start_period: 600s
# timeout: 10s
deploy:
restart_policy:
condition: on-failure
delay: 15s
max_attempts: 2
window: 600s
mode: replicated
replicas: 1
resources:
reservations:
memory: 8gb
update_config:
parallelism: 1
delay: 30s
order: stop-first
failure_action: rollback
placement:
constraints:
- node.hostname==dockers
volumes:
# - theisland:/ark
- type: bind
source: /mnt/nfs/ark/theisland
target: /ark
- cluster:/cluster
environment:
SERVER_MAP: TheIsland
SESSION_NAME: Venture Bros (TheIsland)
TZ: ${TIME_ZONE}
SERVER_PASSWORD: ${SERVER_PASSWORD}
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
MAX_PLAYERS: ${MAX_PLAYERS}
UPDATE_ON_START: ${UPDATE_ON_START}
BACKUP_ON_STOP: ${BACKUP_ON_STOP}
PRE_UPDATE_BACKUP: ${PRE_UPDATE_BACKUP}
WARN_ON_STOP: ${WARN_ON_STOP}
ENABLE_CROSSPLAY: ${ENABLE_CROSSPLAY}
DISABLE_BATTLEYE: ${DISABLE_BATTLEYE}
GAME_MOD_IDS: ${GAME_MOD_IDS}
CLUSTER_ID: ${CLUSTER_ID}
GAME_PORT: 7777
QUERY_PORT: 27015
RCON_PORT: 27020
BACKUP_TO_LOAD: backup/main.2023-03-01_20.08.36.tar.bz2
ports:
- "7777:7777/udp"
- "7778:7778/udp"
- "27015:27015/udp"
- "27020:27020/tcp"
# fjordur:
# image: fossum/ark-cluster:dev
# # entrypoint: /bin/bash
# # command: -c "tail -F anything"
# # healthcheck:
# # test: arkmanager status | grep 'Server listening:.\+No' && exit 1
# # interval: 60s
# # retries: 5
# # start_period: 600s
# # timeout: 10s
# deploy:
# restart_policy:
# condition: on-failure
# delay: 15s
# max_attempts: 3
# window: 600s
# mode: replicated
# replicas: 1
# resources:
# reservations:
# memory: 8gb
# update_config:
# parallelism: 1
# delay: 30s
# order: stop-first
# failure_action: rollback
# placement:
# constraints:
# - node.hostname==dockers
# environment:
# SERVER_MAP: Fjordur
# SESSION_NAME: Venture Bros (Fjordur)
# TZ: ${TIME_ZONE}
# SERVER_PASSWORD: ${SERVER_PASSWORD}
# ADMIN_PASSWORD: ${ADMIN_PASSWORD}
# MAX_PLAYERS: ${MAX_PLAYERS}
# UPDATE_ON_START: ${UPDATE_ON_START}
# BACKUP_ON_STOP: ${BACKUP_ON_STOP}
# PRE_UPDATE_BACKUP: ${PRE_UPDATE_BACKUP}
# WARN_ON_STOP: ${WARN_ON_STOP}
# ENABLE_CROSSPLAY: ${ENABLE_CROSSPLAY}
# DISABLE_BATTLEYE: ${DISABLE_BATTLEYE}
# GAME_MOD_IDS: ${GAME_MOD_IDS}
# CLUSTER_ID: ${CLUSTER_ID}
# GAME_PORT: 7780
# QUERY_PORT: 27016
# RCON_PORT: 27021
# ports:
# - "7780:7780/udp"
# - "7781:7781/udp"
# - "27016:27016/udp"
# - "27021:27021/tcp"
# volumes:
# - fjordur:/ark
# - cluster:/cluster

volumes:
# theisland:
# driver: local
# driver_opts:
# type: "nfs"
# o: "addr=truenas.thefoss.org,nolock,rw,nfsvers=4,sync,noatime,tcp"
# device: ":/mnt/no-backup/games/ark/theisland"
# # type: "cifs"
# # o: "addr=truenas.thefoss.org,username=${CIFS_USER},password=${CIFS_PASS},file_mode=0777,dir_mode=0777"
# # device: "//truenas.thefoss.org/ark/theisland"
# fjordur:
# driver: local
# driver_opts:
# #type: "nfs"
# #o: "addr=truenas.thefoss.org,nolock,rw,nfsvers=4,async,noatime,rsize=8192,wsize=8192,tcp,timeo=14"
# #device: ":/mnt/no-backup/games/ark/fjordur"
# type: "cifs"
# o: "addr=truenas.thefoss.org,username=${CIFS_USER},password=${CIFS_PASS},file_mode=0777,dir_mode=0777"
# device: "//truenas.thefoss.org/ark/fjordur"
cluster:
driver: local
driver_opts:
type: "nfs"
o: "addr=truenas.thefoss.org,nolock,rw,nfsvers=4,sync,noatime,tcp"
device: ":/mnt/no-backup/games/ark/cluster"
# type: "cifs"
# o: "addr=truenas.thefoss.org,username=${CIFS_USER},password=${CIFS_PASS},file_mode=0777,dir_mode=0777"
# device: "//truenas.thefoss.org/ark/cluster"
Loading