4 Commits

Author SHA1 Message Date
f9a2f5bdb0 Fix bzp99 gitea user to bp99 2025-05-06 23:42:05 +02:00
6a7195e6da Adapt containerization to urban terror 2025-05-06 23:23:56 +02:00
dd2c9160aa Adapt example configs to urban terror 2025-05-06 23:23:40 +02:00
21d1628b26 Adapt code to urban terror 2025-05-06 23:23:26 +02:00
7 changed files with 75 additions and 103 deletions

View File

@ -1,4 +1,4 @@
FROM golang:1.13 as builder
FROM golang:1.13 AS builder
WORKDIR /workspace
COPY go.mod go.mod
@ -14,17 +14,21 @@ COPY public public/
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on taskset -c 1 /usr/local/go/bin/go build -a -o q3 ./cmd/q3
FROM alpine:3.12 as quake-n-bake
RUN apk add --no-cache git gcc make libc-dev
RUN git clone https://github.com/ioquake/ioq3
RUN cd /ioq3 && make BUILD_MISSIONPACK=0 BUILD_BASEGAME=0 BUILD_CLIENT=0 BUILD_SERVER=1 BUILD_GAME_SO=0 BUILD_GAME_QVM=0 BUILD_RENDERER_OPENGL2=0 BUILD_STANDALONE=1
RUN cp /ioq3/build/release-linux-$(uname -m)/ioq3ded.$(uname -m) /usr/local/bin/ioq3ded
FROM alpine:3 AS urt-download
FROM alpine:3.12
WORKDIR /ut/
RUN apk add --no-cache libxml2-utils=2.13.4-r5 curl=8.12.1-r1 bash=5.2.37-r0
COPY updater-cfg ./
RUN curl -sSLO 'https://raw.githubusercontent.com/FrozenSand/UrTUpdater/master/ded/UrTUpdater_Ded.sh' && bash ./UrTUpdater_Ded.sh -q
COPY --from=builder /workspace/q3 /usr/local/bin
COPY --from=quake-n-bake /usr/local/bin/ioq3ded /usr/local/bin
COPY --from=quake-n-bake /lib/ld-musl-*.so.1 /lib
FROM alpine:3
RUN apk add --no-cache gcompat=1.1.0-r4
COPY --from=builder /workspace/q3 /usr/local/bin/
COPY --from=urt-download /ut/Quake3-UrT-Ded.x86_64 /usr/local/bin/
COPY --from=urt-download /ut/q3ut4/ /root/.q3a/q3ut4/
# ENTRYPOINT ["/bin/sh"]
ENTRYPOINT ["/usr/local/bin/q3"]

View File

@ -4,16 +4,16 @@ import (
"context"
"fmt"
"github.com/criticalstack/quake-kube/pkg/extensions"
"net/url"
// "net/url"
"time"
"github.com/pkg/errors"
"github.com/spf13/cobra"
quakeclient "github.com/criticalstack/quake-kube/internal/quake/client"
"github.com/criticalstack/quake-kube/internal/quake/content"
// "github.com/criticalstack/quake-kube/internal/quake/content"
quakeserver "github.com/criticalstack/quake-kube/internal/quake/server"
httputil "github.com/criticalstack/quake-kube/internal/util/net/http"
// httputil "github.com/criticalstack/quake-kube/internal/util/net/http"
"github.com/criticalstack/quake-kube/public"
)
@ -37,22 +37,22 @@ func NewCommand() *cobra.Command {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
csurl, err := url.Parse(opts.ContentServer)
if err != nil {
return err
}
// csurl, err := url.Parse(opts.ContentServer)
// if err != nil {
// return err
// }
if !opts.AcceptEula {
fmt.Println(quakeserver.Q3DemoEULA)
return errors.New("You must agree to the EULA to continue")
}
if err := httputil.GetUntil(opts.ContentServer, ctx.Done()); err != nil {
return err
}
// if err := httputil.GetUntil(opts.ContentServer, ctx.Done()); err != nil {
// return err
// }
// TODO(chrism): only download what is in map config
if err := content.CopyAssets(csurl, opts.AssetsDir); err != nil {
return err
}
// if err := content.CopyAssets(csurl, opts.AssetsDir); err != nil {
// return err
// }
go func() {
s := quakeserver.Server{

View File

@ -3,32 +3,20 @@ timeLimit: 15m
bot:
minPlayers: 3
game:
motd: "Welcome to Critical Stack"
motd: "Welcome to my UrT Server"
type: FreeForAll
forceRespawn: false
inactivity: 10m
#password: "letmein"
quadFactor: 3
weaponRespawn: 3
# password: "letmein"
server:
hostname: "quakekube"
maxClients: 16
password: "changeme"
# password: "changeme"
commands:
- addbot sarge 2
maps:
- name: q3dm7
- name: ut4_uptown
type: FreeForAll
timeLimit: 10m
- name: q3dm17
- name: ut4_swim
type: FreeForAll
- name: q3wctf1
type: CaptureTheFlag
captureLimit: 8
- name: q3tourney2
type: Tournament
- name: q3wctf3
type: CaptureTheFlag
captureLimit: 8
- name: ztn3tourney1
type: Tournament

View File

@ -1,16 +1,16 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: quake
name: urbanterror
spec:
selector:
matchLabels:
run: quake
run: urbanterror
replicas: 1
template:
metadata:
labels:
run: quake
run: urbanterror
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '8080'
@ -22,7 +22,7 @@ spec:
- --config=/config/config.yaml
- --content-server=http://127.0.0.1:9090
- --agree-eula
image: docker.io/criticalstack/quake:latest
image: gitea.bp99.eu/bp99/urban-terror-server:latest
name: server
ports:
- containerPort: 8080
@ -32,36 +32,36 @@ spec:
initialDelaySeconds: 15
periodSeconds: 5
volumeMounts:
- name: quake3-server-config
- name: server-config
mountPath: /config
- name: quake3-content
- name: content
mountPath: /assets
- command:
- q3
- content
- --seed-content-url=http://content.quakejs.com
image: docker.io/criticalstack/quake:latest
image: gitea.bp99.eu/bp99/urban-terror-server:latest
name: content-server
ports:
- containerPort: 9090
volumeMounts:
- name: quake3-content
- name: content
mountPath: /assets
volumes:
- name: quake3-server-config
- name: server-config
configMap:
name: quake3-server-config
- name: quake3-content
name: server-config
- name: content
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: quake
name: urbanterror
spec:
type: NodePort
selector:
run: quake
run: urbanterror
ports:
- port: 8080
targetPort: 8080
@ -79,7 +79,7 @@ spec:
apiVersion: v1
kind: ConfigMap
metadata:
name: quake3-server-config
name: server-config
data:
config.yaml: |
fragLimit: 25
@ -87,31 +87,19 @@ data:
bot:
minPlayers: 3
game:
motd: "Welcome to Critical Stack"
motd: "Welcome to my Urban Terror server"
type: FreeForAll
forceRespawn: false
inactivity: 10m
quadFactor: 3
weaponRespawn: 3
server:
hostname: "quakekube"
maxClients: 12
password: "changeme"
# password: "changeme"
commands:
- addbot sarge 2
maps:
- name: q3dm7
- name: ut4_uptown
type: FreeForAll
timeLimit: 10m
- name: q3dm17
- name: ut4_swim
type: FreeForAll
- name: q3wctf1
type: CaptureTheFlag
captureLimit: 8
- name: q3tourney2
type: Tournament
- name: q3wctf3
type: CaptureTheFlag
captureLimit: 8
- name: ztn3tourney1
type: Tournament

View File

@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: quake3-server-config
name: server-config
data:
config.yaml: |
fragLimit: 25
@ -10,39 +10,27 @@ data:
bot:
minPlayers: 3
game:
motd: "Welcome to Critical Stack"
motd: "Welcome to my Urban Terror server"
type: FreeForAll
forceRespawn: false
inactivity: 10m
quadFactor: 3
weaponRespawn: 3
server:
hostname: "quakekube"
maxClients: 12
password: "changeme"
# password: "changeme"
commands:
- addbot sarge 2
maps:
- name: q3dm7
- name: ut4_uptown
type: FreeForAll
timeLimit: 10m
- name: q3dm17
- name: ut4_swim
type: FreeForAll
- name: q3wctf1
type: CaptureTheFlag
captureLimit: 8
- name: q3tourney2
type: Tournament
- name: q3wctf3
type: CaptureTheFlag
captureLimit: 8
- name: ztn3tourney1
type: Tournament
---
apiVersion: "agones.dev/v1"
kind: Fleet
metadata:
name: octops
name: urbanterror
labels:
cluster: gke-1.17
region: us-east-1
@ -74,7 +62,7 @@ spec:
containers:
- name: gameserver
imagePullPolicy: Always
image: octops/quake:latest
image: gitea.bp99.eu/bp99/urban-terror-server:latest
command:
- q3
- server
@ -98,13 +86,13 @@ spec:
memory: "2Gi"
cpu: "1"
volumeMounts:
- name: quake3-server-config
- name: server-config
mountPath: /config
- name: quake3-content
- name: content
mountPath: /assets
- name: content-server
imagePullPolicy: Always
image: octops/quake:latest
image: gitea.bp99.eu/bp99/urban-terror-server:latest
command:
- q3
- content
@ -119,11 +107,11 @@ spec:
memory: "2Gi"
cpu: "1"
volumeMounts:
- name: quake3-content
- name: content
mountPath: /assets
volumes:
- name: quake3-server-config
- name: server-config
configMap:
name: quake3-server-config
- name: quake3-content
emptyDir: {}
name: server-config
- name: content
emptyDir: {}

View File

@ -32,15 +32,15 @@ func (s *Server) Start(ctx context.Context) error {
return err
}
args := []string{
"+set", "dedicated", "1",
"+set", "dedicated", "2",
"+set", "net_ip", host,
"+set", "net_port", port,
"+set", "com_homepath", s.Dir,
"+set", "com_basegame", "baseq3",
"+set", "com_gamename", "Quake3Arena",
"+set", "com_basegame", "q3ut4",
"+set", "com_gamename", "UrbanTerror",
"+exec", "server.cfg",
}
cmd := exec.CommandContext(ctx, "ioq3ded", args...)
cmd := exec.CommandContext(ctx, "Quake3-UrT-Ded.x86_64", args...)
cmd.Dir = s.Dir
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
@ -51,7 +51,7 @@ func (s *Server) Start(ctx context.Context) error {
if err != nil {
return err
}
if err := ioutil.WriteFile(filepath.Join(s.Dir, "baseq3/server.cfg"), data, 0644); err != nil {
if err := ioutil.WriteFile(filepath.Join(s.Dir, "q3ut4/server.cfg"), data, 0644); err != nil {
return err
}
if err := cmd.Start(); err != nil {
@ -145,7 +145,7 @@ func (s *Server) reload() error {
if err != nil {
return err
}
return ioutil.WriteFile(filepath.Join(s.Dir, "baseq3/server.cfg"), data, 0644)
return ioutil.WriteFile(filepath.Join(s.Dir, "q3ut4/server.cfg"), data, 0644)
}
func (s *Server) watch(ctx context.Context) (<-chan struct{}, error) {

4
updater-cfg Normal file
View File

@ -0,0 +1,4 @@
CURRENTVERSION=${CURRENTVERSION:-1}
DOWNLOADSERVER=${DOWNLOADSERVER:-2}
GAMEENGINE=${GAMEENGINE:-1}
ASKBEFOREUPDATING=${ASKBEFOREUPDATING:-1}