<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Urban Massage Product - Medium]]></title>
        <description><![CDATA[Read about any interesting projects, cool tech we&#39;ve been working with and any other tid-bits we do within the Urban Massage product team - Medium]]></description>
        <link>https://medium.com/urban-massage-product?source=rss----afa76cb6d0f8---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Urban Massage Product - Medium</title>
            <link>https://medium.com/urban-massage-product?source=rss----afa76cb6d0f8---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 08:45:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/urban-massage-product" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A smaller Docker image for Node.js]]></title>
            <link>https://medium.com/urban-massage-product/a-smaller-docker-image-for-node-js-792855edfe25?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/792855edfe25</guid>
            <category><![CDATA[node]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Giles Williams]]></dc:creator>
            <pubDate>Fri, 07 Jul 2017 13:19:29 GMT</pubDate>
            <atom:updated>2017-07-07T13:19:29.154Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://hub.docker.com/r/urbanmassage/node/">https://hub.docker.com/r/urbanmassage/node/</a></p><p>Here at Urban Massage, we use Docker to containerise + deploy all of our websites &amp; services.</p><p>The majority of our apps are written in Node.js, and like a lot of other engineering teams, we picked the default Node.js Docker image.</p><p>With small microservices, build times are naturally pretty low, which is great — however we quickly realised that a significant amount of time was being taken up dealing with fetching + pushing Docker images, as the default Node.js Docker image is nearly 200mb!</p><h4>What about native modules?</h4><p>As long as you build on the same architecture as the image, you’ll be fine — your built modules will be copied into the image.</p><p>We use CircleCI for our build process, which uses Ubuntu, so we just make sure to run npm install on the build machine, before the docker build runs.</p><h4>How do I use it?</h4><p>All you need to do is make your base image urbanmassage/node:VERSION-slim (where <em>VERSION</em> is the node version you wish to target). We currently have tags for a number of major versions ranging from 0.10 all the way to 8. See below for an example Dockerfile:</p><pre>FROM urbanmassage/node:8-slim</pre><pre>WORKDIR /usr/src/myservice<br>COPY . /usr/src/myservice</pre><h4>Want to see the code?</h4><p>Take a look here — <a href="https://github.com/urbanmassage/docker-node">https://github.com/urbanmassage/docker-node</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=792855edfe25" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/a-smaller-docker-image-for-node-js-792855edfe25">A smaller Docker image for Node.js</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Testing vs Testing*]]></title>
            <link>https://medium.com/urban-massage-product/automated-testing-vs-testing-bc6eb475a489?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/bc6eb475a489</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[automated-testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Oleg Desantis]]></dc:creator>
            <pubDate>Fri, 30 Jun 2017 14:02:23 GMT</pubDate>
            <atom:updated>2017-06-30T14:02:22.996Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>*by a human.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVgnJoA9mu58qIfIiwpWSA.jpeg" /></figure><p>The aim of this article is to help educate testers and their colleagues about the reasoning behind why testers (humans) should not and cannot be replaced by machines. We will also look at the difference between automated testing and testing and how automation can be used to aid us. The implementation of automated testing is out of scope of this article but it will cover some practical principles.</p><p>I would like to start by crediting a friend and a colleague, Joshua Gladwin, for contributing to this article, as a qualified Psychologist he has a deep insight into how humans think and the complexity involved in building a machine that can mimic human thinking (artificial intelligence).</p><blockquote>If we want to avoid a ‘Skynet’ scenario then let’s Keep It Simple (KISS principle). Test frameworks, tools and machines are all resources intended to help us execute regression tests that we (as testers) have designed.</blockquote><p>The reason why testers should not and cannot be replaced entirely by machines is because in today’s world complexity and ambiguity are on the rise — adaptability is the answer, real-time, on demand adaptability to changes that may occur, with context, scenarios and parameters. But who can adapt better: a human or a machine — and why?</p><blockquote>You can build a machine that can test given parameters but the machine will not be able to incorporate additional factors without human intervention.</blockquote><p>A human by nature is a tester — our basic drive as a species is to test ’cause and effect’ to gain control and make resource allocation as efficient as possible. Throughout evolution we have tested, this goes back to the most basic curiosity of ‘what happens if I touch the fire?’ — as a human we learn from the instant feedback of burning our self and we don’t do it twice, that’s for sure! But you may test the fire with other parameters.Take ‘A+B = ?’ test as an example, a human can adapt a test by adding C, D, E variables into the equation as they test. A machine cannot adapt the test, it can only run the test on the parameters it is given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2Pzj7WhjimXazZTfpfC6g.jpeg" /></figure><p>Humans can also predict change, take a multitude of factors and risks into account and therefore adapt as necessary. A human can postulate the possibility of X happening and so test for Y just in case. A machine cannot identify risks that it has not been programmed to. Yes, we can build predictive learning machines, but can you build an efficient and adaptable machine that can predict outcomes? A machine may predict X may occur and so might trigger another test incorporating those variables, but this would be inbuilt within the instruction by a human.</p><blockquote>We shouldn’t be relying on machines and technology to do the thinking for us but instead use them to aid us in discovering, learning and adapting quickly to changes.</blockquote><p>In the last decade alone technology has evolved rapidly and has become more affordable and accessible to the public. This has given way to more possibilities but also increased the speed at which we want things (real time on demand services). Software companies must ensure they deliver excellent quality products as quickly as possible on a multitude of platforms and devices. To meet these demands we can harness the power of distributed or cloud computing, and run automated tests on all the supported platforms and devices required.</p><p>Technology can aid us in becoming better testers, we can use it in conjunction with automation in different ways. Like Tony Stark uses his Iron man suit to aid him in dealing with badies (obstacles), we can use automation, tools and machines to aid us in testing. For example, if you need to check that X number of redirects are working, as a human it may take you a while to get through all of them. Instead, you can write a small program that retrieves actual URLs from Excel row A, execute them via e.g. Selenium and compare the result against expected URLs from row B. This program can now be added to your arsenal of tools to aid you in the future.</p><p>Lastly, I’d like to suggest to my fellow testers and their colleagues that we refer to automated testing as automated checking to draw a clear line of separation between machines executing a test and a human carrying out testing. I see this as once a tester has developed a test case and executed it, it becomes a check for a machine to execute as part of regression.</p><h4>Summary</h4><p>As we have seen automated testing is very different to testing done by a human. Automation frees up testers to focus on more complex work that a machine cannot do, however, we can use it to build out an arsenal of tools to aid us in testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc6eb475a489" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/automated-testing-vs-testing-bc6eb475a489">Automated Testing vs Testing*</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nginx with Docker readonly filesystem: easier said than done]]></title>
            <link>https://medium.com/urban-massage-product/nginx-with-docker-easier-said-than-done-d1b5815d00d0?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/d1b5815d00d0</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Louay alakkad­]]></dc:creator>
            <pubDate>Fri, 29 Apr 2016 10:39:08 GMT</pubDate>
            <atom:updated>2016-05-03T21:37:49.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igO3B4Enk_bzcZJadSZEmA.png" /></figure><p>You know that ‘damn’ moment you get when you see things like your api returning incomplete JSON response? or your file uploads crashing your server for no obvious reason? We’ve had a lot those recently, and this article is here to spare you a few of them.</p><h4>TL; DR</h4><p>Use <a href="https://gist.github.com/louy/8e0618e753394b1229346c6842bc5332">this</a>.</p><h4>The Long Version</h4><p><em>Docker</em> is an amazing product. We’ve been relying on it for months now as an essential part of our CI/CD setup. The ability to move your applications around as immutable images and guarantee that your development environment is identical to your staging/production ones is just amazing. But it has its drawbacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*mxheMOOSyurXDJ2DPTkDnA.png" /></figure><p>The main issue with docker comes from its main feature, immutability. A file system where you cannot add, change or remove any files doesn’t play well with <em>Nginx</em>’s —arguably the best http server out there— heavy reliance on writing temporary files to disk, and that’s why you start seeing all sorts of problems when you mix the two together.</p><p>You’d expect the <a href="https://github.com/nginxinc/docker-nginx/blob/19799fa644461ed6c5ea07c0bc0ea0cc277c2d77/mainline/jessie/Dockerfile">official nginx docker image</a> to solve this for you, but no, it doesn’t. And neither does <a href="https://www.nginx.com/blog/deploying-nginx-nginx-plus-docker/">this tutorial on nginx’s official website</a> nor <a href="https://www.digitalocean.com/community/tutorials/docker-explained-how-to-containerize-and-use-nginx-as-a-proxy">this one on <em>DigitalOcean</em>’s community blog</a> warn you about any potential problems.</p><blockquote>mkdir() “/var/cache/nginx/proxy_temp/1/70” failed (30: Read-only file system) while reading upstream, client: 10.10.10.10, server: urbanmassage.com, request: “GET / HTTP/1.1”, upstream: “http://10.10.10.11:80/&quot;, host: “urbanmassage.com”, referrer: “”</blockquote><p>You see the message above, and you panic, trying to figure out why does nginx want to write to <em>“/var/cache/nginx/proxy_temp”</em> and you realise it’s the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_temp_path"><strong>proxy_temp_path</strong></a><strong> </strong>option. So you turn off <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering"><strong>proxy_buffering</strong></a>.</p><pre>proxy_buffering off;</pre><p>A few days later, you see another one and say to yourself “I’ve got this”.</p><blockquote>open() “/var/cache/nginx/client_temp/0000000939” failed (30: Read-only file system), client: 10.10.10.10, server: urbanmassage.com, request: “POST /webhooks/braintree HTTP/1.1”, host: “urbanmassage.com”</blockquote><p>And then you realise that it’s not as simple as turning something off. You have to set <strong>client_body_buffer_size</strong> to the same value as <strong>client_max_body_size</strong>. And so you do, adding a comment about that to your config file warning the next guy not to change one without the other.</p><pre># These two should be the same or nginx will start writing <br># large request bodies to temp files <br>client_body_buffer_size 10m; <br>client_max_body_size 10m;</pre><p>Thinking that you might have missed something, you do another google search on setting up nginx with docker, and you go through all those tutorials but no one seems to mention issues like this at all. And then you say to yourself, “I must write something about this”, or at least I did.</p><p>As a final note: there are a couple more options that are recommended to be turned on in nginx but do not work with docker. e.g. <strong>sendfile</strong>. So just be careful whenever you enable anything. You can use <a href="https://gist.github.com/louy/8e0618e753394b1229346c6842bc5332">this file</a> to start.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f52d5e635d1a6e71044d931e9b8b8b83/href">https://medium.com/media/f52d5e635d1a6e71044d931e9b8b8b83/href</a></iframe><p>And there you have it.</p><p><strong>Update:</strong> As some people <a href="https://www.reddit.com/r/docker/comments/4h06t9/nginx_with_docker_easier_said_than_done_urban/">pointed</a> <a href="https://medium.com/@massenz/im-utterly-confused-mate-the-filesystem-mounted-by-docker-unless-you-go-to-some-length-to-make-f5c9279abcfd#.u3el0aru4">out</a>, this only applies to certain setups. The read-only filesystem can be turned off in docker easily but our setup doesn’t support that yet (we use <a href="https://github.com/remind101/empire">empire</a> on top of AWS ECS.) There are a couple more solutions like — tmpfs and volumes, but neither of them is supported in our setup and we’ll be sticking to the solution below for a while.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1b5815d00d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/nginx-with-docker-easier-said-than-done-d1b5815d00d0">Nginx with Docker readonly filesystem: easier said than done</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Replicating a Heroku-centric workflow within AWS]]></title>
            <link>https://medium.com/urban-massage-product/replicating-a-heroku-centric-workflow-within-aws-c4dfd954ad?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/c4dfd954ad</guid>
            <dc:creator><![CDATA[Giles Williams]]></dc:creator>
            <pubDate>Mon, 25 Apr 2016 20:49:30 GMT</pubDate>
            <atom:updated>2014-11-24T16:33:12.061Z</atom:updated>
            <content:encoded><![CDATA[<p>We chose to host the majority of our platform on Heroku from day one having used it for previous projects — for a small team at small-ish scale, deploying maybe 10 times a day, there couldn’t be a better solution.</p><p>However, as we have grown at an amazing rate over the past 3–4 months, we quickly outgrew the initial cheap pricing of the Heroku platform (Heroku include a free instance for each app you run), along with all of the handy freemium-priced add ons available such as MySQL, Neo4J, RabbitMQ, redis and elastic search hosting.</p><p>We knew that before migrating and having to managing our own resources again, we needed to come up with a decent solution to replace the super-simple `git push` deploys that Heroku offered.</p><p>We had been using <a href="http://codeship.io/">codeship.io</a> as a platform to run all of our automated test suites whenever a branch is pushed to our Bitbucket repositories, but not really exploited the continuous delivery side of the service yet.</p><p>We ended up settling for ElasticBeanstalk (EB) over the option of managing our own instances and auto-scaling on EC2, so started with a test version of our API to try it out. We created a new Web Server application and environment in EB, selecting a Node.js configuration with the type set to Load balancing, autoscaling and chose MySQL as our database type.</p><p>EB allows you to set ENV variables to be passed into your application (similar to the `<em>heroku config</em>` command) so once those were copied over, we got to connecting codeship to our application in EB.</p><p>Adding a new deploy target in codeship is really easy (<a href="https://codeship.com/documentation/faq/getting_started_with_ci/">see these guides</a> for more info about how to setup codeship with your git repository and getting your tests passing) — you just go to the Project Settings, select Deployment on the left, and choose the branch you wish to deploy and the deployment method. We always maintain `staging` and `production` branches, which each represent the release currently in each environment. We chose our `staging` branch, selected the ElasticBeanstalk target and entered our newly created IAM user and EB application / environment details.</p><p>After the next push, we had our app running on EB. We quickly updated the ENV variables for our app to use the RDS (MySQL) endpoint configured during setup of the EB environment, as well as creating a redis cluster via the ElastiCache AWS service and updating our cache URL ENV vars accordingly.</p><p>Once this was complete, we had a complete version of our environment running in AWS — we have always run our own Neo4J, RabbitMQ and elastic search instances / clusters on EC2 and were happy to continue doing so.</p><p>All-in-all, we managed to get deployments of our API down to about 1–2 minutes, including running our full test suite — compared to handling the deployment of code to multiple instances and implementing rolling updates, we were happy to go from 30 second (on Heroku) to 2 minute deploys!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4dfd954ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/replicating-a-heroku-centric-workflow-within-aws-c4dfd954ad">Replicating a Heroku-centric workflow within AWS</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grouped key expiry with redis]]></title>
            <link>https://medium.com/urban-massage-product/grouped-key-expiry-with-redis-85e89675b0e5?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/85e89675b0e5</guid>
            <dc:creator><![CDATA[Giles Williams]]></dc:creator>
            <pubDate>Mon, 25 Apr 2016 20:49:25 GMT</pubDate>
            <atom:updated>2014-12-07T11:07:03.013Z</atom:updated>
            <content:encoded><![CDATA[<p>As I’ll be covering in a later article, our booking process is like no other in the industry — upon entering a postcode on our system, we parallel process a huge combination of travel permutations in order to make sure that every therapist gets to each appointment on time, whilst at the same time maximising their time working with us by not blocking off more time than necessary.</p><p>Calculating this diary overview for a certain therapist takes a fair amount of computing power and external API requests, and we were looking for a way to minimise the amount of processing required for a particular route to booking (assuming the customer clicks around a few therapists, maybe changes treatment type etc).</p><p>So, we came up with a caching mechanism that satisfies the following constraints:</p><ul><li>Each cache entry can only be for a certain postcode</li><li>Each cache entry can only be for a certain date</li><li>Each cache entry can only be for a certain therapist</li><li>All caches for a certain therapist on a certain date (at all postcodes) can be expired at once (e.g. when a booking is placed for that therapist, or when they update their diary with us)</li></ul><p>To do this, we quickly realised we’d need to use a cache key that looks like the below:</p><blockquote><em>therapist_id::date::postcode</em></blockquote><p>In order to expire a group of keys at once, we ended up storing an additional key per therapist — an incrementer.</p><p>This incrementer is then used as part of the cache key as below:</p><blockquote><em>therapist_id::</em>incrementer<em>::date::postcode</em></blockquote><p>This does of course require two hits on redis each time you want to check the cache — you first need to find the latest incrementer for the therapist you’re calculating the diary for, then check the cache.</p><p>We tested this method alongside a combination of hset and storing a set of keys against a therapist ID, and found that the incrementer method wasn’t just faster, it was cleaner in terms of stale keys left over.</p><p>Our final solution ended up looking something like this (forgive my pseudo code!):</p><pre>function checkCache(therapistID, date, postcode) {<br>    var incrementer = redis.get(&quot;incrementer::&quot;+therapistID);</pre><pre>    var key = &quot;search::&quot;+therapistID+&quot;::&quot;+incrementer;<br>    key += &quot;::&quot;+date+&quot;::&quot;+postcode;<br>    return redis.get(key);<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85e89675b0e5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/grouped-key-expiry-with-redis-85e89675b0e5">Grouped key expiry with redis</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FlightControl — Logging and instrumentation for multi-tiered apps]]></title>
            <link>https://medium.com/urban-massage-product/flightcontrol-logging-and-instrumentation-for-multi-tiered-apps-7acf9e39ffb4?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/7acf9e39ffb4</guid>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Giles Williams]]></dc:creator>
            <pubDate>Mon, 25 Apr 2016 20:49:12 GMT</pubDate>
            <atom:updated>2015-06-27T20:02:37.953Z</atom:updated>
            <content:encoded><![CDATA[<p>Before we get started, let me just say — multi-tiered / microservice architecture is great. It gives you great freedom to work on small features in isolation, building up to large feature sets without having the headache of learning how the whole platform works every time you want to work on a small feature.</p><p>However — running a large number of smaller systems make tracing a lot harder. It can become tricky to nail down a bug when 5–6 systems are involved in a single client-side transaction. Log aggregation with tools like Kibana/ES only solve half the problem — you still have the potential for a ton of requests to be within your search window and this makes it quite difficult to follow a whole transaction through the many apps.</p><p>We came up with a better idea at Urban Massage which has been a spare-time project — it’s still very much a work in progress but when it’s ready, we’re planning to open source the project.</p><p>We set off with 2 main features in mind — the ability to see what request / transaction your logs are associated with, and when an app dispatches a request to another app to perform some task, linking the parent transaction to the new request (and obviously doing this to an infinite depth).</p><p>Here’s a quick (pseudo) example:</p><p><strong>POST</strong> bookings.urbanmassage.com/create-booking (200ms)<br>&gt;&gt;&gt; <strong>Log</strong> ‘Input request body is {“test”: “body”}’<br>&gt;&gt;&gt; <strong>POST</strong> logistics.urbanmassage.com/obtain-lock (10ms)<br>&gt;&gt;&gt;&gt;&gt;&gt; <strong>REDIS </strong>SET test.lock.key (9ms)<br>&gt;&gt;&gt; <strong>POST </strong>payments.urbanmassage.com/charge-card (90ms)<br>&gt;&gt;&gt;&gt;&gt;&gt; <strong>Log </strong>‘Submitting card charge for £65.00’<br>&gt;&gt;&gt;&gt;&gt;&gt; <strong>Braintree</strong> Charge (86ms)<br>&gt;&gt;&gt; <strong>MySQL</strong> INSERT INTO bookings... (30ms)<br>etc etc etc….</p><p>Hopefully the above gives you an example of the power of linking these different transactions in different apps together — stored in a structured format, we can do even more than just nail down bugs — we can quickly find bottlenecks in production, get a better idea of how to plan our scale-out and much more.</p><p>At the moment, we have a basic working NodeJS client — this is exposed as a library you init with the location of where the FlightControl server runs and the app name, and gives you a piece of express middleware for convenience so you can do things like <strong>req.logger.write(…)</strong> to automatically track logs against the appropriate transaction.</p><p>The cross-app transaction nesting works by just setting an extra header in HTTP requests, or attaching an extra property when we do RPC over RabbitMQ.</p><p>At the moment we’re looking for contributors to help create some clients for other languages and frameworks, as well as doing some work on the UI, so get in touch if you’re interested!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7acf9e39ffb4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/flightcontrol-logging-and-instrumentation-for-multi-tiered-apps-7acf9e39ffb4">FlightControl — Logging and instrumentation for multi-tiered apps</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event-based architecture and why it’s essential for startups]]></title>
            <link>https://medium.com/urban-massage-product/event-based-architecture-and-why-it-s-essential-for-startups-6eb61bda17b5?source=rss----afa76cb6d0f8---4</link>
            <guid isPermaLink="false">https://medium.com/p/6eb61bda17b5</guid>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[apps]]></category>
            <dc:creator><![CDATA[Giles Williams]]></dc:creator>
            <pubDate>Mon, 25 Apr 2016 20:48:53 GMT</pubDate>
            <atom:updated>2015-09-14T18:17:26.196Z</atom:updated>
            <content:encoded><![CDATA[<p>Now, what do I mean by event based architecture? The easiest analogy for most developers these days is the publish-subscribe model.</p><p>You perform a tiny bit of work in an API (say creating a record). Consequently, you need to send an email to the user, and invalidate the cache for the user that created the record. The way a lot of junior developers will engineer this, is something similar to below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*AU8bKso09qzh-CIbT77UrA.png" /></figure><p>This looks pretty simple from the offset, doesn’t it? You’ve made your code nice and clean by abstracting the emailing and cache invalidation into separate functions so you can think about this logic in a separate module.</p><p>But — what happens when you need to send a notification to your company’s Slack? And then you need to run some logic to check if the user has created more than 10 records, and if so, send them a separate email to congratulate them. And then you want to run a test to send the user an SMS message as well as an email?</p><p>This is obviously a convoluted example, but it’s easily possible within your own business as requirements change quickly. What’s better, is if you structure your application like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*AjISWCr1S-N67JANHaCXjA.png" /></figure><p>This kind of architecture plays incredibly well to splitting out your application into micro-services at a later date too. We recently ripped all of our notifications and fraud detection out of our old API into separate services, and we could just pick up each module (each of which was just a set of message handlers) from the monolith, wrap it in a tiny bit of code to run it as a daemon, and then we had nice separate services.</p><p>If you’re struggling to get your head around the example above — here’s a (massively cut down for obvious reasons) example within our application — when a customer creates a booking.</p><p><strong>booking.create <em>(</em></strong><em>event published with the booking details to RabbitMQ)</em> ~ sms.send.booking.create (<em>send the therapist a notification SMS)</em> ~ push.send.booking.create (<em>send the therapist a notification SMS) ~ </em>email.receipt.booking.create <em>(send the customer a receipt email) ~ </em>hipchat.notify.booking.create <em>(customer services receive a notification) ~ </em>fraud.check.booking.create <em>(our automated fraud system back checker) ~ </em>gosquared.booking.create (<em>tracks the data into gosquared) ~ </em>stats.user.booking.create <em>(updates stats about the user) </em>~ <em>many many more….</em></p><p>Hopefully this has given you an insight into the freedom you get when you can treat each async/background task as a completely separate part of the application. If you have any questions, feel free to leave a comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6eb61bda17b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/urban-massage-product/event-based-architecture-and-why-it-s-essential-for-startups-6eb61bda17b5">Event-based architecture and why it’s essential for startups</a> was originally published in <a href="https://medium.com/urban-massage-product">Urban Massage Product</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>