diff --git a/auth/openapi.yaml b/auth/openapi.yaml index 44f5ad7..1c1d2f2 100644 --- a/auth/openapi.yaml +++ b/auth/openapi.yaml @@ -5,10 +5,8 @@ info: description: | Authentication service API for registration, login, logout, token refresh, and internal JWT verification. servers: - - url: http://localhost + - url: https://localhost description: Public entrypoint through Nginx - - url: http://auth:3001 - description: Internal Docker network endpoint tags: - name: Auth @@ -236,11 +234,6 @@ paths: tags: [Internal] summary: Prometheus metrics security: [] - servers: - - url: http://auth:3001 - description: Internal Docker network endpoint - - url: http://localhost:3001 - description: Local direct service endpoint responses: '200': description: Metrics payload diff --git a/docker-compose.yml b/docker-compose.yml index 5b20b3a..91edbb6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -174,6 +174,22 @@ services: networks: - monitor-net + swagger-ui: + image: swaggerapi/swagger-ui + container_name: swagger-ui + expose: + - "8080" + environment: + BASE_URL: /openapis + URLS: '[{"url":"/openapis/specs/users.yaml","name":"Users Service"},{"url":"/openapis/specs/auth.yaml","name":"Auth Service"},{"url":"/openapis/specs/gameservice.yaml","name":"Game Service"},{"url":"/openapis/specs/gamey.yaml","name":"Gamey Bot Server"}]' + URLS_PRIMARY_NAME: "Users Service" + volumes: + - ./users/openapi.yaml:/usr/share/nginx/html/specs/users.yaml:ro + - ./auth/openapi.yaml:/usr/share/nginx/html/specs/auth.yaml:ro + - ./gameservice/openapi.yaml:/usr/share/nginx/html/specs/gameservice.yaml:ro + - ./gamey/openapi.yaml:/usr/share/nginx/html/specs/gamey.yaml:ro + networks: + - monitor-net nginx: image: nginx:alpine container_name: nginx_proxy @@ -196,6 +212,7 @@ services: - gameservice - auth - redis + - swagger-ui networks: - monitor-net restart: unless-stopped diff --git a/gamey/openapi.yaml b/gamey/openapi.yaml index ff14ae2..c36f47a 100644 --- a/gamey/openapi.yaml +++ b/gamey/openapi.yaml @@ -1,12 +1,10 @@ -openapi: 3.1.0 +openapi: 3.0.3 info: title: Gamey Bot Server API description: REST API exposed by the Rust Game Y engine and bot server. version: 1.0.0 servers: - - url: http://localhost:4000 - description: Local Docker/default server port - url: /api/gamey description: Public gateway path through Nginx @@ -128,7 +126,7 @@ paths: - name: bot_id in: query required: false - description: Bot id or alias. Defaults to `random`. + description: Bot id or alias. Defaults to `impossible`. schema: type: string responses: diff --git a/gamey/src/bot_server/play.rs b/gamey/src/bot_server/play.rs index 1f8d67e..cba52b2 100644 --- a/gamey/src/bot_server/play.rs +++ b/gamey/src/bot_server/play.rs @@ -36,7 +36,7 @@ pub async fn play( )) })?; - let bot_id = req.bot_id.unwrap_or_else(|| "random".to_string()); + let bot_id = req.bot_id.unwrap_or_else(|| "impossible".to_string()); let resolved_id = state.resolve_bot_id(&bot_id); let bot = state.bots().find(resolved_id).ok_or_else(|| { diff --git a/nginx/nginx.conf b/nginx/nginx.conf index ba3e180..5506219 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -213,7 +213,13 @@ http { proxy_redirect off; } - + location ^~ /openapis/ { + proxy_pass http://swagger-ui:8080/openapis/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { proxy_pass http://webapp_backend; diff --git a/users/openapi.yaml b/users/openapi.yaml index b5ed008..21e9ea1 100644 --- a/users/openapi.yaml +++ b/users/openapi.yaml @@ -9,8 +9,6 @@ info: servers: - url: /api/users description: Public gateway path through Nginx - - url: http://users:3000/api/users - description: Internal Docker network endpoint tags: - name: Profiles @@ -27,11 +25,6 @@ paths: get: tags: [Operations] summary: Service health/info endpoint - servers: - - url: / - description: Service root path - - url: http://users:3000 - description: Internal Docker network endpoint responses: '200': description: Service is running @@ -630,11 +623,6 @@ paths: get: tags: [Operations] summary: Prometheus metrics - servers: - - url: / - description: Service root path - - url: http://users:3000 - description: Internal Docker network endpoint responses: '200': description: Metrics payload