summaryrefslogtreecommitdiff
path: root/microservices/02-api-gateway/linux/deb/package/etc
diff options
context:
space:
mode:
authorKamal Wickramanayake <kamal@inbox.lk>2026-07-03 21:10:32 +0530
committerKamal Wickramanayake <kamal@inbox.lk>2026-07-03 21:10:32 +0530
commita0f3f5a069153c46ac3a85fa75c3ec50fea6ea99 (patch)
tree6e97c9b87c314a8a64a25d3ffe10e710db1740fc /microservices/02-api-gateway/linux/deb/package/etc
parentaa122113ade36f02dc8fdbebdf1232b5c4b8742c (diff)
Added Linux deb file creation scripts and build-all.sh
Diffstat (limited to 'microservices/02-api-gateway/linux/deb/package/etc')
-rw-r--r--microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/application.yaml89
-rw-r--r--microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/environment.env2
-rw-r--r--microservices/02-api-gateway/linux/deb/package/etc/systemd/system/ceit-fs-api-gateway.service12
3 files changed, 103 insertions, 0 deletions
diff --git a/microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/application.yaml b/microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/application.yaml
new file mode 100644
index 0000000..2747d3b
--- /dev/null
+++ b/microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/application.yaml
@@ -0,0 +1,89 @@
+server:
+ port: 8050
+ address: 127.0.0.1
+
+app:
+ userRolesUrl: "http://localhost:8052/myservices/api/security/users/{username}/roles"
+
+# logging:
+# level:
+# org.springframework.security: trace
+
+spring:
+ application:
+ name: api-gateway
+
+ cloud:
+ gateway:
+ server:
+ webflux:
+ globalcors:
+ cors-configurations:
+ '[/**]':
+ allowedOrigins:
+ - "https://fs-react-app.dev.ceit.pdn.ac.lk"
+ allowedMethods: "*"
+ allowedHeaders: "*"
+ allowCredentials: true
+ routes:
+ # Frontend tries to access this URL when the login link is clicked.
+ # If user is not logged in, user will be redirected to OAuth2 server.
+ # If logged in, frontend will be reloaded.
+ - id: frontend
+ uri: no://op # CRITICAL: Prevents forwarding to a backend server
+ predicates:
+ - Path=/ui
+ filters:
+ - RedirectTo=302, https://fs-react-app.dev.ceit.pdn.ac.lk/
+ # Forward requests to backend service (OAuth2 resource server)
+ - id: backend-service
+ uri: http://localhost:8052
+ predicates:
+ - Path=/api/**
+ filters:
+ # 1. ALWAYS strip incoming spoof headers from the public web first
+ - RemoveRequestHeader=X-User-Id
+ - RemoveRequestHeader=X-User-Name
+ - RemoveRequestHeader=X-User-Roles
+ - RemoveRequestHeader=Authorization
+ - PrefixPath=/myservices
+ - TokenRelay # Add oauth (or jwt) token to request header before forwarding
+
+ security:
+ oauth2:
+ client:
+ provider:
+ platform-auth-server:
+ issuer-uri: https://fs-auth-server.dev.ceit.pdn.ac.lk
+ registration:
+ api-gateway:
+ provider: platform-auth-server
+ client-id: api-gateway
+ client-secret: "apiGatewayPassword1234"
+ client-authentication-method: client_secret_basic
+ authorization-grant-type: authorization_code
+ redirect-uri: https://fs-react-app.dev.ceit.pdn.ac.lk/bff/login/oauth2/code/api-gateway
+ scope:
+ - openid
+ - profile
+com:
+ c4-soft:
+ springaddons:
+ oidc:
+ ops:
+ - iss: https://fs-auth-server.dev.ceit.pdn.ac.lk
+ client:
+ client-uri: https://fs-react-app.dev.ceit.pdn.ac.lk
+ login-uri: /bff/oauth2/authorization/api-gateway
+ security-matchers:
+ - /**
+ permit-all:
+ - /login/**
+ - /oauth2/**
+ - /
+ - /api/**
+ csrf: cookie-accessible-from-js
+ oauth2-redirections:
+ rp-initiated-logout: ACCEPTED
+ post-logout-redirect-host: https://fs-react-app.dev.ceit.pdn.ac.lk
+ post-logout-redirect-path: /
diff --git a/microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/environment.env b/microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/environment.env
new file mode 100644
index 0000000..5423533
--- /dev/null
+++ b/microservices/02-api-gateway/linux/deb/package/etc/ceit-fs-api-gateway/environment.env
@@ -0,0 +1,2 @@
+# Which Spring profile should be active?
+#SPRING_PROFILES_ACTIVE=prod
diff --git a/microservices/02-api-gateway/linux/deb/package/etc/systemd/system/ceit-fs-api-gateway.service b/microservices/02-api-gateway/linux/deb/package/etc/systemd/system/ceit-fs-api-gateway.service
new file mode 100644
index 0000000..5a2cc54
--- /dev/null
+++ b/microservices/02-api-gateway/linux/deb/package/etc/systemd/system/ceit-fs-api-gateway.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=ceit-fs-api-gateway
+
+[Service]
+User=ceit-fs-api-gateway
+EnvironmentFile=/etc/ceit-fs-api-gateway/environment.env
+ExecStart=/usr/bin/java -Dspring.config.import=optional:file:/etc/ceit-fs-api-gateway/application.yaml -jar /opt/ceit/ceit-fs-api-gateway/app/ceit-fs-api-gateway.jar
+Restart=always
+RestartSec=30
+
+[Install]
+WantedBy=multi-user.target