3.5. OpenShift Installation
You may want to choose an OpenShift Cluster installation if you are using the OpenShift Container Platform to deploy your applications.
If you want to install on OpenShift via Helm Chart please see chapter HelmChart Installation.
3.5.1. Prerequisites
Please make sure that you provide the following prerequisites:
-
a valid licence file is needed (get it at speedgain.com)
-
a OpenShift Container Platform accessible via oc terminal command and web interface
-
4 CPU Cores, 16GB RAM and at least 100GB to store data
-
a modern web-browser
3.5.2. Services
One service can’t be run on its own. It has to be executed in a compose with 5 other services (all available on Docker-Hub and via ITGAIN download portal: itgain.sharefile.eu ). The list of all 6 images:
-
Timescale - as the repository to store all performance metrics
-
Speedgain Collector - the core component to pull metrics
-
Speedgain Service - rest api service
-
Speedgain Frontend - web-frontend
-
Speedgain Grafana - delivering all needed dashboards
-
NginX - as reverse proxy
3.5.3. Install Step-by-Step
To install and run Speedgain for Databases as an OpenShift Cluster installation follow these steps:
-
Get at least a trial license via speedgain.com
-
Copy the licence file Speedgain_for_Databases.licence to your file system
-
The license file must be made available in the Openshift Cluster. To do this, the provided file must be created as a ConfigMap with the following command:
oc create configmap s4dbs-licence --from-file Speedgain_for_Databases.licence
-
You may want to download and extract the Speedgain OpenShift all files package
-
Copy or create the Openshift NginX configuration file nginx.conf to your file system
-
The Nginx configuration file must be made available in the Openshift Cluster. To do this, the provided file must be created as a ConfigMap with the following command:
oc create configmap s4dbs-nginx-conf --from-file nginx.conf
-
Create a secret named "s4dbs-secrets". Add a key called "postgres-password" with the desired performance database password as value. Your password will be base64 encoded in Openshift if you use the stringData map with your cleartype password. You may want to use the Speedgain secrets configuration file s4dbs-secrets.yaml via
oc apply -f s4dbs-secrets.yaml
-
Provide a persistent volume claim called "s4dbs-postgres-pv-claim" to persist the collected performance data. The size depends on the databases to be monitored. A good value is 100 GB.
-
Provide a persistent volume claim called "s4dbs-grafana-dashboards-pv-claim" to persist the dashboards used in Grafana to visualize the performance data. A good value for its size is 1 GB.
-
Provide a persistent volume claim called "s4dbs-grafana-pv-claim" to persist the application data of Grafana. A good value for its size is 10 GB.
-
Review the provided deployment YAML files. Verify that the docker images can be accessed in your Openshift cluster. If you do not have direct access to Docker-Hub, download images from our download portal and transfer to the docker repository used by your Openshift Cluster via
docker load --input s4dbs_vx.x.x_all_images.tar.gz
-
Import the Speedgain Timescale deployment file s4dbs-postgres.yaml via
oc apply -f s4dbs-postgres.yaml
-
Import the Speedgain Collector deployment file s4dbs-collector.yaml via
oc apply -f s4dbs-collector.yaml
-
Import the Speedgain Service deployment file s4dbs-service.yaml via
oc apply -f s4dbs-service.yaml
-
Review the Speedgain Grafana deployment file s4dbs-grafana.yaml. Replace the <enter host hostname here> tags with the hostname of your application. Import the file via
oc apply -f s4dbs-grafana.yaml
-
Review the Speedgain Web Frontend deployment file s4dbs-frontend.yaml. Replace the <enter host hostname here> tags with the hostname of your application. Import the file via
oc apply -f s4dbs-frontend.yaml
-
Import the Speedgain Reverse Proxy deployment file s4dbs-reverse.yaml via
oc apply -f s4dbs-reverse.yaml
-
Create a route to the s4dbs-reverse-service. Specify name, hostname and path to your liking. The target port is 8080. Also, if you like to use a secure connection you can choose that option.
-
The application wil be available via the hostname of the created route
3.5.4. Customization Options
For customization options, please review the Docker Compose installation section.
3.5.5. Speedgain OpenShift all files package
3.5.6. Speedgain Collector deployment file s4dbs-collector.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: app: s4dbs-collector name: s4dbs-collector-deployment spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: s4dbs-collector template: metadata: labels: app: s4dbs-collector spec: containers: - name: s4dbs-collector image: docker.io/itgainis/s4dbs_collector:1.6.0 imagePullPolicy: Always env: - name: PDB_DB_NAME value: speedgain - name: PDB_HOST value: s4dbs-postgres-service - name: PDB_PASS valueFrom: secretKeyRef: name: s4dbs-secrets key: postgres-password - name: PDB_PORT value: "5432" - name: PDB_USER value: postgres - name: SPGLOGLEVEL value: INFO volumeMounts: - mountPath: /SPEEDGAIN/licence/Speedgain_for_Databases.licence subPath: Speedgain_for_Databases.licence name: s4dbs-licence readOnly: true restartPolicy: Always volumes: - name: s4dbs-licence configMap: name: s4dbs-licence
3.5.7. Speedgain Timescale deployment file s4dbs-postgres.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: app: s4dbs-postgres name: s4dbs-postgres-deployment spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: s4dbs-postgres template: metadata: labels: app: s4dbs-postgres spec: volumes: - name: postgres-pv-storage persistentVolumeClaim: claimName: s4dbs-postgres-pv-claim containers: - name: s4dbs-postgres image: docker.io/timescale/timescaledb:2.11.2-pg13 ports: - containerPort: 5432 imagePullPolicy: Always env: - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: s4dbs-secrets key: postgres-password - name: PGDATA value: /var/lib/postgresql/data/pgdata volumeMounts: - name: postgres-pv-storage mountPath: /var/lib/postgresql/data --- apiVersion: v1 kind: Service metadata: name: s4dbs-postgres-service spec: selector: app: s4dbs-postgres ports: - protocol: TCP port: 5432 targetPort: 5432
3.5.8. Speedgain Service deployment file s4dbs-service.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: app: s4dbs-service name: s4dbs-service-deployment spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: s4dbs-service template: metadata: labels: app: s4dbs-service spec: containers: - name: s4dbs-service image: docker.io/itgainis/s4dbs_service:1.6.0 ports: - containerPort: 8080 imagePullPolicy: Always env: - name: PDB_DB_NAME value: speedgain - name: PDB_HOST value: s4dbs-postgres-service - name: PDB_PASS valueFrom: secretKeyRef: name: s4dbs-secrets key: postgres-password - name: PDB_PORT value: "5432" - name: PDB_USER value: postgres - name: SPGDB_SERVICE_HOME value: /tmp/spgdb_service_home/ restartPolicy: Always --- apiVersion: v1 kind: Service metadata: name: s4dbs-service-service spec: selector: app: s4dbs-service ports: - protocol: TCP port: 8080 targetPort: 8080
3.5.9. Speedgain Grafana deployment file s4dbs-grafana.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: app: s4dbs-grafana name: s4dbs-grafana-deployment spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: s4dbs-grafana template: metadata: labels: app: s4dbs-grafana spec: volumes: - name: grafana-pv-storage persistentVolumeClaim: claimName: s4dbs-grafana-pv-claim - name: grafana-dashboard-pv-storage persistentVolumeClaim: claimName: s4dbs-grafana-dashboards-pv-claim containers: - name: s4dbs-grafana image: docker.io/itgainis/s4dbs_grafana:1.6.0 ports: - containerPort: 3000 imagePullPolicy: Always env: - name: PDB_DB_NAME value: speedgain - name: PDB_HOST value: s4dbs-postgres-service - name: PDB_PASS valueFrom: secretKeyRef: name: s4dbs-secrets key: postgres-password - name: PDB_PORT value: "5432" - name: PDB_USER value: "postgres" #- name: GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH # value: "/grafanaprovisioning/dashboards/s4dbs-spg/S4DBs-Overview.json" - name: GF_SERVER_SERVE_FROM_SUB_PATH value: "true" - name: GF_SERVER_ROOT_URL value: "%(protocol)s://%(domain)s:%(http_port)s/grafana/" - name: GF_SERVER_DOMAIN value: ##enter dns name of route here (will be created later) ## - name: GF_SECURITY_ALLOW_EMBEDDING value: "true" - name: GF_AUTH_ANONYMOUS_ENABLED value: "true" - name: GF_USERS_DEFAULT_THEME value: "light" - name: GF_PATHS_PLUGINS value: "/grafanaplugins/" - name: GF_PATHS_PROVISIONING value: "/grafanaprovisioning/" volumeMounts: - name: grafana-pv-storage mountPath: /var/lib/grafana - name: grafana-dashboard-pv-storage mountPath: /grafanaprovisioning/ restartPolicy: Always --- apiVersion: v1 kind: Service metadata: name: s4dbs-grafana-service spec: selector: app: s4dbs-grafana ports: - protocol: TCP port: 3000 targetPort: 3000
3.5.10. Speedgain Web Frontend deployment file s4dbs-frontend.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: app: s4dbs-frontend name: s4dbs-frontend-deployment spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: s4dbs-frontend template: metadata: labels: app: s4dbs-frontend spec: containers: - name: s4dbs-frontend image: docker.io/itgainis/s4dbs_frontend:1.6.0 ports: - containerPort: 8080 imagePullPolicy: Always env: - name: FRONTEND_CONFIG_MODE value: "false" - name: SERVICE_PROTOCOL value: http - name: SERVICE_HOST value: <enter host hostname here> - name: SERVICE_PORT value: "30800" - name: GRAFANA_PROTOCOL value: http - name: GRAFANA_HOST value: <enter host hostname here> - name: GRAFANA_PORT value: "30800/grafana" restartPolicy: Always --- apiVersion: v1 kind: Service metadata: name: s4dbs-frontend-service spec: selector: app: s4dbs-frontend ports: - protocol: TCP port: 8080 targetPort: 8080
3.5.11. Speedgain Reverse Proxy deployment file s4dbs-reverse.yaml
apiVersion: apps/v1 kind: Deployment metadata: labels: app: s4dbs-reverse name: s4dbs-reverse-deployment spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app: s4dbs-reverse template: metadata: labels: app: s4dbs-reverse spec: containers: - name: s4dbs-reverse image: docker.io/nginx:1.23 ports: - containerPort: 8080 imagePullPolicy: Always volumeMounts: - mountPath: /etc/nginx/nginx.conf subPath: nginx.conf name: s4dbs-nginx-conf readOnly: true restartPolicy: Always volumes: - name: s4dbs-nginx-conf configMap: name: s4dbs-nginx-conf --- apiVersion: v1 kind: Service metadata: name: s4dbs-reverse-service spec: selector: app: s4dbs-reverse ports: - protocol: TCP port: 8080 targetPort: 8080 --- kind: Route apiVersion: route.openshift.io/v1 metadata: name: s4dbs labels: app.kubernetes.io/managed-by: Helm spec: to: kind: Service name: s4dbs-reverse-service port: targetPort: 8080
3.5.12. Openshift NginX configuration file nginx.conf
worker_processes 5; ## Default: 1 pid /tmp/nginx.pid; events { worker_connections 1000; } http { client_body_temp_path /tmp/client_temp; proxy_temp_path /tmp/proxy_temp_path; fastcgi_temp_path /tmp/fastcgi_temp; uwsgi_temp_path /tmp/uwsgi_temp; scgi_temp_path /tmp/scgi_temp; map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream grafana { server s4dbs-grafana-service:3000; } upstream service { server s4dbs-service-service:8080; } server { listen 8080; root /usr/share/nginx/www; index index.html index.htm; #SSL Config # Enable the following 4 lines if SSL should be activated: # listen 443 ssl http2; # listen [::]:443 ssl http2; # ssl_certificate_key /etc/ssl/ssl_cert.key; # ssl_certificate /etc/ssl/ssl_cert.crt; # service location /Speedgain_for_Databases_Service/ { proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://service; } # frontend location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://s4dbs-frontend-service:8080/s4dbs-ui/; } location /s4dbs-ui/ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://s4dbs-frontend-service:8080/s4dbs-ui/; } # grafana location /grafana/ { proxy_set_header Host $http_host; proxy_pass http://grafana; proxy_read_timeout 300; proxy_connect_timeout 300; proxy_send_timeout 300; } location /grafana/api/live/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $http_host; proxy_pass http://grafana; proxy_read_timeout 300; proxy_connect_timeout 300; proxy_send_timeout 300; } } }
3.5.13. Speedgain secrets configuration file s4dbs-secrets.yaml
apiVersion: v1 kind: Secret metadata: name: s4dbs-secrets type: Opaque stringData: postgres-password: <PasswordOfPostgresUser>