Blog
Patternfly setup in React Application
To order to integrate Patternfly framework into a ReactJS application, create a new project or use an existing one npx create-react-app patternfly-setup-react Install patternfly dependencies react-core, react-table and patternfly npm i --save @patternfly/patternfly \ @patternfly/react-core @patternfly/react-table Note: Import base.css and patternfly.css in your project, or some components may diverge in appearance
July 1, 2019
Authenticate a Node application with LDAP
This post demonstrates how to authenticate a user against LDAP. Let’s start by installing basic-auth and ldapauth-fork packages npm install ldapauth-fork npm install basic-auth Steps for implementation; Add packages Create an LDAP variable with authentication configuration Basic auth should prompt for your username and password. Once the user is found, verify the given password by trying to bind the user client with the found LDAP user object and the given password. const auth = require("basic-auth"); var LdapAuth = require("ldapauth-fork"); var ldap = new LdapAuth({ url: "ldap://ldap-url:389", bindDN: "uid=rc,ou=AppAccounts,ou=People,ou=Entsys,dc=example.com", bindCredentials: "credentials", searchBase: "ou=entsys,dc=example.com", searchFilter: "(uid={{username}})", reconnect: true }); app.use("/API/admin/", (req, res, next) => { const credentials = auth(req); if (credentials) { LDAP.authenticate(credentials.name, credentials.pass, function(err, user) { if (err) { console.log(err.message); return res .status("401") .set({ "WWW-Authenticate": 'Basic realm="Access Denied"' }) .end("access denied"); } req.user = user; next(); }); } else { return res .status("401") .set({ "WWW-Authenticate": 'Basic realm="Access Denied"' }) .end("access denied"); } }); Visit basic-auth, ldapauth-fork packages for more information on configuration.
May 15, 2019
Deleting an OpenShift project stuck in terminating state
Recently I faced an issue where one of my projects got stuck in a terminating state for days. The workaround below fixed the problem. Export OpenShift project as a JSON Object oc get project delete-me -o json > ns-without-finalizers.json Replace below from
May 15, 2019
Spring Boot metrics with Prometheus and Grafana in OpenShift
Spring Boot Metrics This post will discuss how to monitor spring boot application metrics using Prometheus and Grafana. Prometheus Prometheus is a monitoring system that collects metrics from configured targets at intervals. Grafana Grafana is an open-source metric analytics & visualization tool. Micrometer The micrometer is a metrics instrumentation library for JVM-based applications. Spring Boot Actuator Spring Boot Actuator helps you monitor and manage your application when it’s pushed to production. You can control and monitor your application using HTTP or JMX endpoints.
May 15, 2019
Debugging a .NET Core application running on OpenShift
This post concerns remote debugging an ASP.NET Core application on OpenShift using Visual Studio Code. You can use any Microsoft proprietary debugger engine vsdbg with Visual Studio Code. First, list the available .Net application pods using the oc command. $ oc get pod NAME READY STATUS RESTARTS AGE MY_APP_NAME-3-1xrsp 0/1 Running 0 6s $ oc rsh MY_APP_NAME-3-1xrsp sh-4.2$ curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /opt/app-root/vsdbg -r linux-x64 Note: If your container is running behind a corporate proxy and cannot access the internet, you’ll have to build a base dotnet image with the installed debugger engine vsdbg.
May 14, 2019
Debugging a Java application in OpenShift.
This post will discuss debugging a JAVA application running inside a container. Red Hat container images When you bootstrap your JVM, you should have a way to enable JVM to debug. For example, Red Hat S2I images allow you to control classpath and debugging via environment variables. # Set debug options if required if [ x"${JAVA_DEBUG}" != x ] && [ "${JAVA_DEBUG}" != "false" ]; then java_debug_args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUG_PORT:-5005}" fi Setting the JAVA_DEBUG environment variable inside the container to true will append debug args to the JVM startup command Configure port forwarding so that you can connect to your application from a remote debugger If you are using the tomcat image, replace the JAVA_DEBUG environment variable with DEBUG
May 14, 2019
Profiling an application in OpenShift container.
Sometimes writing code that runs is not enough. We might want to know what goes on internally, such as memory allocation, consequences of using one coding approach over another, implications of concurrent executions, areas to improve performance, etc. We can use profilers for this. In this post, I’ll discuss using YourKit-JavaProfiler inside a container. Since my sample application is built using OpenShift S2I process and pushed into OpenShift internal registry, I’ll have to pull the image locally.
May 14, 2019