From a0f3f5a069153c46ac3a85fa75c3ec50fea6ea99 Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Fri, 3 Jul 2026 21:10:32 +0530 Subject: Added Linux deb file creation scripts and build-all.sh --- .../etc/ceit-fs-auth-server/application.yaml | 40 ++++++++++++++ .../etc/ceit-fs-auth-server/environment.env | 2 + .../fs-auth-server.dev.ceit.pdn.ac.lk | 61 ++++++++++++++++++++++ .../etc/systemd/system/ceit-fs-auth-server.service | 12 +++++ 4 files changed, 115 insertions(+) create mode 100644 microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/application.yaml create mode 100644 microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/environment.env create mode 100644 microservices/01-oauth2-server/linux/deb/package/etc/nginx/sites-available/fs-auth-server.dev.ceit.pdn.ac.lk create mode 100644 microservices/01-oauth2-server/linux/deb/package/etc/systemd/system/ceit-fs-auth-server.service (limited to 'microservices/01-oauth2-server/linux/deb/package/etc') diff --git a/microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/application.yaml b/microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/application.yaml new file mode 100644 index 0000000..0ce4a3d --- /dev/null +++ b/microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/application.yaml @@ -0,0 +1,40 @@ +server: + port: 8051 + address: 127.0.0.1 + forward-headers-strategy: native + +#logging: +# level: +# org.springframework.security: trace + +spring: + application: + name: oauth2-server + security: + oauth2: + authorizationserver: + client: + oidc-client: + registration: + client-id: "api-gateway" + client-secret: "{noop}apiGatewayPassword1234" + client-authentication-methods: + - "client_secret_basic" + authorization-grant-types: + - "authorization_code" + - "refresh_token" + redirect-uris: + - "https://fs-react-app.dev.ceit.pdn.ac.lk/bff/login/oauth2/code/api-gateway" + post-logout-redirect-uris: + - "https://fs-react-app.dev.ceit.pdn.ac.lk/" + scopes: + - "openid" + - "profile" + require-authorization-consent: false + +app: + users: + - username: admin + password: "{noop}abc123" + - username: user1 + password: "{noop}abc123" diff --git a/microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/environment.env b/microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/environment.env new file mode 100644 index 0000000..5423533 --- /dev/null +++ b/microservices/01-oauth2-server/linux/deb/package/etc/ceit-fs-auth-server/environment.env @@ -0,0 +1,2 @@ +# Which Spring profile should be active? +#SPRING_PROFILES_ACTIVE=prod diff --git a/microservices/01-oauth2-server/linux/deb/package/etc/nginx/sites-available/fs-auth-server.dev.ceit.pdn.ac.lk b/microservices/01-oauth2-server/linux/deb/package/etc/nginx/sites-available/fs-auth-server.dev.ceit.pdn.ac.lk new file mode 100644 index 0000000..73c5b50 --- /dev/null +++ b/microservices/01-oauth2-server/linux/deb/package/etc/nginx/sites-available/fs-auth-server.dev.ceit.pdn.ac.lk @@ -0,0 +1,61 @@ +server { + listen 81; + listen [::]:81; + + server_name fs-auth-server.dev.ceit.pdn.ac.lk ; + + root /home/ceit_fs_auth_server/public_web; + index index.html; + + access_log /var/log/nginx/fs-auth-server.dev.ceit.pdn.ac.lk_access.log; + error_log /var/log/nginx/fs-auth-server.dev.ceit.pdn.ac.lk_error.log; + + location / { + try_files $uri $uri/ =404; + } + + location /.well-known/ { + alias /home/ceit_fs_auth_server/well-known/; + } + + location /.well-known/acme-challenge { + alias /var/lib/letsencrypt/.well-known/acme-challenge/; + } + + # Block access to "hidden" files and directories whose names begin with a + # period. This includes directories used by version control systems such + # as Subversion or Git to store control files. + location ~ (^|/)\.(?!well-known).* { + return 403; + } +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name fs-auth-server.dev.ceit.pdn.ac.lk ; + + location / { + proxy_pass http://127.0.0.1:8051; + 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 https; + proxy_set_header X-Forwarded-Port 443; + proxy_set_header Host $host; + } + + # + # To create a self signed certificate, run the below command + # + # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.crt + # + # Or non-intractively + # + # openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=AB/ST=ABC/L=ABCD/O=ABCDE/CN=fs-auth-server.dev.ceit.pdn.ac.lk" -keyout /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-auth-server.dev.ceit.pdn.ac.lk/server.crt + ssl_certificate /etc/letsencrypt/live/fs-auth-server.dev.ceit.pdn.ac.lk/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/fs-auth-server.dev.ceit.pdn.ac.lk/privkey.pem; # managed by Certbot + + ssl_dhparam /etc/nginx/ssl/dhparams.pem; + +} diff --git a/microservices/01-oauth2-server/linux/deb/package/etc/systemd/system/ceit-fs-auth-server.service b/microservices/01-oauth2-server/linux/deb/package/etc/systemd/system/ceit-fs-auth-server.service new file mode 100644 index 0000000..a26e76b --- /dev/null +++ b/microservices/01-oauth2-server/linux/deb/package/etc/systemd/system/ceit-fs-auth-server.service @@ -0,0 +1,12 @@ +[Unit] +Description=ceit-fs-auth-server + +[Service] +User=ceit-fs-auth-server +EnvironmentFile=/etc/ceit-fs-auth-server/environment.env +ExecStart=/usr/bin/java -Dspring.config.import=optional:file:/etc/ceit-fs-auth-server/application.yaml -jar /opt/ceit/ceit-fs-auth-server/app/ceit-fs-auth-server.jar +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3