Skip to content
This repository was archived by the owner on Apr 10, 2022. It is now read-only.

Commit 142ad09

Browse files
committed
Add SDL libraries, ensure steam environment set.
* Add SDL libraries for steam install, preventing new SDL errors ValveSoftware/steam-for-linux#7036 * Ensure steam user environment is setup correctly, updated instructions. * Enforce set variables for startup scripts. * Remove trace logging for startup scripts. * Update examples.
1 parent 3cca9f8 commit 142ad09

File tree

8 files changed

+54
-32
lines changed

8 files changed

+54
-32
lines changed

Dockerfile/BASE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ENV SERVER_DIR=/data/server \
77
STEAM=/steam \
88
PLATFORM=windows \
99
STEAM_APP_ID=0 \
10+
STEAM_APP_EXTRAS='' \
1011
UPDATE_OS=1 \
1112
UPDATE_STEAM=1 \
1213
UPDATE_SERVER=1 \

Dockerfile/INSTALL_STEAM

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ echo steam steam/question select 'I AGREE' | debconf-set-selections && \
44
dpkg --add-architecture i386 && \
55
apt-get --quiet update && \
66
apt-get --quiet --yes upgrade && \
7+
# Explicitly add SDL library: https://github.com/ValveSoftware/steam-for-linux/issues/7036
78
apt-get install --yes --install-recommends \
9+
libsdl2-2.0-0:i386 \
10+
libsdl2-2.0-0 \
811
gdb && \
912
apt-get install --yes --install-recommends \
1013
steamcmd && \

Dockerfile/STEAM_SERVICE

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Create steam user and setup permissions.
22
useradd --create --home ${STEAM} steam && \
3-
su steam -c " \
3+
su - steam -c " \
44
cd ${STEAM} && \
55
steamcmd +quit" && \
6+
mkdir -p /steam/.steam/{sdk32,sdk64} && \
7+
echo "\nexport PATH=\$PATH:/steam/.steam/steamcmd/linux32:/steam/.steam/steamcmd/linux64" | tee -a /steam/.profile && \
68
# winehq may potentially take ~5 minutes on first boot to launch, due to
79
# blocking on boot events:
810
#
@@ -20,8 +22,9 @@ su steam -c " \
2022
# https://ubuntuforums.org/archive/index.php/t-1499348.html
2123
# https://bugs.winehq.org/show_bug.cgi?id=38653
2224
echo 'Updating wine, ignore any errors ...' && \
23-
su steam -c 'wineboot --update' /dev/null 2>&1 && \
25+
su - steam -c 'wineboot --update' /dev/null 2>&1 && \
2426
echo 'Wine update completed.' && \
2527
mkdir -p /data && \
2628
chown -R steam:steam ${STEAM} /data /docker && \
2729
chmod 0755 /docker/* && \
30+

README.md

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
Generic Steam dedicated server using Docker.
66

77
This provides a core installation of `steamcmd` to host dedicated servers. Both
8-
linux and windows servers can be hosted using this image.
8+
linux and windows servers (via [wine](winehq.org)) can be hosted using this
9+
image.
910

1011
## How it Runs
1112
The docker image contains a base ubuntu install with wine (windows support) and
@@ -31,22 +32,22 @@ Fully working examples of different dedicated servers.
3132

3233
## Version Tags
3334

34-
| Tag | Description |
35-
|--------------|-------------------------------------------------------------------------------------|
36-
| stable | Ubuntu 18.04 with wine and steamcmd from binary repo. |
37-
| latest | Ubuntu 18.04 with latest winehq STABLE packages and steamcmd. This **WILL** break. |
38-
| experimental | Ubuntu 18.04 with latest winehq STAGING packages and steamcmd. This **WILL** break. |
35+
| Tag | Description |
36+
|--------------|---------------------------------------------------------------------------------|
37+
| stable | Ubuntu 18.04: wine, steamcmd (package). |
38+
| latest | Ubuntu 18.04: winehq STABLE packages, steamcmd (package). This **WILL** break. |
39+
| experimental | Ubuntu 18.04: winehq STAGING packages, steamcmd (package). This **WILL** break. |
3940
* Containers are automatically rebuilt weekly.
4041

4142
## Parameters
4243

4344
| Parameter | Function | Default |
4445
|------------------|------------------------------------------------------------------------------------------|----------------|
4546
| SERVER_DIR | Location for server files. | `/data/server` |
46-
| STEAM | Location of steamcmd client. |`/steam` |
47+
| STEAM | Location of steamcmd client. | `/steam` |
4748
| PLATFORM | Platform to force specify when auto updating. `linux` or `windows`. | `windows` |
4849
| STEAM_APP_ID | Steam application ID for auto updating. | `0` |
49-
| STEAM_APP_EXTRAS | Optional. Additional options for steam app update. | `` |
50+
| STEAM_APP_EXTRAS | Optional. Additional options and values for steam app update, e.g setting BETA versions. | `` |
5051
| UPDATE_OS | Update core OS on startup. `1` enable, `0` disable. | `1` |
5152
| UPDATE_STEAM | Update steamcmd on startup. `1` enable, `0` disable. | `1` |
5253
| UPDATE_SERVER | Update dedicated server specified by `STEAM_APP_ID` on startup. `1` enable, `0` disable. | `1` |
@@ -65,15 +66,15 @@ for a detailed list of steam ports.
6566

6667
| Port | Protocol | Required? | Description |
6768
|-------|----------|-----------|-------------------------|
68-
|`27015`| TCP | Optional | SRCDS RCON port. |
6969
|`27015`| UDP | Mandatory | Gameplay traffic. |
70+
|`27015`| TCP | Optional | SRCDS RCON port. |
7071
|`27016`| UDP | Optional | Steam announce traffic. |
7172

7273
## Volumes
7374

74-
| Volume | Function |
75-
|---------|--------------------------------------------|
76-
| /data | User data location for images. |
75+
| Volume | Function |
76+
|---------|--------------------------------|
77+
| /data | User data location for images. |
7778

7879
## User/Group IDs
7980
When using data volumes (`-v` flags), permissions issues can occur between the
@@ -99,10 +100,9 @@ uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),
99100
The value of `uid` (user ID) and `gid` (group ID) are the ones that you should
100101
be given the container.
101102

102-
103103
## Detailed Usage Instructions
104-
Details how to setup a new server from scratch. See [Example Configurations](#example-configurations)
105-
for working examples.
104+
Details how to setup a new server from scratch. See
105+
[Example Configurations](#example-configurations) for working examples.
106106

107107
### docker-compose (windows dedicated server)
108108
```
@@ -176,7 +176,7 @@ minimum exposure if there are vulnerabilities in the game, as well as prevent
176176
any permissions issues with server files.
177177

178178
```
179-
su steam -c 'your server launch command'
179+
su - steam -c 'your server launch command'
180180
```
181181

182182
> Your specific launch command will vary based on what server you install.
@@ -186,7 +186,7 @@ su steam -c 'your server launch command'
186186
This will launch a **Left 4 Dead** ``srcsd_run`` linux dedicated server.
187187

188188
```
189-
su steam -c "/data/server/srcds_run -console -game left4dead -map l4d_hospital01_apartment -port 27015 +maxplayers 4 -nohltv +exec /data/server.cfg"
189+
su - steam -c "/data/server/srcds_run -console -game left4dead -map l4d_hospital01_apartment -port 27015 +maxplayers 4 -nohltv +exec /data/server.cfg"
190190
```
191191
* this example would launch a Left 4 Dead dedicated server (222840).
192192

@@ -196,7 +196,7 @@ dedicated server documentation and forums for launching a dedicated windows
196196
server under wine for your game.
197197

198198
```bash
199-
su steam -c "xvfb-run --auto-servernum \
199+
su - steam -c "xvfb-run --auto-servernum \
200200
wine64 ${SERVER_DIR}/ConanSandbox/Binaries/Win64/ConanSandboxServer-Win64-Test.exe -nosteamclient -game -server -log"
201201
```
202202
* This example lauches a conan exiles dedicated server (443030).
@@ -210,14 +210,14 @@ For servers that don't require saving of state between reboots, a simple bash sc
210210
Windows
211211
```bash
212212
# This will run wine (for windows servers) and launch the server.
213-
su steam -c "xvfb-run --auto-servernum \
213+
su - steam -c "xvfb-run --auto-servernum \
214214
wine64 ${SERVER_DIR}/ConanSandbox/Binaries/Win64/ConanSandboxServer-Win64-Test.exe -nosteamclient -game -server -log"
215215
```
216216

217217
Linux
218218
```bash
219219
# launch the dedicated linux server under the steam user.
220-
su steam -c "/data/server/startserver.sh \
220+
su - steam -c "/data/server/startserver.sh \
221221
-configfile=/data/server/serverconfig.xml"
222222
```
223223

@@ -262,7 +262,7 @@ function shutdown() {
262262
trap shutdown SIGINT SIGKILL SIGTERM
263263

264264
function start_server() {
265-
su steam -c "xvfb-run --auto-servernum wine64 ${SERVER_DIR}/ConanSandbox/Binaries/Win64/ConanSandboxServer-Win64-Test.exe -nosteamclient -game -server -log"
265+
su - steam -c "xvfb-run --auto-servernum wine64 ${SERVER_DIR}/ConanSandbox/Binaries/Win64/ConanSandboxServer-Win64-Test.exe -nosteamclient -game -server -log"
266266
}
267267

268268
function watch_server() {
@@ -313,8 +313,8 @@ patches; remember to switch to the `steam` user when executing this commands.
313313

314314
custom_server
315315
```bash
316-
su steam -c "winetricks dotnet472"
317-
su steam -c "winetricks vcrun2013"
316+
su - steam -c "winetricks dotnet472"
317+
su - steam -c "winetricks vcrun2013"
318318
```
319319

320320
## Building
@@ -376,11 +376,26 @@ access to.
376376
srcds_run ... -pidfile /data/server/{GAME}.pid
377377
```
378378

379+
### Could not find `steamclient.so` or `[S_API FAIL] SteamAPI_Init() ... or a local steamclient.dll.`
380+
The [Steam Liunus shared libary][6h] could not be found in your path.
381+
382+
Be sure to use `su - steam -c` to load the full steam user profile.
383+
384+
Link to the local `steamclient.so` file, or copy it to where your server binary
385+
is executed. The default location is in the steam user directory:
386+
387+
```bash
388+
/steam/.steam/steamcmd/linux{32,64}/steamclient.so
389+
```
390+
391+
`ln -s -f /steam/.steam/steamcmd/linux32/steamclient.so /steam/.steam/sdk32/steamclient.so`
392+
379393
## Licensing
380394
Steam Logo, SteamCMD ©2019 Valve Corporation. Steam and the Steam logo are
381395
trademarks and/or registered trademarks of Valve Corporation in the U.S.
382396
and/or other countries.
383397

384398
[3n]: https://github.com/alinmear/docker-conanexiles/blob/master/src/etc/supervisor/conf.d/conanexiles.conf
385399
[2k]: https://docs.docker.com/compose/compose-file/#stop_grace_period
400+
[6h]: https://developer.valvesoftware.com/wiki/SteamCMD
386401
[f8]: https://raw.githubusercontent.com/r-pufky/steam/master/media/steam-icon-logo.png

docs/examples/conan-exiles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ and handling gracefully in coordination with `stop_grace_period`.
5555
#
5656
# Runs as root. Drop privileges.
5757
#
58-
# Capture kill/term signals and send SIGINT to gracefully shutdown conan server.
58+
# Capture kill/term signal and send SIGINT to gracefully shutdown conan server.
5959
PROCESS_WAIT_TIME=25
6060
WATCHDOG_TIME=300
6161

@@ -76,7 +76,7 @@ function shutdown() {
7676
trap shutdown SIGINT SIGKILL SIGTERM
7777

7878
function start_server() {
79-
su steam -c "xvfb-run --auto-servernum wine64 ${SERVER_DIR}/ConanSandbox/Binaries/Win64/ConanSandboxServer-Win64-Test.exe -nosteamclient -game -server -log"
79+
su - steam -c "xvfb-run --auto-servernum wine64 ${SERVER_DIR}/ConanSandbox/Binaries/Win64/ConanSandboxServer-Win64-Test.exe -nosteamclient -game -server -log"
8080
}
8181

8282
function watch_server() {

docs/examples/left-4-dead-2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Left 4 Dead 2
2-
Dedicated Linux server example running Left 4 Dead 2 with sourcemod and metamod.
2+
Dedicated Linux server example running Left 4 Dead 2 with sourcemod & metamod.
33

44
Assumes all files are based in `/d/games/l4d2` and have
55
`UID/GID` of `50520`.
@@ -57,7 +57,7 @@ directory` error.
5757
# Runs as root. Drop privileges.
5858
#
5959
ln -s /d/games/l4d2/server.cfg /d/games/l4d2/data/server/left4dead2/cfg/server.cfg 2> /dev/null
60-
su steam -c "/data/server/srcds_run -console -game left4dead2 -map c1m1_hotel -port 27015 +maxplayers 4 -nohltv +exec /data/server/left4dead2/cfg/server.cfg -pidfile /data/server/l4d2.pid"
60+
su - steam -c "/data/server/srcds_run -console -game left4dead2 -map c1m1_hotel -port 27015 +maxplayers 4 -nohltv +exec /data/server/left4dead2/cfg/server.cfg -pidfile /data/server/l4d2.pid"
6161
```
6262

6363
### Add custom server configuration.

docs/examples/left-4-dead.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Left 4 Dead
2-
Dedicated Linux server example running Left 4 Dead with sourcemod and metamod.
2+
Dedicated Linux server example running Left 4 Dead with sourcemod & metamod.
33

44
Assumes all files are based in `/d/games/l4d` and have
55
`UID/GID` of `50510`.
@@ -58,7 +58,7 @@ directory` error.
5858
# Runs as root. Drop privileges.
5959
#
6060
ln -s /d/games/l4d/server.cfg /d/games/l4d/data/server/left4dead/cfg/server.cfg 2> /dev/null
61-
su steam -c "/data/server/srcds_run -console -game left4dead -map l4d_hospital01_apartment -port 27015 +maxplayers 4 -nohltv +exec /data/server/left4dead/cfg/server.cfg -pidfile /data/server/l4d.pid"
61+
su - steam -c "/data/server/srcds_run -console -game left4dead -map l4d_hospital01_apartment -port 27015 +maxplayers 4 -nohltv +exec /data/server/left4dead/cfg/server.cfg -pidfile /data/server/l4d.pid"
6262
```
6363

6464
### Add custom server configuration.

source/startup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CUSTOM=/data/custom_server
66

7-
set -x -e
7+
set -u -e
88
echo '--------------------------------------'
99
echo 'Propagating steam user permissions ...'
1010
PUID=${PUID:-911}

0 commit comments

Comments
 (0)