diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-07-03 21:10:32 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-07-03 21:10:32 +0530 |
| commit | a0f3f5a069153c46ac3a85fa75c3ec50fea6ea99 (patch) | |
| tree | 6e97c9b87c314a8a64a25d3ffe10e710db1740fc /microservices/04-react-app | |
| parent | aa122113ade36f02dc8fdbebdf1232b5c4b8742c (diff) | |
Added Linux deb file creation scripts and build-all.sh
Diffstat (limited to 'microservices/04-react-app')
4 files changed, 83 insertions, 3 deletions
diff --git a/microservices/04-react-app/build.sh b/microservices/04-react-app/build.sh new file mode 100755 index 0000000..9424fc4 --- /dev/null +++ b/microservices/04-react-app/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +npm install +npm run build + +echo dist directory contains the React application. diff --git a/microservices/04-react-app/linux/etc/nginx/sites-available/fs-react-app.dev.ceit.pdn.ac.lk b/microservices/04-react-app/linux/etc/nginx/sites-available/fs-react-app.dev.ceit.pdn.ac.lk new file mode 100644 index 0000000..4aed161 --- /dev/null +++ b/microservices/04-react-app/linux/etc/nginx/sites-available/fs-react-app.dev.ceit.pdn.ac.lk @@ -0,0 +1,74 @@ +server { + listen 81; + listen [::]:81; + + server_name fs-react-app.dev.ceit.pdn.ac.lk ; + + root /home/ceit_fs_react_app/public_web; + index index.html; + + access_log /var/log/nginx/fs-react-app.dev.ceit.pdn.ac.lk_access.log; + error_log /var/log/nginx/fs-react-app.dev.ceit.pdn.ac.lk_error.log; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying /index.html + try_files $uri $uri/ /index.html; + } + + location /.well-known/ { + alias /home/ceit_fs_react_app/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-react-app.dev.ceit.pdn.ac.lk ; + + root /home/ceit_fs_react_app/public_web; + index index.html; + + # Forward requests to API gateway + location /bff/ { + proxy_pass http://127.0.0.1:8050/; + 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_set_header X-Forwarded-Port $server_port; + proxy_set_header Host $host; + } + + # Serve React application files + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying /index.html + try_files $uri $uri/ /index.html; + } + + # + # To create a self signed certificate, run the below command + # + # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-react-app.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-react-app.dev.ceit.pdn.ac.lk" -keyout /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.key -out /etc/nginx/ssl/fs-react-app.dev.ceit.pdn.ac.lk/server.crt + ssl_certificate /etc/letsencrypt/live/fs-react-app.dev.ceit.pdn.ac.lk/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/fs-react-app.dev.ceit.pdn.ac.lk/privkey.pem; # managed by Certbot + + ssl_dhparam /etc/nginx/ssl/dhparams.pem; + +} diff --git a/microservices/04-react-app/package-lock.json b/microservices/04-react-app/package-lock.json index 7df3b15..14401cf 100644 --- a/microservices/04-react-app/package-lock.json +++ b/microservices/04-react-app/package-lock.json @@ -1,11 +1,11 @@ { - "name": "05-useeffect", + "name": "react-app", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "05-useeffect", + "name": "react-app", "version": "0.0.0", "dependencies": { "axios": "^1.18.1", diff --git a/microservices/04-react-app/package.json b/microservices/04-react-app/package.json index 2ee96da..262e08a 100644 --- a/microservices/04-react-app/package.json +++ b/microservices/04-react-app/package.json @@ -1,5 +1,5 @@ { - "name": "05-useeffect", + "name": "react-app", "private": true, "version": "0.0.0", "type": "module", |
