The goal is to produce minimal image to keep the size low and reduce attack surface. Also we want to make the docker build process fast by removing unnecessary steps and using practices outlined below to leverage internal build cache.

Besides pure Docker I’ll present docker-compose tool, which is a tool to start many Docker containers that are required to run the application, i.e. frontend server, backend server, database.

NodeJS and NPM examples

Here I’ll be using NodeJS and NPM in examples, but most of those patterns can be applied to other runtimes as well.

Laverage non-root user

Default NodeJS images have node user, but it has…

Below are my notes while learning Kubernetes, but I thought those might be useful to other people that are just starting or just need a quick dictionary for K8s concepts and resources. Enjoy!

Master Server Components

Those master components make so called control plane.

  • etcd — config store accessible to all cluster nodes
  • kube-apiserver — config workloads and org unit; REST + kubectl client
  • kube-controller-manager manages controllers, state saved to etcd
  • kube-scheduler — assigns workloads to specific nodes
  • cloud-controller-manager — bridge to specific cloud provider

Node Server Components

  • Node is a server that preforms work.
  • Container Runtime is typically Docker, but can be rkt or runc…

What is considered a good practice in Object-Oriented Programming (OOP) and Design Patterns, but is considered an anti-pattern in JavaScript (the functional programming (FP) flavor of JS at least)?

Here are the main points:

  • The good: factory pattern
  • The bad: constructor
  • The ugly: class Foo extends Bar

For classic OOP languages (Java, C#, PHP) things look pretty much the same. C# is probably better of, but I have very little experience with it, so I will be using Java as a reference point. The (anti)patterns are the same in all languages, though.

Disclaimer: The above does not mean that Object-Oriented…

Dreyfus model of skill acquisition provides hints for building effective communication - no matter if you want to delegate a task, ask for help, or just convey an idea.

Imagine that you’re an experienced software developer calling ISP technical support, because router is broken. How would you feel when they ask you if it’s plugged-in, if lights are blinking, or if you tried turning it off and on again? Let me explain why they do ask stupid questions and why you feel annoyed.

Imagine an opposite situation when you have no mechanical skills, nor experience. Your car broke down in the middle of nowhere. The car mechanic tells you that oil pump needs to be replaced. You hear it’s an easy job, so you can do it yourself. How…

Try Fish or ZSH — modern Bash alternatives that make shell more productive and cool. Do not waste time with Bash as I did.

When you’re thinking of shell on any Linux system you probably think Bash (Bourne Again Shell). On Windows too actually, as Git Bash is quite popular (despite it has got an ugly terminal emulator) and WSL (Windows Subsystem for Linux) uses Bash as well (by default). At least those have quite modern 4.x versions of Bash, while MacOS X ships an outdated 3.2 version and there are tutorials how to upgrade Bash on Mac to 5.0 which was released days ago.

The Bash 5.0 upgrade on Mac looks quite complicated and can yield unexpected errors, so that begs the question…

Singleton is really easy to write, but it’s not so simple, especially in multi-threading environments. Sure, JavaScript is single-threaded by design, but not all concurrency daemons are slayed.

Note: this is one of those posts leveraging Cunningham’s Law: the best way to get an answer is not to ask questions on the Internet, just post the wrong solution. To be honest I don’t know what’s the best way to handle Singleton with async constructor — I’m just trying to adjust best practices to JavaScript specific runtime.

Starting with the basics here’s Singleton implementation with standard blocking (non-async) constructor:

let instance;

One of the best features of Node 8.6+ is the ability to use rest/spread operator for objects. It’s still an ESNEXT stage 3, but it’s so useful already. Take a look at the snippet:

const foo = { a:1, b:2, c: 3}
const bar = { d:4, b:9 }
const foobar1 = Object.assign({}, foo, bar)
const foobar2 = {, }
console.log(foobar1, foobar2)
console.log(JSON.stringify(foobar1) === JSON.stringify(foobar2))

Object.assign() issues

The biggest problem with Object.assign() is that it modifies the first argument. If you omit the empty object literal {} it will modify the first parameter and return reference to it:

const foo…

It is a review of JDD 2014 talk by Sławomir Sobótka originally published at Future Processing technical blog along with other talks reviews. The video recording (in Polish) is available on youtube.

This talk was presented in Polish, its original title is „Jak wciągnąć eksperta domenowego w wir modelowania — wizualne i lingwistyczne techniki DDD”. It used linguistic techniques that are typical for Polish language. Nonetheless, I’ll try to get the gist out of it, because approach and way of thinking is applicable to any natural language.

The most important takeaway from this lecture for me was: naming is very…

After years of doing DevOps now I’m in situation where there are several operation teams to work with.

System administrator job is hard. They have to make sure everything works smooth all the time. That includes the complex legacy system that nobody fully understands. Such work is often invisible and goes unappreciated.

Do The Dirty Work Yourself First

For the last few days I’ve put myself into shoes of such operation person trying to install and configure software developed by me. It was quite a painful and frustrating experience trying to debug why remote syslog does not receive messages over UDP. …

How we discovered big shift an auction platform has made at the DDD training.

At Domain Driven Design training we’ve been given an exercise to model domains of Allegro (more on what’s that later) and try to mark which ones belong to Core Domain. The modeling phase went quite smooth, but we’ve faced a problem when it came to choose Core Domain of the business. My colleagues and I argued and could not came to conclusion. In hindsight the reason is obvious, but first let me tell you a story.

Allegro is an auction platform that was originally coded over the weekend and quickly became very popular in Poland. To give you an impression…

Adam Brodziak

Father. Husband. Solutions developer profesionally (software quite often). Arsenal supporter. Cyclist.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store