Ampere Computing Logo
Contact Sales
Ampere Computing Logo
Hero Image

Deploy Video on Demand PoC Demo on Red Hat OpenShift Container

Platform 4.11 on Ampere Altra Platforms

Overview

This tutorial explains how to deploy Video-on-Demand PoC demo on Red Hat OpenShift Container Platform 4.11 on Ampere Altra with block storage, shared file systems, and object storage managed by Rook Ceph Operator. Estimated time to complete this tutorial: 30 minutes.


Ampere is pleased to showcase open-source Video-on-Demand Services on Red Hat OpenShift Container Platform, a hybrid cloud platform as a service built around Linux containers orchestrated and managed by Kubernetes, to exhibit the cloud native characteristics of the Ampere platform for video services:

Red Hat OpenShift Container Platform - an enterprise-ready Kubernetes container platform with full-stack automated operations. It’s a certified Kubernetes distribution with add-on functions/services.

  • A 3-node cluster is the minimum required for a highly available (HA) cluster
  • A Single Node OpenShift for Edge cloud or 5G Cell towers use cases

Rook Ceph Operator - offers Block Storage, which is the key element for keeping metadata, videos (mp4, mov, or avi), subtitles (e.g., WebVTT, etc.), generated playlists & segment files for VOD services

HAProxy - a Load Balancer for Kubernetes with an external Load Balancer which is an appliance acting as a reverse proxy and distributing network or application traffic across several servers.

2 Pods

  • nginx-vod-module-container - An NGNIX-based container with VOD module serving as the backend for video streaming service
  • nginx-hello-container - An NGNIX Webserver container with HTML and resource files serving as a YouTube-like front-end web application
Prerequisites
  • A DNS service like bind (named) supporting the Full Qualified Domain Name (FQDN, such as ocp4.hhii.amp or sno.ocp4.ampere)
  • A HAProxy service as the external load balancer on the bastion node for multi-node OpenShift Cluster
Instructions

The following is the step-by-step to deploy Video on Demand PoC demo on OpenShift Container Platform 4.11


1. Login to OpenShift Web Console


OpenShift Web Console.jpg Figure A-1


2. The console will show the dashboards for activities, cluster details, and status


dashboards for activities.jpg Figure A-2


3. Switch to “Developer” prospect by clicking on “Administrator” pull down menu


“Administrator” pull down menu.jpg Figure A-3


4. Click “Create a project” to create a “vod-poc” project


“vod-poc” project.jpg Figure A-4


5. Click “+Add” to start the VOD PoC demo deployment

6. Click “Import YAML” to create Persistent Volume Claims for NGNIX Web app and VOD service


NGNIX Web app and VOD service.jpg Figure A-5


7. The console shows an online editor for drag-n-drop YAML or JSON file , or just simply enter the content of file and use “---” to separate each definition.


YAML or JSON file.jpg Figure A-6


8. Import the YAML content for nginx-vod-app PVC


apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nginx-vod-app-pvc labels: app: nginx-vod-app spec: accessModes: - ReadWriteOnce resources: # This is the request for storage. Should be available in the cluster. requests: storage: 100Gi storageClassName: rook-ceph-block

9. Import is the YAML content for nginx-front-app PVC


apiVersion: v1 kind: PersistentVolumeClaim metadata: name: nginx-front-app-pvc labels: app: nginx-front-app spec: accessModes: - ReadWriteOnce resources: # This is the request for storage. Should be available in the cluster. requests: storage: 100Gi storageClassName: rook-ceph-block

10. Back to “Add” page, we deploy the NGNIX WebApp and VOD service with 2 GitHub repos: 1. https://github.com/AmpereComputing/nginx-hello-container 2. https://github.com/AmpereComputing/nginx-vod-module-container


2 GitHub repos.jpg Figure A-7


11. Enter “https://github.com/AmpereComputing/nginx-hello-container “ to Git Repo URL.


Git Repo URL.jpg Figure A-8


12. Scroll down to enter “nginx-front-app” in “Application” and “Name” fields, then click “Create”


“nginx-front-app”.jpg Figure A-9


13. The Source-to-Image (S2I) workflow will start to build the container image with the source code from GitHub repo


Source-to-Image (S2I) workflow.jpg Figure A-10


14. Click “Actions” of nginx-front-app deployment, then “Add Storage” to mount the PVC, nginx-front-app-pvc, to the Pod


nginx-front-app deployment.jpg Figure A-11


15. On “Add Storage“ page for nginx-front-app, click “Use existing claim” for PeresistentVolumeClaim , choose “nginx-front-app-pvc”, then enter “/usr/share/nginx/html” to the field under “Mount path” and click “save” button to complete the action.


Add Storage.jpg Figure A-12


16. Enter “https://github.com/AmpereComputing/nginx-vod-module-container” into “Git Repo URL”.


Git Repo URL1.jpg Figure A-13


17. Scroll down to enter “nginx-vod-app” in “Application” and “Name” fields, then click “Create”


“Name” fields.jpg Figure A-14


18. S2I workflow also builds the container image for nginx-vod-app


S2I workflow.jpg Figure A-15


19. Once its S2I workflow is done, click “Actions” of nginx-vod-app deployment, then “Add Storage” to mount the PVC, nginx-vod-app-pvc, to the Pod


click “Actions” of nginx-vod-app.jpg Figure A-16


20. On “Add Storage“ page for nginx-vod-app, click “Use existing claim” for PeresistentVolumeClaim, choose “nginx-vod-app-pvc”, then enter “/opt/static/videos” to the field under “Mount path” and click “save” button to complete the action.


Use existing claim.jpg Figure A-17


21. “Topology” page shows two Pods, nginx-front-app and nginx-vod-app


Topology page.jpg Figure A-18


22. OpenShift console also allows developers to access the Pod via the terminal tab


a. Click the link for nginx-front-app-[xyz-123] under Pods, then it will prompt the Pod details page


Pod details page.jpg Figure A-19


b. Click “Terminal” Tab, it will connect to nginx-front-app container


“Terminal” Tab.jpg Figure A-20


c. When the console is ready, execute the following commands


$ cd /usr/share/nginx/html/ $ wget http://[A link of bucket on Object Storage]/hello-demo.tgz $ tar zxvf hello-demo.tgz $ mv hello-demo/* . $ rm -rf hello-demo

d. Also update the URL (to https://nginx-vod-app-vod-poc.apps.sno.ocp4.ampere) in each video player HTML files and fix a typo


sed -i "s,http://\[vod-demo\]/,https://nginx-vod-app-vod-poc.apps.sno.ocp4.ampere/,g" *.html sed -i "s,Pytorch,PyTorch,g" *.html

e. Continue to work on nginx-vod-app Pod and click the link for nginx-vod-app-[xyz-123] under Pods, then it will prompt the Pod details page


click the link for nginx-vod-app.jpg Figure A-21


f. Click “Terminal” Tab, it will connect to nginx-vod-app container


Click “Terminal” Tab.jpg Figure A-22


g. When the VoD container console is ready, execute the following commands to retrieve the tarball file included those pre-encoded videos


$ cd /opt/static/videos/ $ wget http://[A link of bucket on Object Storage]/vod-demo.tgz $ tar zxvf vod-demo.tgz $ mv vod-demo/* . $ rm -rf vod-demo $ sed -i "s,Pytorch,PyTorch,g" *.vtt

23. Since OpenShift will serve all web applications and services in HTTPS protocol, it’s needed to configure NGNIX VoD module to generate master playlists to serve media playlists with HTTPS as well. Otherwise, the video player on HTML5 browsers won’t be able to play the streaming videos.


a. On bastion node, edit a nginx.conf file with the modified URL (https://nginx-vod-app-vod-poc.apps.sno.ocp4.ampere) for “vod_base_url” to create a ConfigMap for VOD service (nginx-vod-app)


worker_processes auto; events { use epoll; } http { log_format main '$remote_addr $remote_user [$time_local] "$request" ' '$status "$http_referer" "$http_user_agent"'; access_log /dev/stdout main; error_log stderr debug; default_type application/octet-stream; include /var/cache/nginx/conf/mime.types; sendfile on; tcp_nopush on; tcp_nodelay on; vod_base_url https://nginx-vod-app-vod-poc.apps.sno.ocp4.ampere; vod_mode local; vod_metadata_cache metadata_cache 16m; vod_response_cache response_cache 512m; vod_last_modified_types *; vod_segment_duration 9000; vod_align_segments_to_key_frames on; vod_dash_fragment_file_name_prefix "segment"; vod_hls_segment_file_name_prefix "segment"; vod_manifest_segment_durations_mode accurate; open_file_cache max=1000 inactive=5m; open_file_cache_valid 2m; open_file_cache_min_uses 1; open_file_cache_errors on; aio on; server { listen 8080; server_name localhost; root /opt/static; location ~ ^/videos/.+$ { autoindex on; } location /hls/ { vod hls; alias /opt/static/videos/; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS'; } location /thumb/ { vod thumb; alias /opt/static/videos/; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS'; } location /dash/ { vod dash; alias /opt/static/videos/; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS'; } } }

b. create configMap with nginx.conf


$ oc project vod-poc $ oc create configmap nginx-conf --from-file=./nginx.conf

c. Back to OpenShift Web console

d. Edit the deployment for nginx-vod-app by adding the portions of “nginx-config-vol” under the sections of volumes and volumeMounts


... spec: volumes: - name: nginx-vod-app-pvc persistentVolumeClaim: claimName: nginx-vod-app-pvc - name: nginx-config-vol configMap: name: nginx-conf defaultMode: 420 ... volumeMounts: - name: nginx-vod-app-pvc mountPath: /opt/static/videos - name: nginx-config-vol readOnly: true mountPath: /var/cache/nginx/conf/nginx.conf subPath: nginx.conf

e. The nginx-vod-app will be re-deployed with the new nginx.conf to let NGNIX VoD module serve playlists, segments, and subtitles on HTTPS protocol.


24. Click the link icon on the nginx-front-app Pod


icon on the nginx-front-app.jpg


25. It will trigger a new browser tab to access NGNIX Web App https://nginx-front-app-vod-poc.apps.sno.ocp4.ampere


new browser tab.jpg Figure A-24


26. The demo is ready for serving Video-on-Demand Streaming to audience


Video-on-Demand Streaming.jpg Figure 1A-25

Created At : January 24th 2023, 8:32:21 am
Last Updated At : June 6th 2023, 8:58:13 pm
Ampere Logo

Ampere Computing LLC

4655 Great America Parkway Suite 601

Santa Clara, CA 95054

image
image
image
image
image
 |  |  | 
© 2024 Ampere Computing LLC. All rights reserved. Ampere, Altra and the A and Ampere logos are registered trademarks or trademarks of Ampere Computing.
This site runs on Ampere Processors.