Context When developing Django web applications, one of the most popular ways to debug the performance of database queries, the values of internal variables or other custom metrics is the django-debug-toolbar. To integrate the toolbar into a Django web application, one first needs to configure a list of internal IP addresses. Only if the IP address of the web browser accessing the web application is part of this list, the toolbar will be shown. Otherwise, the toolbar is hidden (even ...

Many applications are automatically tested on each commit inside a GitLab pipeline. If your application relies on a database such as PostgreSQL, it can be tempting to use an in-memory database such as H2 for tests because it is easier to set up and destroy for each execution of your test suite. While this works for simple applications, it is no longer possible once you rely on vendor-specific SQL features (e.g., usage of column types not available in H2). In ...

In a blue-green deployment strategy, there are always two instances of your application running in production. A reverse proxy is used to direct traffic to either the green or the blue version. You then deploy changes to your application by first updating the inactive version and then changing the load balancer config to redirect traffic to the updated instance. In this video, I will show you how to set up a very simple version of such a blue-green deployment using ...

Different deployment environments (e.g., development, testing, staging and production) often require that different pieces of code are switched on and off. For example, you only want to send real emails in production and write to an email log in all other environments instead. Or your code to initialise the database should only run in the staging environment. A simple but hard to maintain way for such conditional code executions is to define a globally available variable such as isProductionSystem and write ...

Elasticsearch is a state-of-the-art full-text search engine you might want to use in your next project. It is based on a NoSQL-like document store and optimized for amazingly fast search queries. A powerful API enables features like fuzzy matching (find ‘Toronto’ when searching for ‘Torronto’), stemming (find ‘race’ when searching for ‘racing’) and n-grams (find ‘spaghetti’ with ‘ghett’). In this article, I will show you how to set up an Elasticsearch instance using Docker and PHP and how to easily ...

Bernhard Knasmüller on Software Development