Most applications depend on external factors that have different values depending on the environment where they are deployed. We mostly use for that environment variables. Guess what? Most of React Apps also have this need. In this blog posts presents a clean(er) way to make a multi-stage deployment of a Create React App on a Kubernetes Cluster. You can use this approach for a seamless integration into your continuous deployment pipeline.

In the beginning it will you show how to set up the React App and then guide you through several deployment possibilities on Kubernetes. You will deploy with native kubectl commands, with helm, with kustomize and in the end use skaffold.

The example app displays the latest public bookmarks published on www.codever.land. Depending on the environment the app is built for, it will display the environment name in the navigation bar and the header’s color is different.

The source code is available on Github

TLDR;

Create a config.js file where you inject the environment variables in the window object (e.g. window.REACT_APP_API_URL=’https://www.codever.land/api/public/bookmarks’). Add this file to the public folder of your react application. Dockerize the react application and at Kubernetes deployment time overwrite the config.js file in the container - you can do that with Kubernetes configMaps via native kubectl commands, kustomize or helm.

Continue Reading ...

We have recently reached a second major milestone on www.codever.land. There are now more than 10k curated public dev bookmarks available. To be more precise there are exactly 11869 public dev bookmarks at the time of this writing . You can find there programming resources for languages like java, javascript, go, python to query languages sql, graphql, to free-programming-books but also “exotic” stuff like genetic-algorithms and astronomy.

All of these dev resources are personally curated or by the users who submitted them - thank you very much for your contributions. The rest are imported from the Awesome collections.

Continue Reading ...

Motivation

Finding the desired link again can be sometimes a tedious job. It can even become frustrating when you don’t find it in a reasonable amount of time, because you know it’s there somewhere, you visited it before… After a struggle of about two or more minutes you finally find it.

Nailed it

This time you bookmark it and then you say to yourself - “from now on I will be more disciplined and consciously use bookmarks”.

bookmark (verb) - record the address of (a website, file, etc.) to enable quick access in future.

So far, so good. The problem is your bookmarks can turn into a monster themselves and you can later lose then more time browsing through them to find the right one, because you know now you bookmarked it…

Or didn't you?
Or didn't you?
Continue Reading ...

So you are developing a core platform for your enterprise. Your platform becomes successful, you have more clients consuming your services. Some (most) will need some core data synchronized in their systems. You might start experiencing the following pains

Pains

  1. You might use a push mechanism to notify clients about an core element update (e.g. user or organisation data update). But what happens when a new client ist added? Well your core platform needs to be aware of it. This might imply code or configuration changes, new deployments etc. - ** it does not scale **
  2. If a client of the platform is not online the time the update notification is pushed, it will miss the update, which might lead to data inconsistency.

Pub/Subscribe to the rescue

Both issues are elegantly solved if you use a publish/subscribe mechanism. Your core platform, the publisher, will publish the update event to a message broker, that will be consumed by one or several clients, subscribers. See the diagram below for the 1000 words, worth of explanation:

Continue Reading ...

Last week I showed you how to increase the performance of multiple java calls by making them asynchronous and parallel. This week we take a look at another potential performance booster, you should always keep in mind - caching.

Let’s imagine a scenario where you call a REST service and you know the returned values don’t change very often. In this case you really need to consider caching the response. We will use Guava’s provided caching capabilities to implement such a cache for this example.

Continue Reading ...