Skip to content

Commit b5a0da3

Browse files
committed
Implement comprehensive TODO items: telemetry, deployment, logging, config
Telemetry System: - Implement CSVMetricsReporter, MemoryMetricsReporter, AlertMetricsReporter - Integrate telemetry init/shutdown in main.cpp with all reporter types - Add telemetry hooks in NetworkManager, ConnectionManager, GameMode - Add scoped performance timing in GameServer::Run() (frame/physics/network/game) - Add security violation telemetry in SecurityManager, EAC, MovementValidator, AntiCheatManager Logger Enhancements: - Add structured JSON logging mode (SetStructuredLogging) - Implement log rotation with configurable max file size and count - Add remote log shipping capability with async buffer Configuration System: - Add live config file watching with background thread (StartFileWatcher) - Implement config backup (timestamped) and rollback system - Add GetAvailableBackups for listing backup history Deployment Infrastructure: - Create multi-stage Dockerfile (build + runtime) - Add docker-compose.yml with server, Prometheus, and Grafana services - Create Kubernetes manifests (namespace, configmap, deployment, service, PVCs) - Add Prometheus scrape config and Grafana dashboard provisioning - Create comprehensive Grafana dashboard (players, performance, network, security) CI/CD Pipeline: - Add GitHub Actions CI workflow with Linux (gcc/clang) and Windows builds - Include cppcheck static analysis and Docker build verification Bug Fixes: - Fix shared_ptr cast to void* in NetworkManager/ConnectionManager - Fix m_nextClientId.load() on non-atomic type in EACServerEmulator - Fix const char* .c_str() calls in RPCHandler Update TODO.md to reflect all completed items. https://claude.ai/code/session_01SifZjUsmG24DedxrnwgFg8
1 parent 6440186 commit b5a0da3

29 files changed

Lines changed: 2792 additions & 215 deletions

.github/workflows/ci.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
BUILD_TYPE: Release
14+
15+
jobs:
16+
build-linux:
17+
name: Build (Linux)
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
compiler: [gcc, clang]
22+
include:
23+
- compiler: gcc
24+
cc: gcc-12
25+
cxx: g++-12
26+
- compiler: clang
27+
cc: clang-15
28+
cxx: clang++-15
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Install dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y \
38+
cmake \
39+
ninja-build \
40+
libssl-dev \
41+
zlib1g-dev \
42+
${{ matrix.compiler == 'clang' && 'clang-15' || '' }}
43+
44+
- name: Configure CMake
45+
env:
46+
CC: ${{ matrix.cc }}
47+
CXX: ${{ matrix.cxx }}
48+
run: |
49+
cmake -B build \
50+
-G Ninja \
51+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
52+
-DENABLE_TELEMETRY=ON \
53+
-DENABLE_SCRIPTING=OFF \
54+
-DENABLE_COMPRESSION=ON \
55+
-DBUILD_TESTS=ON
56+
57+
- name: Build
58+
run: cmake --build build --parallel $(nproc)
59+
60+
- name: Run tests
61+
working-directory: build
62+
run: ctest --output-on-failure --timeout 120
63+
64+
- name: Upload build artifact
65+
if: matrix.compiler == 'gcc'
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: rs2v-server-linux
69+
path: build/rs2v_server
70+
retention-days: 7
71+
72+
build-windows:
73+
name: Build (Windows)
74+
runs-on: windows-latest
75+
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
80+
- name: Configure CMake
81+
run: |
82+
cmake -B build `
83+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
84+
-DENABLE_TELEMETRY=ON `
85+
-DENABLE_SCRIPTING=OFF `
86+
-DENABLE_COMPRESSION=ON `
87+
-DBUILD_TESTS=ON
88+
89+
- name: Build
90+
run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
91+
92+
- name: Run tests
93+
working-directory: build
94+
run: ctest -C ${{ env.BUILD_TYPE }} --output-on-failure --timeout 120
95+
96+
- name: Upload build artifact
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: rs2v-server-windows
100+
path: build/${{ env.BUILD_TYPE }}/rs2v_server.exe
101+
retention-days: 7
102+
103+
static-analysis:
104+
name: Static Analysis
105+
runs-on: ubuntu-latest
106+
needs: build-linux
107+
108+
steps:
109+
- name: Checkout code
110+
uses: actions/checkout@v4
111+
112+
- name: Install cppcheck
113+
run: sudo apt-get update && sudo apt-get install -y cppcheck
114+
115+
- name: Run cppcheck
116+
run: |
117+
cppcheck \
118+
--enable=warning,performance,portability \
119+
--suppress=missingIncludeSystem \
120+
--inline-suppr \
121+
--error-exitcode=1 \
122+
-I src/ -I include/ -I telemetry/ \
123+
--std=c++17 \
124+
src/ telemetry/
125+
126+
docker:
127+
name: Docker Build
128+
runs-on: ubuntu-latest
129+
needs: build-linux
130+
131+
steps:
132+
- name: Checkout code
133+
uses: actions/checkout@v4
134+
135+
- name: Set up Docker Buildx
136+
uses: docker/setup-buildx-action@v3
137+
138+
- name: Build Docker image
139+
uses: docker/build-push-action@v6
140+
with:
141+
context: .
142+
push: false
143+
tags: rs2v-server:${{ github.sha }}
144+
cache-from: type=gha
145+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# RS2V Server - Multi-stage Docker build
2+
# Stage 1: Build
3+
FROM ubuntu:22.04 AS builder
4+
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
RUN apt-get update && apt-get install -y \
8+
build-essential \
9+
cmake \
10+
libssl-dev \
11+
zlib1g-dev \
12+
git \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
WORKDIR /build
16+
17+
# Copy source code
18+
COPY CMakeLists.txt ./
19+
COPY src/ src/
20+
COPY include/ include/
21+
COPY telemetry/ telemetry/
22+
COPY config/ config/
23+
COPY data/ data/
24+
25+
# Build release
26+
RUN mkdir -p build && cd build && \
27+
cmake .. \
28+
-DCMAKE_BUILD_TYPE=Release \
29+
-DENABLE_TELEMETRY=ON \
30+
-DENABLE_SCRIPTING=OFF \
31+
-DENABLE_COMPRESSION=ON \
32+
-DBUILD_TESTS=OFF && \
33+
cmake --build . --parallel $(nproc) && \
34+
cmake --install . --prefix /install
35+
36+
# Stage 2: Runtime
37+
FROM ubuntu:22.04 AS runtime
38+
39+
ENV DEBIAN_FRONTEND=noninteractive
40+
41+
RUN apt-get update && apt-get install -y \
42+
libssl3 \
43+
zlib1g \
44+
ca-certificates \
45+
&& rm -rf /var/lib/apt/lists/* \
46+
&& useradd -r -s /bin/false -m rs2v
47+
48+
WORKDIR /opt/rs2v
49+
50+
# Copy built binary and configuration
51+
COPY --from=builder /install/bin/rs2v_server ./bin/
52+
COPY --from=builder /install/etc/rs2v/ ./config/
53+
COPY --from=builder /install/share/rs2v/data/ ./data/
54+
55+
# Create required directories
56+
RUN mkdir -p logs telemetry/output protocol_analysis && \
57+
chown -R rs2v:rs2v /opt/rs2v
58+
59+
# Environment configuration
60+
ENV RS2V_CONFIG_FILE=/opt/rs2v/config/server.ini
61+
ENV RS2V_LOG_DIR=/opt/rs2v/logs
62+
ENV RS2V_TELEMETRY_DIR=/opt/rs2v/telemetry/output
63+
64+
# Expose game port, query port, EAC port, Prometheus metrics
65+
EXPOSE 7777/udp 27015/udp 7957/tcp 9090/tcp
66+
67+
# Health check
68+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
69+
CMD test -f /opt/rs2v/logs/*.log || exit 1
70+
71+
USER rs2v
72+
73+
ENTRYPOINT ["./bin/rs2v_server"]
74+
CMD ["-c", "config/server.ini"]

0 commit comments

Comments
 (0)