Welcome to oooops.dev

Latest Posts

  • Surviving Continuous Deployment in Distributed Systems
    Read the article here or watch the talk delivered at XConf Europe: Introduction This is an article about the day to day of software development. The industry seems to be at a point where a lot of us are practising Trunk Based Development and/or Continuous Deployment, or we are at least hassling our managers working towards it. I’m also a big fan. But, as cool […]
  • An Isolated Developer Setup with Docker
    In this post I am going to propose a set up to run any kind of application on a developer laptop in complete isolation. It is based on packaging the application into a Docker container, and convince it is still talking to the real world while we’re actually mocking everything around it (spoiler: using more Docker containers). I have used this in projects of various […]
  • How to attach a remote profiler to a JVM running in EC2 (and maybe Docker)
    Part of running big distributed systems at scale is encountering issues which are hard to debug. Memory leaks, sudden crashes, threads hanging… they might all manifest under extreme production conditions, but never in our laptops or test environments. That’s why sometimes we might need to go straight to the source, and be able to profile a single JVM which is under real production load. This […]
  • Visualising distance from the main sequence and other Clean Architecture metrics in Java
    I must not have been the only one to read “Clean Architecture” by Uncle Bob (Robert Martin) and be immediately sold on the abstractness, instability, coupling and main sequence metrics.I must not have been the only one to immediately Google for tools to generate them for whichever codebase I happened to be working on at the moment, anxious to see if my refactoring instincts could […]
  • See which process is occupying a port
    Sometimes during day to day development I get a Port already in use error (or a variant of it), and I quickly want to see which process I forgot to terminate. We can get the PID of the process occupying a port (e.g. 8888) with: In order to quickly kill it, we can just pipe the output into the kill command
  • Solving the Docker in Docker dilemma in your CI Pipeline
    There are some tests (integration, end to end, component…) in most modern test suites that rely on some external resources in order to run. Confusing industry terminology aside, their goal is to test the integration between some part of our application and the outside world, like a database or a queue or even some other team’s application. This is often accomplished by having a Docker […]
  • The same code with Callbacks vs Promises vs Async/Await
    Sometimes in JavaScript to have to deal with different flavours of asynchronous code, so it is handy to be able to map back and forth between them. Callback Functions that do something asynchronously are typically implemented using the callback pattern, and their implementation might look like this: They may be invoked in the following way: However, things may quickly get out of hand if we […]
  • SSH Multiplexing and Master Mode
    When using SSH bastion hosts it is common to set up new connections for many of the use cases discussed in the previous section throughout the day. Normally we would start a new TCP connection for each one of them. However, open TCP connection are a finite resource on any machine, and each one of them takes some time to set up. Multiplexing is a […]
  • SSH X11 Forwarding
    If you are using SSH between Unix-like operating systems, you can also forward GUI applications over SSH. This is especially useful if your server doesn’t really have a user interface, but you need to check something on the fly with a web browser running on it. This is possible because all Unix-like systems share a common GUI windowing system called X11, which is what provides […]
  • SSH Tunnelling and Port Forwarding
    In the previous section we saw how to make use of a jump host as a proxy to run commands into a remote machine. Sometimes however, having a shell is not necessary, and the connectivity aspect of having a secure channel to the remote host is way more interesting.SSH’s port forwarding feature allows us to create a secure channel to the remote host, and then […]
  • Jumping SSH Hosts
    Sometimes some servers are unreachable to us due to network topology barriers, which are put in place for security reasons. A common way to allow developers and sysadmins access is to provide public “bastion” or jump hosts, where one can obtain a shell and then use it to connect to one’s destination. Looking at the picture above, things may seem pretty simple – but how […]
  • SSH Config
    As well as having to type passphrases, remembering the right user, key file, port and other settings for each host you want to SSH into might quickly become overwhelming. That’s why, in addition to the command line options we saw so far, SSH also allows to read the same options from configuration files. The configuration data will be applied from the following sources in the […]
  • SSH Agent
    If you are using key pair based authentication with a passphrase for your keys, things can quickly get tedious as you have to input the passphrase every time you want to connect somewhere. If you want to avoid that, you can optionally use another preinstalled tool: ssh-agent. The ssh-agent is a little helper program that keeps track your identity keys and their passphrases. The agent […]
  • SSH Known Hosts
    Much like how the authorized_keys file is used to authenticate clients on the server, there is another file in the ~/.ssh folder called known_hosts, which is used to authenticate servers to the client. Whenever SSH is configured on a new server it always generates a public and private key pair for the server, just like you did for your user in the previous section. Every time you connect […]
  • SSH Authentication methods
    There are two ways of authenticating to a server with SSH: user/password based authentication (which is now by many considered outdated and insecure) and key pair based authentication. Let’s start from the legacy one and build up to the modern way of doing things: Username and Password Based Authentication In this version, all you will need to to connect to your server is to run
  • [Series] SSH for Developers – Beyond the Basics
    I have written this guide for developers who might be superficially familiar with the basics of SSH – maybe even fiddled with a file or two without really knowing what’s going on – and would like a more cohesive overview of its most powerful features. This is essentially an organised collection of the main gotchas and topics that gave me (a dev, not a sysadmin) […]
  • File Limits and how the “Too many open files” error can pop up unexpectedly
    I have recently come across a nasty Too many open files error, and noticed the information on the internet about what that might mean or how to solve it doesn’t always paint a clear picture. Here I try to put together a more complete guide by gathering all the resources I found as I was dealing with the issue myself. What are file limits and […]
  • One line Bash HTTP Server
    Here is a quick snippet I use all the time when I want to set up an HTTP server on the fly, without leaving the comfort of my terminal. This is the command: Warning: this will block your current terminal. You will see the following output as you receive requests: If you want your terminal back, or for any other reason want to put the […]
  • Super Quick Node.js HTTP Server
    This will start a simple server on port 3000. Save to a file index.js Run with: Output:
  • [Meta] Hello World
    Hi everyone, just set up this blog. It’s going to be a bit of a mix of new things I learn, handy code snippets, and obscure issues I find in my day to day work. Basically a dumpster replacement for my personal notes. But with any luck some of it might be useful to someone. Hopefully I’ll find the willpower to keep it up to […]

Categories