Skip to content

Commit

Permalink
Removed nginx dependency from docker compose, added its configuration… (
Browse files Browse the repository at this point in the history
#219)

* Removed nginx dependency from docker compose, added its configuration to inji-web nginx

Signed-off-by: Gurpreet41082 <[email protected]>

* [INJIWEB-1213 Made consistent ports and reverted nginx headers changes]

Signed-off-by: Gurpreet41082 <[email protected]>

---------

Signed-off-by: Gurpreet41082 <[email protected]>
  • Loading branch information
Gurpreet41082 authored Dec 16, 2024
1 parent 78a6acc commit 31b9be5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 54 deletions.
4 changes: 2 additions & 2 deletions docker-compose/config/mimoto-default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ mosip.inji.minStorageRequired=2

# START bootstrap.properties

spring.cloud.config.uri=http://nginx/
spring.cloud.config.uri=http://inji-web:3004/
spring.cloud.config.name=mimoto,inji
spring.application.name=mimoto

#config.server.file.storage.uri=https://raw.githubusercontent.com/mosip/mosip-config/collab1/
config.server.file.storage.uri=http://nginx/
config.server.file.storage.uri=http://inji-web:3004/

management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=info,health,refresh
Expand Down
37 changes: 7 additions & 30 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
version: '3.8'

services:
nginx:
container_name: nginx
image: nginx:alpine
ports:
- '80:80'
volumes:
- ./config/mimoto-issuers-config.json:/config/server/mimoto-issuers-config.json
- ./config/mimoto-trusted-verifiers.json:/config/server/mimoto-trusted-verifiers.json
- ./config/credential-template.html:/config/server/credential-template.html
- ./nginx.conf:/etc/nginx/nginx.conf

mimoto-service:
container_name: 'mimoto-service'
Expand All @@ -25,32 +15,19 @@ services:
- SPRING_CONFIG_LOCATION=/home/mosip/
volumes:
- ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties
- ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json
- ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json
- ./certs/oidckeystore.p12:/home/mosip/certs/oidckeystore.p12
depends_on:
- nginx

inji-web-proxy:
container_name: 'inji-web-proxy'
image: inji-web-proxy:local
ports:
- '3010:3010'
environment:
- MIMOTO_HOST=http://mimoto-service:8099/v1/mimoto
- PORT=3010
depends_on:
- mimoto-service

inji-web:
container_name: 'inji-web'
image: inji-web:local
ports:
- '3001:3004'
- '3004:3004'
environment:
- DEFAULT_LANG=en
- MIMOTO_HOST=http://localhost:3010
- MIMOTO_HOST=http://localhost:3004/v1/mimoto
volumes:
- ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties
- ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json
- ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json
depends_on:
- inji-web-proxy


- mimoto-service
12 changes: 0 additions & 12 deletions docker-compose/nginx.conf

This file was deleted.

6 changes: 0 additions & 6 deletions helm/inji-web/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ data:
http {
access_log /var/log/nginx/access1.log;
error_log /var/log/nginx/error1.log;
# Increase buffer sizes for reading response headers from the upstream server
proxy_buffer_size 16k; # Buffer for the first part of the response header
proxy_buffers 4 16k; # Number of buffers and their size for reading the response
proxy_busy_buffers_size 32k; # Buffer size for busy buffers
server {
listen {{ .Values.inji_web.inji_web_port }};
server_name localhost;
Expand Down
32 changes: 28 additions & 4 deletions inji-web/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
server {
listen 3004;
# Serve static files, if any
# Default location for normal static files
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}


location /mimoto/ {
proxy_pass http://192.168.2.186:8089/;
# Serve files from /home/mosip with autoindex enabled
location ~* \.json$ {
root /home/mosip;
autoindex on;
}


# Proxy API requests to mimoto-service
location /v1/mimoto/ {
proxy_pass http://mimoto-service:8099/v1/mimoto/;
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;
proxy_http_version 1.1;
proxy_set_header Connection "";

# Add CORS headers
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Cache-Control' always;

# Handle OPTIONS requests (for pre-flight checks)
if ($request_method = 'OPTIONS') {
return 204;
}
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
root /usr/share/nginx/html;
}
}

0 comments on commit 31b9be5

Please sign in to comment.