Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e682e0b
Fusionのリージョン設定を一致させる
reigithub Apr 3, 2026
6870c3f
ビルド設定見直し
reigithub Apr 3, 2026
8666e0f
Playmode判定修正
reigithub Apr 3, 2026
e7b4b97
サーバープロセス接続設定
reigithub Apr 3, 2026
778fd81
ローカルサーバー起動設定
reigithub Apr 3, 2026
bc365f3
リネーム: UnityServerConfiguration
reigithub Apr 3, 2026
b38315f
Unityサーバーデプロイ設定
reigithub Apr 4, 2026
ba3c4fe
UnityServer接続情報と認証
reigithub Apr 4, 2026
7fbe0d7
リネーム
reigithub Apr 4, 2026
3abb423
本番デプロイ環境変数
reigithub Apr 4, 2026
f16cafc
MPPM設定追加
reigithub Apr 5, 2026
50b5b95
NuGet.config.meta
reigithub Apr 5, 2026
9dee2ed
Unityサーバー認証
reigithub Apr 5, 2026
545df65
Unityサーバー認証テスト
reigithub Apr 5, 2026
6efe4ad
Unityサーバー認証クライアント実装
reigithub Apr 5, 2026
7e8d16d
起動済みサーバーへのセッション割り当て
reigithub Apr 9, 2026
f75dad1
Linuxサーバービルドプロファイル
reigithub Apr 9, 2026
1f479da
LinuxサーバービルドDockerテスト設定
reigithub Apr 9, 2026
9f0fc5e
ポーズエラー対応
reigithub Apr 9, 2026
28244ee
プロジェクト設定
reigithub Apr 9, 2026
69f3926
手動ストリップ対策
reigithub Apr 9, 2026
0ae114c
手動ストリップ対策: ツール
reigithub Apr 9, 2026
a78355c
手動ストリップ対策: プレハブ
reigithub Apr 9, 2026
6ac9092
エネミーコンポーネント責務分離
reigithub Apr 9, 2026
03e718c
エネミーコンポーネント責務分離: プレハブ
reigithub Apr 9, 2026
c09ef1c
アイテムコンポーネント責務分離
reigithub Apr 9, 2026
9879b0a
プレイヤー初期化の責務分離
reigithub Apr 9, 2026
ac886e0
武器のサーバー権威を強化
reigithub Apr 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ARCHITECTURE.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ A shared foundation library used by both the REST API server (Game.Server) and r
|---------|-------------|
| JWT Authentication | Common auth middleware configuration (token validation, userId extraction) |
| Health Check | Shared `/health` endpoint implementation |
| Configuration | Common configuration classes such as GameServerConfiguration |
| Configuration | Common configuration classes such as UnityServerConfiguration |
| Extensions | Utilities like userId extraction from ClaimsPrincipal |

### 3.4 Inter-Project Dependencies
Expand Down
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ REST APIサーバー(Game.Server)とリアルタイムサーバー(Game.Re
|-----|------|
| JWT認証 | 共通の認証ミドルウェア設定(トークン検証、userId抽出) |
| ヘルスチェック | `/health` エンドポイント共通実装 |
| 設定クラス | GameServerConfiguration 等の共通設定 |
| 設定クラス | UnityServerConfiguration 等の共通設定 |
| 拡張メソッド | ClaimsPrincipal からの userId 取得など |

### 3.4 プロジェクト間依存関係
Expand Down
4 changes: 4 additions & 0 deletions docker/game-realtime/prod/deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ if (-not $BuildOnly) {
if ($env:Jwt__Issuer) { $EnvVars += "Jwt__Issuer=$env:Jwt__Issuer" }
if ($env:Jwt__Audience) { $EnvVars += "Jwt__Audience=$env:Jwt__Audience" }

# Add Unity Server settings if configured
if ($env:UNITY_SERVER_ADDRESS) { $EnvVars += "UnityServer__ServerAddress=$env:UNITY_SERVER_ADDRESS" }
if ($env:UNITY_SERVER_PORT) { $EnvVars += "UnityServer__ServerPort=$env:UNITY_SERVER_PORT" }

# Add Valkey settings if configured
if ($ValkeyEnabled) {
$ValkeyPort = if ($env:VALKEY_PORT) { $env:VALKEY_PORT } else { "6379" }
Expand Down
4 changes: 4 additions & 0 deletions docker/game-realtime/prod/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ if [[ "$BUILD_ONLY" != "true" ]]; then
[[ -n "$Jwt__Issuer" ]] && ENV_VARS="$ENV_VARS,Jwt__Issuer=$Jwt__Issuer"
[[ -n "$Jwt__Audience" ]] && ENV_VARS="$ENV_VARS,Jwt__Audience=$Jwt__Audience"

# Unity Server 接続設定
[[ -n "$UNITY_SERVER_ADDRESS" ]] && ENV_VARS="$ENV_VARS,UnityServer__ServerAddress=$UNITY_SERVER_ADDRESS"
[[ -n "$UNITY_SERVER_PORT" ]] && ENV_VARS="$ENV_VARS,UnityServer__ServerPort=$UNITY_SERVER_PORT"

# Valkey 設定を追加
if [[ "$VALKEY_ENABLED" == "true" ]]; then
VALKEY_PORT="${VALKEY_PORT:-6379}"
Expand Down
17 changes: 12 additions & 5 deletions docker/game-server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
- Jwt__Secret=${JWT_SECRET:?Set JWT_SECRET in .env}
- Jwt__Issuer=Game.Server
- Jwt__Audience=Game.Client
- UnityServerAuth__SecretKey=${UNITY_SERVER_AUTH_SESSION_SECRET:?Set UNITY_SERVER_AUTH_SESSION_SECRET in .env}
depends_on:
db:
condition: service_healthy
Expand All @@ -71,8 +72,10 @@ services:
- Jwt__Secret=${JWT_SECRET:?Set JWT_SECRET in .env}
- Jwt__Issuer=Game.Server
- Jwt__Audience=Game.Client
- UnityServerAuth__SecretKey=${UNITY_SERVER_AUTH_SESSION_SECRET:?Set UNITY_SERVER_AUTH_SESSION_SECRET in .env}
- GameServer__BaseUrl=http://server:8080
depends_on:
server:
condition: service_healthy
valkey:
condition: service_healthy
healthcheck:
Expand All @@ -84,18 +87,22 @@ services:

# unity-server:
# image: unity-server-linux
# container_name: game-server-unity-server
# container_name: game-server-unity
# build:
# context: ../../src/Game.Client/Builds/Server/Linux
# dockerfile: ../../docker/unity-server/Dockerfile
# dockerfile: ../../../../../docker/unity-server/Dockerfile
# ports:
# - "7777:7777/udp"
# - "7778:7778/tcp"
# environment:
# - UNITY_SERVER_AUTH_SESSION_SECRET=${UNITY_SERVER_AUTH_SESSION_SECRET:?Set UNITY_SERVER_AUTH_SESSION_SECRET in .env}
# command: ["--port", "7777", "--health-port", "7778", "--players", "4", "--secret", "${UNITY_SERVER_AUTH_SESSION_SECRET}"]
# - GAME_SERVER_URL=http://server:8080
# command: ["--port", "7777", "--health-port", "7778", "--players", "4"]
# depends_on:
# server:
# condition: service_healthy
# healthcheck:
# test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/7778' || exit 1"]
# test: ["CMD-SHELL", "bash -c 'exec 3<>/dev/tcp/localhost/7778 && echo -e \"GET /health HTTP/1.1\\r\\nHost: localhost\\r\\n\\r\\n\" >&3 && cat <&3 | head -1 | grep -q \"200 OK\"' || exit 1"]
# interval: 10s
# timeout: 3s
# retries: 3
Expand Down
5 changes: 3 additions & 2 deletions docker/game-server/prod/deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (Test-Path $EnvFile) {
}

# Check required variables
$RequiredVars = @("PROJECT_ID", "REGION", "REPO_NAME", "SERVICE_NAME", "INSTANCE_NAME", "SECRET_DB_CONNECTION", "SECRET_JWT", "SECRET_REQUEST_SIGNING", "SECRET_VALKEY_CONNECTION")
$RequiredVars = @("PROJECT_ID", "REGION", "REPO_NAME", "SERVICE_NAME", "INSTANCE_NAME", "SECRET_DB_CONNECTION", "SECRET_JWT", "SECRET_REQUEST_SIGNING", "SECRET_VALKEY_CONNECTION", "SECRET_UNITY_SERVER_AUTH")
foreach ($var in $RequiredVars) {
if (-not (Get-Item -Path "Env:$var" -ErrorAction SilentlyContinue)) {
Write-Host "[ERROR] Required variable $var is not set in .env" -ForegroundColor Red
Expand Down Expand Up @@ -114,7 +114,8 @@ if (-not $BuildOnly) {
"ConnectionStrings__Default=$env:SECRET_DB_CONNECTION`:latest",
"Jwt__Secret=$env:SECRET_JWT`:latest",
"RequestSigning__SecretKey=$env:SECRET_REQUEST_SIGNING`:latest",
"ConnectionStrings__Valkey=$env:SECRET_VALKEY_CONNECTION`:latest"
"ConnectionStrings__Valkey=$env:SECRET_VALKEY_CONNECTION`:latest",
"UnityServerAuth__SecretKey=$env:SECRET_UNITY_SERVER_AUTH`:latest"
)
if ($env:SECRET_RESEND) { $Secrets += "Resend__ApiKey=$env:SECRET_RESEND`:latest" }
$SecretsString = $Secrets -join ","
Expand Down
3 changes: 2 additions & 1 deletion docker/game-server/prod/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ else
fi

# 必須変数の確認
REQUIRED_VARS=("PROJECT_ID" "REGION" "REPO_NAME" "SERVICE_NAME" "INSTANCE_NAME" "SECRET_DB_CONNECTION" "SECRET_JWT" "SECRET_REQUEST_SIGNING" "SECRET_VALKEY_CONNECTION")
REQUIRED_VARS=("PROJECT_ID" "REGION" "REPO_NAME" "SERVICE_NAME" "INSTANCE_NAME" "SECRET_DB_CONNECTION" "SECRET_JWT" "SECRET_REQUEST_SIGNING" "SECRET_VALKEY_CONNECTION" "SECRET_UNITY_SERVER_AUTH")
for var in "${REQUIRED_VARS[@]}"; do
if [[ -z "${!var}" ]]; then
echo "[ERROR] Required variable $var is not set in .env"
Expand Down Expand Up @@ -110,6 +110,7 @@ if [[ "$BUILD_ONLY" != "true" ]]; then
SECRETS="$SECRETS,Jwt__Secret=${SECRET_JWT}:latest"
SECRETS="$SECRETS,RequestSigning__SecretKey=${SECRET_REQUEST_SIGNING}:latest"
SECRETS="$SECRETS,ConnectionStrings__Valkey=${SECRET_VALKEY_CONNECTION}:latest"
SECRETS="$SECRETS,UnityServerAuth__SecretKey=${SECRET_UNITY_SERVER_AUTH}:latest"
[[ -n "$SECRET_RESEND" ]] && SECRETS="$SECRETS,Resend__ApiKey=${SECRET_RESEND}:latest"

# デプロイコマンドを構築
Expand Down
1 change: 1 addition & 0 deletions docker/game-server/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ services:
- Jwt__Secret=${JWT_SECRET:?Set JWT_SECRET in .env}
- Jwt__Issuer=GameServer
- Jwt__Audience=GameClient
- UnityServerAuth__SecretKey=${UNITY_SERVER_AUTH_SESSION_SECRET:?Set UNITY_SERVER_AUTH_SESSION_SECRET in .env}
depends_on:
db:
condition: service_healthy
Expand Down
8 changes: 4 additions & 4 deletions docker/unity-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY . .
# ビルド時の不要ファイルを除去 + 実行権限付与
RUN rm -rf *_BackUpThisFolder_ButDontShipItWithYourGame \
*_BurstDebugInformation_DoNotShip \
&& chmod +x Unity6GameServer \
&& chmod +x Unity6GameServer* \
&& chown -R gameserver:gameserver /app

USER gameserver
Expand All @@ -35,9 +35,9 @@ USER gameserver
EXPOSE 7777/udp
EXPOSE 7778/tcp

# TCP ヘルスチェック(bash/dev/tcp を使用、追加パッケージ不要
# HTTP ヘルスチェック(ServerHttpListenerGET /health
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
CMD bash -c 'echo > /dev/tcp/localhost/7778' || exit 1
CMD bash -c 'exec 3<>/dev/tcp/localhost/7778 && echo -e "GET /health HTTP/1.1\r\nHost: localhost\r\n\r\n" >&3 && cat <&3 | head -1 | grep -q "200 OK"' || exit 1

ENTRYPOINT ["./Unity6GameServer", "-batchmode", "-nographics"]
ENTRYPOINT ["./Unity6GameServer.x86_64", "-batchmode", "-nographics"]
CMD ["--port", "7777", "--health-port", "7778", "--players", "4"]
28 changes: 27 additions & 1 deletion src/Game.Client/Assets/NuGet.config.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ MonoBehaviour:
AppIdVoice:
AppVersion:
UseNameServer: 1
FixedRegion:
FixedRegion: jp
Server:
Port: 0
ProxyServer:
Expand Down
Loading
Loading