Notes on creating microservices-based applications

This post is a collection of tips and notes I gathered while working on microservices-based applications for last couple of months. The notes are divided in a couple of sections that focus on the different areas during development and running your services. I have decided to write more low level notes/tips to focus on specific problems, for more high-level overview see: The Twelve-Factor App Project Setup Each service should be a self-contained project, hosted in a separate repository.

Running Tor Node Inside Docker

Over last few weeks I have been playing around with creating docker container to host a Tor node on one of my VPS servers. As a result of those efforts I created a Github repository: https://github.com/wlk/docker-tor-relay with the Docker image, it’s also hosted on DockerHub here: https://hub.docker.com/r/wlkx/docker-tor-relay/ (and configured as automated build) Both DockerHub and Github README provide enough information on how to use it, so I won’t go into details here, but I’ll focus on 2 Docker features that I used in this toy project.

Simple way to create Scala scripts

This post is a description of a small project idea developed by a friend of mine: Przemysław Pokrywka, I’m just writing down the idea as a blog post. There are many ways one can execute Scala code, most people use sbt to create a some kind of build, for example fat jar or something similar or just sbt-native-packager to build the application in more native formats. But what options do you have in case you want to write Scala scripts?

Testing Akka Performance

Few weeks ago I attended a workshop called “Understanding Mechanical Sympathy” ran by Martin Thompson. During that workshop we written and tested few concurrent programming techniques and as a first exercise we have written a simple Ping-Pong program: package uk.co.real_logic; import static java.lang.System.out; /* Original exercise did during "Lock Free Workshop" by Martin Thompson: http://www.real-logic.co.uk/training.html */ public final class PingPong { private static final int REPETITIONS = 100_000_000; private static volatile long pingValue = -1; private static volatile long pongValue = -1; public static void main(final String[] args) throws Exception { final Thread pongThread = new Thread(new PongRunner()); final Thread pingThread = new Thread(new PingRunner()); pongThread.

How To Setup Garmin 310XT To Work With Linux

In this post I intent to provide a overview of the steps that need to be performed to setup Garmin 310XT GPS Sports Watch to work with Linux (Ubuntu). (This tutorial should also apply to other similar Garmin GPS Watches -Garmin Forerunner 60 – 405CX – 310XT – 610 – 910XT) Install Required Packages sudo apt-get install python-pip python-qt sudo pip install pyusb Install GFrun GFrun is the program that you can use to download recorded workouts from your watch.

How To Setup CI Build Pipeline With Travis CI, Heroku and sbt

This post covers all steps that are required to setup a Continuous Integration (CI) build pipeline using Travis CI as a main driver for deploying our Play application written in Scala to Heroku cloud. Expected end result: After each commit to the master branch of my Github project, I’d like to run full test suite. Following that, each successful build, should trigger a deployment to Heroku. If the tests fail, application should not be deployed.

JSON in Play Framework - Advanced Libraries

This is a followup post to my previous one covering JSON in Play framework. I’d like to show how the manual work I did before in trying to make JSON mapping compatible with external API can be done by using 2 small but useful libraries: [play-json-naming](https://github.com/tototoshi/play-json-naming) [play-json-extensions](https://github.com/xdotai/play-json-extensions) play-json-naming This is a very simple library that can be used to convert from camelCase formatting (the default one that we use in Scala) to snake_case formatting that is common in various different languages (for example PHP or Ruby).

JSON in Play Framework - Techniques For Making Compatible Mappings

I’ll show 2 slightly advanced techniques for working with JSON in Play Framework (play-json) that are useful especially when you need to control the mappings yourself. For example when you have to make sure that your API is compatible with existing applications. The examples are based on my project Game Arena (which is in very early stages of development) One suggestion, before we start, take a look at Play Framework JSON documentation which is truly quite comprehensive and provides a very good introduction to JSON usage in Play.

Scala Case Classes vs Enumeration

After my previous post which was received quite nicely, I wanted to write a little bit more about the topic of designing Typesafe Domain objects, this time I’ll focus on the problem of how to model a deck of cards in Scala. I’ll go over 2 different approaches you might take when designing a solution to the problem of card games in Scala. I’ll try to show how this can be done with Case Classes (Sealed Case Objects) and Enumerations.

Typesafe Domain Objects in Scala

Today I’d like to cover the topic of how to approach type safety in Scala in case of the simple domain of players in free to play games - this is a real example from a past project of mine. If you have played any of the free to play online games, you are already aware that these games every often have 2 kinds of currencies: In game cash or points that can be earned and spent during the game play