-
Notifications
You must be signed in to change notification settings - Fork 4
/
user-data.tplt
326 lines (265 loc) · 9.33 KB
/
user-data.tplt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
#!/bin/bash -xe
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
sudo -- sh -c 'dpkg --add-architecture i386; add-apt-repository multiverse; apt-get update; apt-get -y dist-upgrade'
echo steam steam/question select "I AGREE" | sudo debconf-set-selections
echo steam steam/license note '' | sudo debconf-set-selections
sudo apt install -y curl wget file tar gdb bzip2 gzip unzip bsdmainutils \
python util-linux ca-certificates binutils bc jq tmux netcat \
lib32gcc1 lib32stdc++6 steamcmd
sudo apt install -y libsdl2-2.0-0:i386
cat << EOF >> /etc/sysctl.conf
fs.file-max=5370890
fs.aio-max-nr=1048576
kernel.printk=4 4 1 7
kernel.panic=10
kernel.panic_on_oops=10
net.core.netdev_max_backlog=30000
net.core.rmem_max=16777216
net.core.somaxconn=50000
net.core.wmem_max=16777216
net.ipv4.tcp_fin_timeout=4
net.ipv4.tcp_keepalive_time=30
net.ipv4.tcp_max_orphans=512000
net.ipv4.tcp_max_syn_backlog=262144
net.ipv4.tcp_mem=50576 64768 98152
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_orphan_retries=2
net.ipv4.tcp_retries2=8
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_max_syn_backlog=4096
net.ipv4.tcp_syncookies=1
net.ipv4.ip_local_port_range=1024 6553
vm.dirty_ratio=10
vm.swappiness=1
vm.overcommit_memory=1
EOF
sysctl -p
sudo -i -u ubuntu -- sh -c "wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh csgoserver"
sudo -i -u ubuntu ./csgoserver install << EOF
Y
Y
${STEAM_TOKEN}
n
EOF
sudo -i -u ubuntu -- sh -c "./csgoserver start"
sudo -i -u ubuntu cp /home/ubuntu/serverfiles/csgo/cfg/csgoserver.cfg{,.orig}
cat <<EOF | sudo -i -u ubuntu tee /home/ubuntu/serverfiles/csgo/cfg/csgoserver.cfg
hostname "${HOSTNAME}"
rcon_password "${PASSWORD}" // Remote Console password
sv_password "${PASSWORD}" // Private password
sv_contact ""
sv_lan 0 // No LAN
sv_cheats 0 // No Cheats
sv_tags "${TAGS}" // Custom tags
sv_region 3 // Europe
log ${LOGGING}
// Log bans - Log server bans in the server logs.
// Default: sv_logbans 1
// Recommended: sv_logbans 1
sv_logbans 0
// Log echo - Display log information to the server console.
// Default: sv_logecho 1
// Recommended: sv_logecho 1
sv_logecho 1
// Log file - Log server information in the log file.
// Default: sv_logfile 1
// Recommended: sv_logfile 1
sv_logfile 1
// One file log - Log server information to only one file.
// Default: sv_log_onefile 0
// Recommended: sv_log_onefile 0
sv_log_onefile 0
// Server Hibernation
sv_hibernate_when_empty 1
sv_hibernate_ms 5
// ............................. Server Query ............................. //
// More info at: https://www.gametracker.com/games/csgo/forum.php?thread=91691
host_name_store 1
host_info_show 1
host_players_show 2
// ................................ Ban List ................................ //
// User ban - Server banlist based on user steam ID.
// Recommended: exec banned_user.cfg
exec banned_user.cfg
// IP ban - Server banlist based on user IP.
// Recommended: exec banned_ip.cfg
exec banned_ip.cfg
// Write ID - Writes a list of permanently-banned user IDs to banned_user.cfg.
writeid
// Write IP - Save the ban list to banned_ip.cfg.
writeip
EOF
sudo -i -u ubuntu cp /home/ubuntu/lgsm/config-default/config-lgsm/csgoserver/_default.cfg{,.orig}
cat <<EOF | sudo -i -u ubuntu tee /home/ubuntu/lgsm/config-default/config-lgsm/csgoserver/_default.cfg
#### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
# https://docs.linuxgsm.com/game-servers/counter-strike-global-offensive
# [Game Modes] gametype gamemode mapgroup (you can mix these across all Game Modes except Danger Zone, but use only one)
# Arms Race 1 0 mg_armsrace
# Classic Casual 0 0 mg_casualsigma, mg_casualdelta
# Classic Competitive 0 1 mg_active, mg_reserves, mg_hostage, mg_de_dust2
# Custom 3 0
# Deathmatch 1 2 mg_deathmatch
# Demolition 1 1 mg_demolition
# Wingman 0 2
# Danger Zone 6 0 mg_dz_blacksite (map: dz_blacksite), mg_dz_sirocco (map: dz_sirocco)
gametype="${GAME_TYPE}"
gamemode="${GAME_MODE}"
mapgroup="mg_active"
ip="0.0.0.0"
port="27015"
clientport="27005"
sourcetvport="27020"
defaultmap="${DEFAULT_MAP}"
maxplayers="${MAX_PLAYERS}"
tickrate="64"
## Game Server Login Token (GSLT): Required
# GSLT is required for running a public server.
# More info: https://docs.linuxgsm.com/steamcmd/gslt
gslt=""
## Workshop Parameters | https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
# To get an API key visit - https://steamcommunity.com/dev/apikey
wsapikey=""
wscollectionid=""
wsstartmap=""
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
fn_parms(){
parms="-game csgo -usercon -strictportbind -ip \$${ip} -port \$${port} +clientport \$${clientport} +tv_port \$${sourcetvport} +sv_setsteamaccount \$${gslt} -tickrate \$${tickrate} +map \$${defaultmap} +servercfgfile \$${servercfg} -maxplayers_override \$${maxplayers} +mapgroup \$${mapgroup} +game_type \$${gametype} +game_mode \$${gamemode} +host_workshop_collection \$${wscollectionid} +workshop_start_map \$${wsstartmap} -authkey \$${wsapikey} -nobreakpad"
}
#### LinuxGSM Settings ####
## LinuxGSM Stats
# Send useful stats to LinuxGSM developers.
# https://docs.linuxgsm.com/configuration/linuxgsm-stats
# (on|off)
stats="off"
## Notification Alerts
# (on|off)
# Display IP | https://docs.linuxgsm.com/alerts#display-ip
displayip=""
# More info | https://docs.linuxgsm.com/alerts#more-info
postalert="off"
# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
discordalert="off"
discordwebhook="webhook"
# Email Alerts | https://docs.linuxgsm.com/alerts/email
emailalert="off"
email="email@example.com"
emailfrom=""
# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
iftttalert="off"
ifttttoken="accesstoken"
iftttevent="linuxgsm_alert"
# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
mailgunalert="off"
mailgunapiregion="us"
mailguntoken="accesstoken"
mailgundomain="example.com"
mailgunemailfrom="alert@example.com"
mailgunemail="email@myemail.com"
# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
pushbulletalert="off"
pushbullettoken="accesstoken"
channeltag=""
# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
pushoveralert="off"
pushovertoken="accesstoken"
pushoveruserkey="userkey"
# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
rocketchatalert="off"
rocketchatwebhook="webhook"
rocketchattoken=""
# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
slackalert="off"
slackwebhook="webhook"
# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring".
# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help".
telegramalert="off"
telegramtoken="accesstoken"
telegramchatid=""
curlcustomstring=""
## Updating | https://docs.linuxgsm.com/commands/update
updateonstart="off"
## Backup | https://docs.linuxgsm.com/commands/backup
maxbackups="4"
maxbackupdays="10"
stoponbackup="on"
## Logging | https://docs.linuxgsm.com/features/logging
consolelogging="off"
logdays="7"
## Monitor | https://docs.linuxgsm.com/commands/monitor
# Query delay time
querydelay="1"
## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
ansi="on"
#### Advanced Settings ####
## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
sleeptime="0.5"
## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd
# Server appid
appid="740"
# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
branch=""
betapassword=""
# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
steammaster="true"
## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
# 1: tmux kill
# 2: CTRL+c
# 3: quit
# 4: quit 120s
# 5: stop
# 6: q
# 7: exit
# 8: 7 Days to Die
# 9: GoldSrc
# 10: Avorion
# 11: end
stopmode="3"
## Query mode
# 1: session only
# 2: gamedig (gsquery fallback)
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="2"
querytype="protocol-valve"
## Console type
consoleverbose="yes"
consoleinteract="yes"
## Game Server Details
# Do not edit
gamename="Counter-Strike: Global Offensive"
engine="source"
glibc="2.15"
#### Directories ####
# Edit with care
## Game Server Directories
systemdir="\$${serverfiles}/csgo"
executabledir="\$${serverfiles}"
executable="./srcds_run"
servercfgdir="\$${systemdir}/cfg"
servercfg="\$${selfname}.cfg"
servercfgdefault="server.cfg"
servercfgfullpath="\$${servercfgdir}/\$${servercfg}"
## Backup Directory
backupdir="\$${lgsmdir}/backup"
## Logging Directories
logdir="\$${rootdir}/log"
gamelogdir="\$${systemdir}/logs"
lgsmlogdir="\$${logdir}/script"
consolelogdir="\$${logdir}/console"
lgsmlog="\$${lgsmlogdir}/\$${selfname}-script.log"
consolelog="\$${consolelogdir}/\$${selfname}-console.log"
alertlog="\$${lgsmlogdir}/\$${selfname}-alert.log"
postdetailslog="\$${lgsmlogdir}/\$${selfname}-postdetails.log"
## Logs Naming
lgsmlogdate="\$${lgsmlogdir}/\$${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="\$${consolelogdir}/\$${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
EOF
sudo -i -u ubuntu -- sh -c "./csgoserver restart"