Skip to content
Open

WIP #14

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
21 changes: 21 additions & 0 deletions .github/workflows/comment-commands.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
id: scd
uses: peter-evans/slash-command-dispatch@v2
with:
token: ${{ secrets.SLASH_COMMANDS_PAT }}
issue-type: pull-request
dispatch-type: repository
permission: write
commands: |
test-server
static-args: |
repository=${{ github.repository }}
comment-id=${{ github.event.comment.id }}
File renamed without changes.
38 changes: 38 additions & 0 deletions .github/workflows/test-server-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish PR Docker Image
on:
repository_dispatch:
types: [test-server-command]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Dump the client payload context
env:
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
run: echo "$PAYLOAD_CONTEXT"
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.pull_request.head.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set variables
id: prep
run: |
DOCKER_IMAGE=test-server
REPOSITORY="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" # Repository name must be lowercase in image tags
TAGS="ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:${{ github.event.client_payload.pull_request.head.sha }}"

echo ::set-output name=tags::${TAGS}
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.prep.outputs.tags }} #
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Test
on:
push:
paths-ignore: .github\workflows
branches:
- master
pull_request:
paths-ignore: .github\workflows
types: [ opened, reopened, synchronize ]
jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ lazy val psforeverSettings = Seq(
"com.github.pureconfig" %% "pureconfig" % "0.16.0",
"com.beachape" %% "enumeratum" % "1.6.1",
"joda-time" % "joda-time" % "2.10.10",
"commons-io" % "commons-io" % "2.9.0",
"commons-io" % "commons-io" % "2.10.0",
"com.github.scopt" %% "scopt" % "4.0.1",
"io.sentry" % "sentry-logback" % "5.0.1",
"io.circe" %% "circe-core" % "0.14.1",
Expand Down
259 changes: 259 additions & 0 deletions config/worldserver.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
#######################################
# PSForever Server configuration file #
#######################################

###################################################################################################
# EXAMPLE CONFIG
#
# Variable (type)
# Description: Brief description what the variable is doing.
# Important: Annotation for important things about this variable.
# Example: "Example, i.e. if the value is a string"
# Range: [0, 10] - (Disabled, Enabled)
# Default: 10 - (Enabled|Comment|Variable name in case of grouped config options)
# 0 - (Disabled|Comment|Variable name in case of grouped config options)
#
# Note to developers:
# - Copy this example to keep the formatting.
# - Line breaks should be at column 100.
###################################################################################################

###################################################################################################
# DATABASE SETTINGS
###################################################################################################

[database]

# Hostname (string)
# Description: The hostname of the PostgreSQL server.
# Important: Make sure your database isn't accessible outside of localhost without a
# strong username and password!
# Default: "localhost"

Hostname = "localhost"

# Port (int)
# Description: The TCP port to connect to the database with.
# Range: [1, 65535] - (TCP port 1, TCP port 65535)
# Default: 5432 - (Connect to TCP port 5432 -- the default for PostgreSQL)

Port = 5432

# SSL (enum)
# Description: The SSL configuration of the database connection.
# Values: Disable - (Do not use SSL -- not recommended for public servers)
# Prefer - (Try SSL first, but fallback to unencrypted)
# Require - (Use SSL and fail if it is not enabled or configured correctly
# Verify - (Use SSL and verify that the certificate is authentic)
# Default: Prefer

SSL = Prefer

# Database (string)
# Description: The database name to use on the SQL server.
# Important: Make sure your username has been GRANTed ALL PRIVILEGES to the database.
# See the setup documentation for instructions on achieving this.
# Default: "psforever"

Database = "psforever"

# Username (string)
# Description: The username to connect to the SQL server with.
# Default: "psforever"

Username = "psforever"

# Password (string)
# Description: The password to connect to the SQL server with.
# Important: CHANGE THIS PASSWORD BEFORE RUNNING A PUBLIC SERVER.
# Default: "psforever"

Password = "psforever"

###################################################################################################
# WORLDSERVER SETTINGS
###################################################################################################

[worldserver]

# ListeningPort (int)
# Description: The UDP listening port for the worldserver.
# Important: Must be different from the loginserver.ListeningPort. Ports below 1024 are
# privileged on Linux and may require root.
# Range: [1, 65535] - (UDP port 1, UDP port 65535)
# Default: 51001 - (Listen on UDP port 51001)

ListeningPort = 51001

# Hostname (string)
# Description: The server's public hostname or IP address. Required when the server is
# behind a proxy or running in a container/virtual machine.
# Important: If left as the default, the hostname will be the same as the primary
# internet interface.
# Default: ""

Hostname = ""

# ServerName (string)
# Description: The name of the server as displayed in the server browser.
# Range: Length = [1, 31]
# Default: "PSForever"

ServerName = "PSForever"

# ServerType (enum)
# Description: How the server is displayed in the server browser.
# Values: Released, Beta, Development
# Default: Released

ServerType = Released

###################################################################################################
# LOGINSERVER SETTINGS
###################################################################################################

[loginserver]

# ListeningPort (int)
# Description: The UDP listening port for the loginserver.
# Important: Must be different from the worldserver.ListeningPort. Ports below 1024 are
# privileged on Linux and may require root.
# Range: [1, 65535] - (UDP port 1, UDP port 65535)
# Default: 51000 - (Listen on UDP port 51000)

ListeningPort = 51000

# CreateMissingAccounts (boolean)
# Description: Account usernames that don't exist yet will be automatically created in the
# database. Useful for test servers and development testing.
# Important: Not recommended for production servers as typos are easy to make on
# first registration. Use PSFPortal (https://github.com/psforever/PSFPortal)
# instead.
# Default: yes - (Enabled)
# no - (Disabled)

CreateMissingAccounts = yes

###################################################################################################
# PSADMIN SETTINGS
###################################################################################################

[psadmin]

# ListeningPort (int)
# Description: The TCP listening port for the server admin interface.
# Important: Must be different from the worldserver and loginserver ListeningPort.
# Ports below 1024 are privileged on Linux and may require root.
# NEVER EXPOSE THIS PORT TO THE INTERNET! CHECK YOUR FIREWALL CONFIG.
# Range: [1, 65535] - (TCP port 1, TCP port 65535)
# Default: 51002 - (Listen on TCP port 51002)

ListeningPort = 51002

###################################################################################################
# NETWORK SETTINGS
###################################################################################################

[network]

# Session.InboundGraceTime (time)
# Description: The maximum amount of time since the last inbound packet from a UDP session
# before it is dropped.
# Important: Lower values will cause legitimate clients to be dropped during loading
# screens, but higher values will make the server be more susceptible to
# denial of service attacks and running out of memory.
# Range: [10 seconds, 10 minutes] - (10 second grace, 10 minute grace)
# Default: 1 minute - (Clients sending a packet at least
# once a minute stay alive)

Session.InboundGraceTime = 1 minute

# Session.OutboundGraceTime (time)
# Description: The maximum amount of time since the last outbound packet for a UDP session
# before it is dropped. Can be used as a watchdog for hung server sessions.
# Important: Lower values will cause legitimate clients to be dropped during server
# lag spikes or Zone transitions.
# Range: [10 seconds, 10 minutes] - (10 second grace, 10 minute grace)
# Default: 1 minute - (Clients receiving a packet at least
# once a minute stay alive)

Session.OutboundGraceTime = 1 minute

###################################################################################################
# DEVELOPER SETTINGS
# - NETWORK SIMULATOR
###################################################################################################

[developer]

###################################################################################################
# NETWORK SIMULATOR
#
# NetSim.Active (boolean)
# Description: Enable artificial packet unreliability. Used for development testing.
# Active equally on upstream and downstream packets.
# Important: DO NOT enable on servers with a high packet rate as buffering increases
# the memory load of the server and it will (by design) affect performance.
# Default: no - (Disabled)
# yes - (Enabled)

NetSim.Active = no

# NetSim.Loss (float)
# Description: The percentage of outgoing and incoming packets that are dropped.
# Range: [0.0, 1.0] - (0% loss, 100% packet loss)
# Default: 0.02 - (2% packet loss)

NetSim.Loss = 0.0

# NetSim.Delay (time)
# Description: The time a packet is buffered before being delivered to simulate delay.
# The artificial delay is in addition to any real network latency.
# Important: Longer delays will lead to larger packet buffering, which may cause
# out-of-memory errors depending on packet rate.
# Range: [0, 2 seconds] - (No delay, 2 seconds delay)
# Default: 150 milliseconds - (Packets lag for 150 milliseconds)

NetSim.Delay = 150 milliseconds

# NetSim.ReorderChance (float)
# Description: The percentage chance that a packet will be ordered randomly in the delay
# buffer. If the NetSim.Delay is too small then packets won't be reordered.
# Range: [0.0, 1.0] - (No packet reordering, reorder every packet)
# Default: 0.005 - (0.5% chance of a packet being reordered)

NetSim.ReorderChance = 0.05

# NetSim.ReorderTime (time)
# Description: If a packet is reordered, the maximum time in the future or the past where
# it will randomly appear.
# Range: [0, 2 seconds] - (No packet reordering, randomly shift +/- 2 seconds)
# Default: 150 milliseconds - (+/- 150 milliseconds)

NetSim.ReorderTime = 150 milliseconds

#
###################################################################################################


[kamon]

# Kamon
#
# Active (boolean)
# Description: Enables reporting of metrics to Kamon.io
# Important: Ensure the API key is set in application.conf in the same
# folder as PsLogin.scala
# Default: no - (Disabled)
# yes - (Enabled)

Active = yes

[antihack]

# HitPositionDiscrepancyThreshold (int)
# Description: The distance (squared) threshold that triggers if the reported hit location of a shot does not match the object being hit's location on the server
# Range: [1, 1000000]
# Default: 10000 (sqrt 10000 = ~100 ingame units)

HitPositionDiscrepancyThreshold = 10000
3 changes: 3 additions & 0 deletions pslogin/src/main/resources/user.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kamon {
apm.api-key = "3405691582g0h8776i44234htm"
}
Loading