IBM Maximo: Containerized NGINX server with authentication to securely host and distribute customization files.zip: Difference between revisions

From Wiki
Jump to navigation Jump to search
Created page with "Nginx container running on OpenShift to provide '''customization_files.zip''' file sharing between containers, with token-protected uploads. = Architecture = <pre> [ curl / another container ] │ PUT /files/<filename> ← protected by X-Upload-Token GET /files/<filename> ← public (download) │ ┌──────▼───────────────────────┐ │ nginx-fileserver Pod..."
 
No edit summary
Line 55: Line 55:
oc apply -f service-nginx.yaml
oc apply -f service-nginx.yaml
oc apply -f route-nginx.yaml
oc apply -f route-nginx.yaml
</syntaxhighlight>
</syntaxhighlight>


----


== 3 — Verify the Route URL ==
== 4 Verify the Route URL ==


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 68: Line 66:
</syntaxhighlight>
</syntaxhighlight>


----


== 4)Upload a File with curl ==
== 5)Upload a File with curl ==


Via Route (External Access)
Via Route (External Access)
Line 90: Line 87:
: NGINX_HOST=http://nginx-fileserver:8080/files/customization-files.zip
: NGINX_HOST=http://nginx-fileserver:8080/files/customization-files.zip


== 5 — Download a File with curl ==
== 6) Download a File with curl ==


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 101: Line 98:
: NGINX_HOST=http://nginx-fileserver:8080/files/customization-files.zip
: NGINX_HOST=http://nginx-fileserver:8080/files/customization-files.zip


=== 5.1 List Available Files ===
=== 6.1) List Available Files ===


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 111: Line 108:




= See Alson também =
= See also =


* [[Cloud| Artigos sobre Cloud]]
* [[Cloud| Artigos sobre Cloud]]

Revision as of 17:42, 6 July 2026

Nginx container running on OpenShift to provide customization_files.zip file sharing between containers, with token-protected uploads.

Architecture

[ curl / another container ]
         │
    PUT /files/<filename>          ← protected by X-Upload-Token
    GET /files/<filename>          ← public (download)
         │
  ┌──────▼───────────────────────┐
  │   nginx-fileserver Pod       │
  │   image: nginx-unprivileged  │
  │   port: 8080                 │
  └──────────────────────────────┘
         │
  PersistentVolumeClaim: /data/files


Procedure

1) Clone repository

Edit secret-upload-token.yaml and replace the value of UPLOAD_TOKEN:

git clone https://github.com/ebasso/mas-nginx-customization-file-server.git

cd mas-nginx-customization-file-server/yamls

2) Configure the Secret Token

Edit secret-upload-token.yaml and replace the value of UPLOAD_TOKEN:

stringData:
  UPLOAD_TOKEN: "replace-with-a-secure-token"
Note: Generate a strong token using openssl rand -hex 32.

3) Full Deployment

oc new-project mas-nginx

# Apply all resources in the correct order
oc apply -f secret-upload-token.yaml
oc apply -f configmap-nginx.yaml
oc apply -f pvc-nginx-files.yaml
oc apply -f deployment-nginx.yaml
oc apply -f service-nginx.yaml
oc apply -f route-nginx.yaml


4 Verify the Route URL

oc get route nginx-fileserver -o jsonpath='{.spec.host}'
# Example:
# nginx-fileserver-mas-nginx.apps.cluster.example.com


5)Upload a File with curl

Via Route (External Access)

NGINX_HOST=$(oc get route nginx-fileserver -o jsonpath='{.spec.host}')
TOKEN="replace-with-a-secure-token"

curl -v \
  -X PUT \
  -H "X-Upload-Token: ${TOKEN}" \
  -H "Content-Type: application/octet-stream" \
  --upload-file ./customization-files.zip \
  "https://${NGINX_HOST}/files/customization-files.zip"

Via Service (Internal Cluster Access)

NGINX_HOST=http://nginx-fileserver:8080/files/customization-files.zip

6) Download a File with curl

NGINX_HOST=$(oc get route nginx-fileserver -o jsonpath='{.spec.host}')

curl -O "https://${NGINX_HOST}/files/my-file.zip"

Via Service (Internal Cluster Access):

NGINX_HOST=http://nginx-fileserver:8080/files/customization-files.zip

6.1) List Available Files

curl "https://${NGINX_HOST}/files/"
# or internally:
curl "http://nginx-fileserver:8080/files/"


See also