Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 51 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Git
.git
.gitignore
.gitattributes
*.md

# VS Code
.vscode

# Visual Studio
.vs
*.user
*.suo
*.vcproj.user

# Rider
.idea

# Build artifacts
**/bin/
**/obj/
**/out/

# NuGet
packages/
*.nupkg

# Test results
TestResults/
*.trx
*.coverage
*.coveragexml

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Docker
Dockerfile*
docker-compose*
.dockerignore

# Other
*.log
*.tmp
*.temp
4 changes: 2 additions & 2 deletions .github/workflows/build-identity-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
branches: [ main, develop ]
paths:
- 'src/Identity.Api/**'
- 'src/Identity.CQRS/**'
- 'src/Domain/**'
- 'src/Application/**'
- 'src/Infrastructure/**'
pull_request:
branches: [ main, develop ]
paths:
- 'src/Identity.Api/**'
- 'src/Identity.CQRS/**'
- 'src/Domain/**'
- 'src/Application/**'
- 'src/Infrastructure/**'
workflow_dispatch:

Expand Down
18 changes: 18 additions & 0 deletions GamesApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application.Tests", "Applic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.Tests", "tests\Application.Tests\Application.Tests.csproj", "{D36F9506-00AD-3D0B-2CDA-FF6675FE1CF3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Gateway.Api", "Gateway.Api", "{391B19C0-5E8B-43CD-8AD2-555126C2C19A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gateway.Api", "src\Gateway.Api\Gateway.Api.csproj", "{ED6B6783-B070-ED0E-3429-1846E07E78C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -134,6 +138,18 @@ Global
{D36F9506-00AD-3D0B-2CDA-FF6675FE1CF3}.Release|x64.Build.0 = Release|Any CPU
{D36F9506-00AD-3D0B-2CDA-FF6675FE1CF3}.Release|x86.ActiveCfg = Release|Any CPU
{D36F9506-00AD-3D0B-2CDA-FF6675FE1CF3}.Release|x86.Build.0 = Release|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Debug|x64.ActiveCfg = Debug|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Debug|x64.Build.0 = Debug|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Debug|x86.ActiveCfg = Debug|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Debug|x86.Build.0 = Debug|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Release|Any CPU.Build.0 = Release|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Release|x64.ActiveCfg = Release|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Release|x64.Build.0 = Release|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Release|x86.ActiveCfg = Release|Any CPU
{ED6B6783-B070-ED0E-3429-1846E07E78C8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -153,6 +169,8 @@ Global
{B3154D0A-A228-4018-8E0A-C4D4CA52E690} = {51202C1F-1C07-42CB-BCC4-D64FD9451A91}
{A781A3F5-2A23-4248-8246-3043798B2CCF} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{D36F9506-00AD-3D0B-2CDA-FF6675FE1CF3} = {A781A3F5-2A23-4248-8246-3043798B2CCF}
{391B19C0-5E8B-43CD-8AD2-555126C2C19A} = {51202C1F-1C07-42CB-BCC4-D64FD9451A91}
{ED6B6783-B070-ED0E-3429-1846E07E78C8} = {391B19C0-5E8B-43CD-8AD2-555126C2C19A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {98394EF5-BDBD-4F73-8B40-6F1B9EA9F24F}
Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@ The solution is structured into two APIs:
- `GamesDb`
- `IdentityDb`

2. **Run Migrations** (see below)

3. **Seed Data & Authentication**
2. **JWT Key Configuration**
For production, set the JWT key using environment variables or Azure Key Vault:
```bash
# Environment variable
export JwtSettings__Key="your-super-secure-jwt-key-at-least-256-bits-long"

# Or use appsettings.Production.json
```
3. **Run Migrations** (see below)

4. **Seed Data & Authentication**
Run in **Debug mode** to auto-seed initial data.
Use the `/users/login` endpoint to get a **JWT token**, then:
- In **Swagger**: Click **Authorize** → paste `Bearer <token>`
Expand Down Expand Up @@ -138,9 +146,9 @@ dotnet ef database update \

## TODO

- [ ] Implement **API Gateway** (e.g., Ocelot or YARP)
- [x] Implement **API Gateway**
- [x] Docker compose and Dockermake files
- [ ] Add **Load Balancer** for scalability
- [ ] Deploy to **Azure App Services**
- [ ] Use **Azure Flexible Database for PostgreSQL**
- [ ] Add **Rate Limiting** and **Caching**, possibly Redis

Expand Down
154 changes: 0 additions & 154 deletions infra/core/database/postgresql/flexibleserver.bicep

This file was deleted.

99 changes: 99 additions & 0 deletions infra/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Production docker-compose.yml
services:
postgres:
image: postgres:16
container_name: postgres-db
restart: unless-stopped
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
secrets:
- postgres_password
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres/init:/docker-entrypoint-initdb.d:ro
networks:
- games-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s

gateway:
build:
context: ..
dockerfile: ./src/Gateway.Api/Dockerfile
container_name: gateway-api
restart: unless-stopped
ports:
- "80:7000"
- "443:7000" # If you add HTTPS
depends_on:
postgres:
condition: service_healthy
games-api:
condition: service_started
identity-api:
condition: service_started
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:7000
- ReverseProxy__Clusters__games-cluster__Destinations__games-api__Address=http://games-api:7001
- ReverseProxy__Clusters__identity-cluster__Destinations__identity-api__Address=http://identity-api:7002
networks:
- games-network

games-api:
build:
context: ..
dockerfile: ./src/Games.Api/Dockerfile
container_name: games-api
restart: unless-stopped
expose:
- "7001"
depends_on:
postgres:
condition: service_healthy
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:7001
- ConnectionStrings__GamesDb=Host=postgres;Database=GamesDb;Username=postgres;Password_FILE=/run/secrets/postgres_password
secrets:
- postgres_password
networks:
- games-network

identity-api:
build:
context: ..
dockerfile: ./src/Identity.Api/Dockerfile
container_name: identity-api
restart: unless-stopped
expose:
- "7002"
depends_on:
postgres:
condition: service_healthy
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://+:7002
- ConnectionStrings__Identity=Host=postgres;Database=Identity;Username=postgres;Password_FILE=/run/secrets/postgres_password
secrets:
- postgres_password
networks:
- games-network

volumes:
postgres_data:
driver: local

networks:
games-network:
driver: bridge

secrets:
postgres_password:
file: ./secrets/postgres_password.txt
Loading