-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathcloud-config.yaml
97 lines (89 loc) · 3.42 KB
/
cloud-config.yaml
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
#cloud-config
# This config is an example of of a one-liner to getting a CSGO server up-and-running
# in just a few minutes on Google Compute Engine with the following one-liner that consumes
# the uncommented parts of this file:
#
# gcloud compute instances create csgo-server \
# --project=$PROJECT \
# --zone=$ZONE \
# --image-family=cos-stable \
# --image-project=cos-cloud \
# --boot-disk-size=50GB \
# --machine-type=c2-standard-4 \
# --network=default \
# --metadata-from-file user-data=$(PWD)/cloud-config.yaml
write_files:
- path: /etc/systemd/system/dynamic-dns.service
permissions: 0644
owner: root
content: |
# /etc/systemd/system/dynamic-dns.service
[Unit]
Description=Updates dynamic DNS record
Wants=dynamic-dns.timer
[Service]
ExecStart=/bin/sh -c '(\
export PUBLIC_IP=$$(\
/usr/bin/curl \
-s \
-H "Metadata-Flavor: Google" \
https://domains.google.com/checkip \
) && \
/usr/bin/curl \
-s \
--user <username>:<password> \
"https://domains.google.com/nic/update?hostname=<hostname>&myip=$${PUBLIC_IP}" \
)'
- path: /etc/systemd/system/dynamic-dns.timer
permissions: 0644
owner: root
content: |
# /etc/systemd/system/dynamic-dns.timer
[Unit]
Description=Runs dynamic-dns.service every 15 minutes
Requires=dynamic-dns.timer
[Timer]
Unit=dynamic-dns.service
OnUnitInactiveSec=15m
- path: /etc/systemd/system/csgods.service
permissions: 0644
owner: root
content: |
[Unit]
Description=CSGO Dedicated Server Container
After=docker.service
Requires=docker.service
[Service]
StandardInput=tty-force
ExecStartPre=/usr/bin/docker pull kmallea/csgo
ExecStart=/usr/bin/docker run --name %n \
--interactive \
--tty \
--rm \
--network host \
--cpuset-cpus 3 \
--mount source=csgo-data,target=/home/steam/csgo \
-e "SERVER_HOSTNAME=Counter-Strike: Global Offensive Dedicated Server" \
-e "SERVER_PASSWORD=" \
-e "RCON_PASSWORD=changeme" \
-e "STEAM_ACCOUNT=changeme" \
-e "SOURCEMOD_ADMINS=STEAM_1:0:123456,STEAM_1:1:654321" \
-e "AUTHKEY=changeme" \
-e "FPS_MAX=1000" \
kmallea/csgo
ExecStop=-/usr/bin/docker stop %n
ExecStopPost=-/usr/bin/docker rm %n
runcmd:
- iptables -w -A INPUT -p tcp --dport 27015 -j ACCEPT
- iptables -w -A INPUT -p udp --dport 27015 -j ACCEPT
- iptables -w -A INPUT -p tcp --dport 27020 -j ACCEPT
- iptables -w -A INPUT -p udp --dport 27020 -j ACCEPT
- iptables -w -A INPUT -p udp --dport 27005 -j ACCEPT
- iptables -w -A INPUT -p udp --dport 51840 -j ACCEPT
- iptables -w -A INPUT -p tcp --dport 26900 -j ACCEPT
- iptables -w -A INPUT -p tcp --dport 80 -j ACCEPT
- iptables -w -A INPUT -p tcp --dport 443 -j ACCEPT
- systemctl daemon-reload
- systemctl enable dynamic-dns.timer
- systemctl start dynamic-dns.service
- systemctl start csgods.service