<?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[Stories by Michael S. Fischer on Medium]]></title>
        <description><![CDATA[Stories by Michael S. Fischer on Medium]]></description>
        <link>https://medium.com/@otterley?source=rss-3eb95feb0c13------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yJA85g8KyGe3VaezKsA15Q.jpeg</url>
            <title>Stories by Michael S. Fischer on Medium</title>
            <link>https://medium.com/@otterley?source=rss-3eb95feb0c13------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:29:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@otterley/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An Open Letter to FedEx]]></title>
            <link>https://medium.com/@otterley/an-open-letter-to-fedex-ab4abbc9b090?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab4abbc9b090</guid>
            <category><![CDATA[fedex]]></category>
            <category><![CDATA[guns]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[nra]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Wed, 28 Feb 2018 18:53:35 GMT</pubDate>
            <atom:updated>2018-02-28T20:17:53.649Z</atom:updated>
            <content:encoded><![CDATA[<p><em>(I urge all my readers to contact FedEx and express your concerns as well. Feel free to copy and paste this letter into their contact form, which is at </em><a href="https://www.fedex.com/us/customersupport/email/express_ground.html"><em>https://www.fedex.com/us/customersupport/email/express_ground.html</em></a><em>).</em></p><p>To Whom It May Concern:</p><p>As a FedEx customer, I’m writing to express my concern about FedEx’s continuing support of the National Rifle Association (NRA) in the United States.</p><p>The NRA has evolved from an organization that originally taught marksmanship in preparation for war into an organization that counters, through political action, against any reasonable attempts to control the proliferation and use of arms in the United States — regardless of the kind of weapon at issue, and regardless of the mental state or capacity of the owner.</p><p>In response to tragic and well-publicized shootings in schools, where innocent schoolchildren have been killed and seriously injured, the NRA has interceded in every attempt by our elected representatives to enact controls that might reduce or eliminate these horrible tragedies from occurring in the future.</p><p>As recently as this past week, the NRA has gone even further to characterize these attempts not as common sense and consistent with regulations promulgated elsewhere in the world in which FedEx does business — but as threats to freedom, as an invitation for a tyrannical Government takeover of the U.S., and as “liberal socialism.” They seek their political aims through gross characterization, fear, and fictional story-telling of the Constitution, as opposed to through careful factual and comparative analysis and reason.</p><p>By continuing to give NRA members significant discounts, FedEx implies that they support the NRA, its members, and its agenda. FedEx’s claim that it “has never set or changed rates for any of our millions of customers around the world in response to their politics, beliefs or positions on issues” is specious at best. On the contrary, the logic is quite clear:</p><p>1. FedEx provides rates for NRA members that are lower than for non-NRA members;<br>2. Therefore, as a non-NRA member, I pay more to ship parcels and documents through FedEx than NRA members do;<br>3. My lack of membership in the NRA is because I do not conform to their political beliefs;<br>4. Therefore, these discounts are unavailable to me because I do not conform to certain political beliefs.</p><p>I strongly urge FedEx to reconsider their position in this matter. Until they rescind discounts available to NRA members, I will not do future business with FedEx, and I will urge my friends, family, and colleagues also to conduct business through alternative carriers.</p><p>Sincerely,</p><p>Michael Fischer</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab4abbc9b090" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[consul2dogstats, with Dimensional Tagging]]></title>
            <link>https://medium.com/hackernoon/consul2dogstats-with-dimensional-tagging-b55ade84e654?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/b55ade84e654</guid>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Fri, 05 May 2017 02:48:11 GMT</pubDate>
            <atom:updated>2019-05-13T05:21:01.450Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you use both Consul and Datadog, you’ll want this.</em></p><p>I’ve written a small <a href="https://hackernoon.com/tagged/program">program</a> that maintains a list of Consul service counts in your datacenter(s) called <a href="https://github.com/zendesk/consul2dogstats">consul2dogstats</a>. It periodically polls the Consul service catalog and health endpoints to collect an inventory, then publishes the results to <a href="https://hackernoon.com/tagged/datadog">Datadog</a>. It’s Apache 2.0-licensed.</p><h3>An aside on dimensional tagging</h3><p>One of Datadog’s most powerful features is <em>dimensional tagging</em>. Briefly, dimensional tags are key-value pairs you can attach to time-series metrics for the purpose of querying and aggregation.</p><p>Suppose you wanted to track the request rates of the web servers in your organization. Let’s call the name of the metrichttp_requests. Some useful tags we could apply would be:</p><ul><li>Server host (e.g., app1, ip-1-2-3-4)</li><li>Web service (e.g., frontend, api, gatekeeper)</li><li>Environment (e.g., production, test)</li><li>Response code range (e.g., 2xx, 3xx, 4xx, 5xx)</li></ul><p>In Datadog, you would assign a <em>dimension key</em> to each of those. In the examples above, those might be hostname, http_host, env, and http_response_type.</p><p>Once you start tagging metrics, aggregating and filtering them is a piece of cake. You can perform powerful queries to answer questions in <em>real time</em> such as:</p><ul><li>How many 5xx responses per minute am I serving across all of production?</li><li>How many 2xx responses am I sending per minute in my production environment for the gatekeeper web service?</li></ul><p>This is a tremendous leap in functionality and flexibility over older solutions that have no dimension other than the server host (which itself is a decreasingly useful dimension in cloud environments, since hosts are often ephemeral now and their canonical names meaningless).</p><p>Consider a traditional dot-separated form of metric names such as requests.production.frontend.2xx or requests.test.gatekeeper.4xx. These pose some significant challenges for analysts.</p><p>First, selecting the metrics to query is an <em>O(n)</em> operation because the metric name is opaque (the system has no semantic awareness of the naming structure you choose). If you’re collecting a lot of metrics (and you should be!), that’s a <em>very</em> expensive operation.</p><p>Second, adding new dimensions is a management nightmare, because you have to create a <em>new metric</em> if you want to add a dimension. Suppose we wanted to add a new dimension like shard to our metrics above. In a system that supports dimension tagging out of the box, that’s no problem: any previous graphs will continue to render as before. But if you’re using flat metrics, you’ll start creating new metrics like requests.production.frontend.shard42.2xx and requests.tests.gatekeeper.shard1.4xx. The history of the previous metric data will end once you replace the old metrics with new ones, which creates a discontinuity that will make it more challenging to perform temporal analysis. (You can, of course, continue to submit metrics under the old name in parallel with the new, more granular metrics. But you’ll be double-counting, which could cause analytical errors, and submitting more metrics to the system than necessary, which could cause capacity issues.)</p><p>The good news is that even if you prefer managing metrics yourself over using a SaaS provider such as Datadog, there are now open-source metrics systems that support dimensional tagging. There’s no need to suffer with flat metrics anymore.</p><h3>Dimension anti-patterns</h3><p>Typically, operational metrics systems are intended to show the real-time state and health of your systems and applications. In order to maintain good performance, it’s important not to make metric dimensions <em>too</em> fine-grained. <strong>A good rule of thumb is to ensure that the possible values for a particular key are fewer than the number of servers you have. </strong>So tagging metrics by environment, hostname, or function is good. But tagging them by customer or user ID is a very bad idea; it will create so many tables on the backend that performance will suffer terribly.</p><p>Put bluntly: <strong>Don’t use your operational metrics system as your analytics system. </strong>There are lots of great analytics databases and providers out there, including <a href="https://www.vertica.com/">Vertica</a>, <a href="https://aws.amazon.com/redshift/">Redshift</a>, <a href="https://clickhouse.yandex/">Clickhouse</a>, and <a href="https://cloud.google.com/bigquery/">BigQuery</a>.</p><h3>A promising landscape</h3><p>Datadog was the first platform, commercial or otherwise, that offered a compelling product that supported dimensional metric tagging. But there are lots more options out there now. Check them out and discover the one that’s best for you:</p><p><strong>Commercial</strong></p><ul><li><a href="https://datadoghq.com/">Datadog</a></li><li><a href="https://signalfx.com/">SignalFx</a></li><li><a href="https://www.wavefront.com/">Wavefront</a></li></ul><p><strong>Open-Source</strong></p><ul><li><a href="https://prometheus.io/">Prometheus</a></li><li><a href="http://opentsdb.net/">OpenTSDB</a></li></ul><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a>family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp; sponsorship</a> opportunities.</blockquote><blockquote>To learn more, <a href="https://goo.gl/4ofytp">read our about page</a>, <a href="http://bit.ly/HackernoonFB">like/message us on Facebook</a>, or simply, <a href="https://goo.gl/k7XYbx">tweet/DM @HackerNoon.</a></blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b55ade84e654" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/consul2dogstats-with-dimensional-tagging-b55ade84e654">consul2dogstats, with Dimensional Tagging</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Next Chapter]]></title>
            <link>https://medium.com/@otterley/the-next-chapter-dc5c5156dda?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc5c5156dda</guid>
            <category><![CDATA[careers]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Fri, 28 Apr 2017 16:34:37 GMT</pubDate>
            <atom:updated>2017-05-05T02:27:17.296Z</atom:updated>
            <content:encoded><![CDATA[<p>Almost six years ago, I was invited to join Zendesk’s fledgling operations team. It’s been an amazing experience ever since. I’ve met and worked with many people during this time, all of whom were thoughtful, dedicated, and — most important — friendly.</p><p>I’ve taken some time to reflect on our accomplishments during these years. A twenty-fold growth in customers. A <em>one-hundred-fold</em> growth in compute and data capacity. Launching our own data center, then growing to four. Five major engineering offices around the world. Our first DDoS and security incidents. “The New Zendesk.” Chat v1 (which made me lose my hair). Chat v2. Zopim. Hadoop. Voice. Solr. ElasticSearch. Blips. ELK. AWS. BIME. Going under the microscope by auditors. Going public. Building families.</p><p>We’ve grown so much. There were four of us on the operations team when I joined; now there are nearly 40. There were about 15 developers when I joined, now nearly 200. Despite our growth and widening distances, I’ve been blessed with the opportunity to connect with nearly all of them through travel, conferences, tech talks, meetings, or just at their desks. Each of them has enlightened me through their perspective, their personality, their intelligence, and their good humor.</p><p>As the engineering teams have developed their own technical leadership, so have the operations teams. They have proven their ability to innovate, motivate their peers, and make great decisions, powered by patience, consensus, and plain old sweat mixed with technical acumen.</p><p>After six years, it’s the right moment for me to step out of the way and let them shine.</p><p>I’m going to take some well-deserved rest. I’m going to a small town in central Romania for a while to teach kids English and assist some NGOs, while I reconnect with my Hungarian roots. No laptop, just a Kindle and a small suitcase.</p><p>The next chapter has yet to be written, but I’m sure it’ll be great and full of surprises.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc5c5156dda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shiny Tiny Tools: cloudwatch-logger]]></title>
            <link>https://zendesk.engineering/shiny-tiny-tools-cloudwatch-logger-bc938337dd9e?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc938337dd9e</guid>
            <category><![CDATA[aws-cloudwatch]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[logs]]></category>
            <category><![CDATA[stdout]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Tue, 18 Apr 2017 03:28:24 GMT</pubDate>
            <atom:updated>2017-04-18T03:39:12.689Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you use Amazon CloudWatch Logs, you’ll love this.</em></p><p>I’ve written a tiny tool called cloudwatch-logger. It’s very simple. It consumes standard input, and copies it to a CloudWatch Logs stream:</p><pre>USAGE: cloudwatch-logger [-t] LOG_GROUP LOG_STREAM</pre><p>If you specify the -t (tee) option, it’ll also copy the stream to standard output.</p><p>You can find it at our <a href="https://github.com/zendesk/cloudwatch-logger">GitHub repository</a>. It’s Apache 2.0-licensed.</p><h3>An aside on log collection</h3><p>We’re big fans of the so-called <a href="https://12factor.net/logs">“12 Factor” approach to logging</a>, in which programs dispatch their logs exclusively to a single stream (i.e., standard output). The reasons are detailed at the linked site, but I’d like to discuss a few points that aren’t mentioned there.</p><h4>Execution-environment agnosticism, or, cloud-readiness</h4><p>One benefit of logging to standard output is that the application will be able to issue logs even when there’s no logging service available.</p><p>In traditional Linux environments, there’s typically a syslog daemon (or one of its many cousins, like rsyslogd and syslog-ng) running on the host to collect logs; and traditionally, UNIX software uses the C <a href="http://man7.org/linux/man-pages/man3/syslog.3.html">syslog(3)</a> call to send messages to the syslog daemon. The daemon is then configured to filter and write logs to various local files based on attributes such as log facility (of which there are about 20) and urgency level (of which there are 8). Most syslog daemons also have the ability to forward logs to other servers, but some will drop logs or block (and worse, cause your application to stall) if the remote server is jammed or unavailable. And syslog servers’ configuration files can be <a href="http://www.rsyslog.com/doc/v8-stable/configuration/index.html">quite complex</a>.</p><p>As we move our applications into the cloud, we’re finding that the execution environments for our software don’t provide access to a traditional syslog service. Instead, these Platforms-As-A-Service (PaaSes) typically collect the application’s standard output and forward it to the cloud provider’s log collection and aggregation systems. So as a practical matter, our software increasingly has to log to standard output anyway.</p><h4>Preparing for the transition on legacy systems</h4><p>Suppose your software currently logs messages via syslog(3), and you have a rule in your syslogd configuration to forward those messages to a centralized log collector. Let’s also suppose you’re ready to prepare your software for a PaaS transition, but still want to run it on your legacy servers in the interim.</p><p>You can update your software right away to log to standard output. Until you’re ready to move it to the PaaS, you can simply connect the application to syslogd as follows:</p><pre>/path/to/app 2&gt;&amp;1 | logger -t myapp</pre><p><a href="http://man7.org/linux/man-pages/man1/logger.1.html">logger(1)</a> is a tool that ships with every Linux distribution. It consumes lines from standard input and writes them to syslog, using the tag specified via the -t option.</p><p>Setting this up can be tricky in a standard init script, since traditional SysV init expects the processes it runs to background themselves. Using a process manager such as <a href="http://cr.yp.to/daemontools.html">daemontools</a>, <a href="http://smarden.org/runit/">runit</a>, or <a href="https://skarnet.org/software/s6/index.html">s6</a> can simplify matters. Just configure your application’s /etc/service/app/log/run script to:</p><pre>#!/bin/sh</pre><pre>exec logger -t myapp</pre><h4>The benefits of buffering</h4><p>Notwithstanding the above, we’ve learned that it’s not a good practice to connect applications that produce logs directly to consumer applications like syslogd, logstash, or Kafka.</p><p>Log-consuming applications can crash or hang. Network partitions happen. Without some sort of buffer, you have two options when this happens: either drop logs, or block until the consumer has been restored.</p><p>Dropping logs may not be acceptable if your business demands accurate reporting capabilities. And blocking makes your application stop handling requests, causing a denial of service (read: <strong>outage</strong>).</p><p>So we now combine both logging to standard output, but instead of connecting the output directly to a log consumer, we record it to a <em>buffer</em>: a file on disk with a bounded size. A separate program then reads the logs from the buffer and copies them to the ultimate consumer (remote syslog, message bus, etc.)</p><p>Here’s a simple implementation of such a system, composed as a set of runit services. First, /etc/service/app/log/run:</p><pre>#!/bin/sh<br># This program consumes the standard output from the application<br># launched by /etc/service/app/run, and writes it to a disk buffer<br># under $SPOOLDIR.</pre><pre>PATH=/usr/bin:/usr/sbin:/bin:/sbin<br>SPOOLDIR=/var/spool/app<br>mkdir -p $SPOOLDIR<br>exec svlogd $SPOOLDIR</pre><p>(<a href="http://smarden.org/runit/svlogd.8.html">svlogd</a> ships with runit.)</p><p>Now, let’s send those buffered logs off to CloudWatch Logs!</p><p>Here’s /etc/service/app-collector/run:</p><pre>#!/bin/sh<br># This program follows the spooled logs produced by our application<br># and prints them to standard output.</pre><pre># NOTE: This is the simplest tailer possible.  More intelligent <br># implementations will keep positional state and be able to rewind<br># to rotated-out spools in the event of a long consumer outage.</pre><pre>PATH=/usr/bin:/usr/sbin:/bin:/sbin<br>SPOOLDIR=/var/spool/app</pre><pre>exec tail -F $SPOOLDIR/current</pre><p>Finally, here’s /etc/service/app-collector/log/run:</p><pre>#!/bin/sh<br># This program publishes our spooled logs to CloudWatch Logs.  It <br># will be fed logs via standard input.</pre><pre>PATH=/usr/bin:/usr/sbin:/bin:/sbin</pre><pre>exec cloudwatch-logger app $(hostname)</pre><h3>Conclusion</h3><p>For most sites, logs are important. Logging to stdio is the current best practice. CloudWatch Logs is just one place to store them for safe keeping — but no matter how you generate and collect them, be sure to buffer them so they don’t bring you down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9zkCLB0KVlJSVrEtQltRg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc938337dd9e" width="1" height="1" alt=""><hr><p><a href="https://zendesk.engineering/shiny-tiny-tools-cloudwatch-logger-bc938337dd9e">Shiny Tiny Tools: cloudwatch-logger</a> was originally published in <a href="https://zendesk.engineering/">Zendesk Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resurrecting Amazon SimpleDB]]></title>
            <link>https://zendesk.engineering/resurrecting-amazon-simpledb-9404034ec506?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/9404034ec506</guid>
            <category><![CDATA[simpledb]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Tue, 07 Mar 2017 01:26:51 GMT</pubDate>
            <atom:updated>2017-03-13T22:42:07.396Z</atom:updated>
            <content:encoded><![CDATA[<p><em>While working on a recent problem, I tested out a number of alternative Databases-As-A-Service (DBaaS) on the Amazon Web Services (AWS) platform. The best fit for my particular use case ended up being an often-overlooked one: </em><strong><em>SimpleDB</em></strong><em>. Surprised? Me, too.</em></p><h3>The problem</h3><p>I’m building a mechanism to create operating system images for both AWS EC2 (Amazon Machine Images, or AMIs) and on-premise hypervisors (Linux KVM, in this case).</p><p>Amazon’s EC2 API allows AMIs to be tagged with user-defined metadata. Combined with other metadata such as the timestamp, this allows the user to identify a particular image from which to create a new EC2 instance. An example query might be, “find the newest image that has the intersection of tags Platform=Ubuntu,PlatformVersion=14.04,ImageClass=base”. We use these tags liberally when we create new images (using <a href="https://www.packer.io/">Packer</a>, which I highly recommend).</p><p>When our image builder creates a KVM image for our hypervisors, it stores it in S3. <a href="https://aws.amazon.com/about-aws/whats-new/2016/11/revolutionizing-s3-storage-management-with-4-new-features/">Last November</a>, AWS added an <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html">object-tagging</a> feature that allows arbitrary tags to be associated with S3 objects, but failed to include an indexing feature. Without more, the only way to identify a unique S3 object from its timestamp and tags is to enumerate every object in the bucket — an <a href="http://bigocheatsheet.com/"><em>O(n)</em> operation</a> that can be very expensive in terms of compute usage and network round-trips.</p><p>The obvious solution was to create and maintain an index, analogous to the internal AMI index that AWS provides for EC2. One question was, which database technology should we use?</p><h3>Rejected solution I: DynamoDB</h3><p>DynamoDB is a very scalable key-value database. However, it’s not a good fit for this use case. A DynamoDB query requires the user to either (a) identify and <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#QueryAndScan.Query">query a specific key</a> to retrieve, or (b) perform a <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#QueryAndScan.Scan">scan operation</a>, <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults">filter out disqualifying results</a>, and then sort them by a preconfigured <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#WorkingWithTables.primary.key">sort key</a>.</p><p>The first form of query was the exact opposite of what we were trying to do: we wanted to identify a key (specifically, an S3 object URL) from a given list of tags. And the second form of query is expensive: when you perform a scan, <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#QueryAndScan.Scan">all items in the database are evaluated</a> — again, an <em>O(n)</em> operation. It’s less time-consuming from the user’s perspective because the scanning and filtering process is done on the server side (<a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#QueryAndScanParallelScan">using multiple machines in parallel</a>), but it’s still not particularly efficient or cheap.</p><h3>Rejected solution II: RDS</h3><p>Amazon RDS (Relational Database Service) is another DBaaS in AWS’s portfolio. RDS will automatically provision and maintain a set of SQL servers for you, based on the parameters you provide to its API. There are several SQL server types supported, but for our experiments, we chose MySQL. (The lessons here are equally applicable to PostgreSQL or other RDS implementations.)</p><p>It was relatively straightforward to create object and tag tables in MySQL, along with the appropriate indexes.</p><p>The objects table looked like this:</p><pre>+----+------------+-------------------------+-------------------+<br>| id | bucketName |  objectName             |     timestamp     |<br>+----+------------+-------------------------+-------------------+<br>|  1 | my-bucket  | ubuntu-14.04-base.qcow2 | 20170102T03:04:05 |<br>|  2 | my-bucket  | centos-7-base.qcow2     | 20170203T04:05:06 |<br>+----+------------+-------------------------+-------------------+</pre><p>The tags table looked like this:</p><pre>+----+----------+-----------------+----------+<br>| id | objectId |     tagKey      | tagValue |<br>+----+----------+-----------------+----------+<br>|  1 |        1 | Platform        | Ubuntu   |<br>|  2 |        1 | PlatformVersion | 14.04    |<br>|  3 |        1 | ImageClass      | base     |<br>|  4 |        2 | Platform        | CentOS   |<br>|  5 |        2 | PlatformVersion | 7        |<br>|  6 |        2 | ImageClass      | base     |<br>+----+----------+-----------------+----------+</pre><p>From there, it was pretty straightforward to create an index on the timestamp column in the objects table and a compound index on the (tagKey,tagValue) columns on the tags table.</p><h4>Challenge: Query composition</h4><p>It was fairly easy to write SQL to insert new objects into the tables. Querying them, however, turned out to a bit less elegant than I’d like. Certainly doable, but not the sort of code I find especially satisfying.</p><p>Here’s an example of the sort of logic you have to implement when querying high-cardinality dimensions in a table such as the tags table above. (This example is in Ruby.)</p><pre># Build the FROM clause:<br># Identify the tables we&#39;ll need to select from -- in this case,<br># the tags table, aliased once (&quot;tags1&quot;..&quot;tagsN&quot;) for each tag<br># value.  (The tags variable is simply a hash of key/value pairs.)<br>tags_tables = tags.map.with_index(1) do |_, i|<br>                &quot;tags t#{i}&quot;<br>              end.join(&#39;, &#39;)</pre><pre># Build the filter (WHERE) clause:<br># First, the join predicates.<br>join_predicates = tags.map.with_index(1) do |_, i|<br>                     &quot;t#{i}.objectId = objects.id&quot;<br>                  end.join(&#39; AND &#39;)</pre><pre># Now, the tag predicates.  Like good little secure programmers, <br># we&#39;re parameterizing our queries instead of interning values.<br>tag_predicates = tags.map.with_index(1) do |_, i|<br>     &quot;(t#{i}.tagKey = ? AND t#{i}.tagValue = ?)&quot;<br>     end.join(&#39; AND &#39;)         <br>tag_values = @source_image_tags.map {|k, v| [k, v]}.flatten</pre><pre># Finally, build the statement and execute it:<br>statement = client.prepare(<br>  &quot;SELECT objects.bucketName, objects.objectName &quot;\<br>  &quot;FROM objects, #{tags_tables} &quot;\<br>  &quot;WHERE #{tag_predicates} AND #{join_predicates} &quot;\<br>  &quot;ORDER BY timestamp DESC LIMIT 1&quot;)</pre><pre>results = statement.execute(*tag_values)</pre><p>(If you know of a more elegant and equally-performant way of doing this, I’d love to hear from you.)</p><p>So, why did I reject the solution even though it worked?</p><h4>A seemingly-simple solution leads to a mountain of scaffolding</h4><p>With RDS, common sense and best practice is to place your instances in a VPC (Virtual Private Cloud). This ensures the databases aren’t accessible from the public Internet.</p><p>Admittedly, this table didn’t contain any data of high proprietary value. But availability is important, and I wanted to reduce the probability that the database could be tampered with or destroyed by a malicious actor who somehow acquired our password, or that a malicious actor would make a bunch of idle connections to our database and deny us service (MySQL has a maximum concurrent connection limit).</p><p>So, I assigned it to a VPC. Good, right? Not quite.</p><p>Placing your RDS instances into a VPC sacrifices accessibility for security. We now had a number of challenges to solve:</p><h4>Fun with Lambda</h4><p>To make our indexer work, we rely on <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html">Amazon S3’s ability to invoke a Lambda function</a> whenever an object is added to or removed from our image bucket.</p><p>Briefly, a Lambda function is a function in a packaged script or Java class that adheres to a particular calling convention. You upload the code package, and AWS executes the functions in the package on one of its machines under the specified conditions.</p><p>By default, Lambda functions run outside a VPC, without any privileged access to resources inside your own VPCs. But since our index updater functions needed to access our RDS instance, we needed to run them in our VPC. Fortunately, we could configure our Lambda functions to do just that.</p><p>But there’s a huge caveat with running Lambda functions in a VPC — they have no ability to access the public Internet. Normally this would be fine, but our indexer needed more than the ability to access our RDS server. We needed it to access:</p><ul><li>Amazon S3 itself, to obtain the object tags; and</li><li>AWS Key Management Service (KMS), to decrypt the database’s password.</li></ul><p>Unfortunately, AWS doesn’t provide API endpoints for most services inside VPCs; they have public addresses. So we had to find a way to let this Lambda function have its cake and eat it, too: provide both access to our RDS instance, <em>and</em> allow it to access the public Internet to talk to S3 and KMS.</p><p>Our original VPC design was fairly simple: it had one RFC1918 subnet (10.0.0.0/16); an Internet Gateway; and a default route pointing to the gateway. This worked fine for EC2 instances, against which we could check the “assign public IP” box. Not so, however, for Lambda.</p><p>To make the necessary APIs work for our Lambda function when running in our VPC, we had to add a bunch of scaffolding. This included:</p><ul><li>A separate “private” subnet (10.1.0.0/16);</li><li>A NAT Gateway in our original subnet (10.0.0.0/16);</li><li>A separate routing table for our new private subnet;</li><li>A routing table entry in the above routing table setting the default gateway to the NAT gateway.</li></ul><p>All this just to make our Lambda function work. Again, certainly doable, but our stack seemed to grow ever larger and more complex.</p><h4>The straw that broke the camel’s back</h4><p>We then realized that people might want to run test suites on their personal workstations: what if they could fetch KVM images from S3, convert them to VirtualBox appliances, and run their tests locally? That would be very convenient for developer productivity.</p><p>The problem, though, was that we had no easy and user-friendly way to connect developers to the VPC. Without a network route to the RDS instance in the VPC, there would be no way for them to query the index to help them find the right base image.</p><p>A possible option would have been to create bastion host with a public IP address in the VP, and then ask developers to set up SSH port forwarding. At this point, the user experience started to look pretty grim. So I looked for other options.</p><h3>The SimpleDB Solution</h3><p>It turns out that there’s a database service in the AWS product family that nearly everyone forgets about: <a href="https://aws.amazon.com/simpledb/">Amazon SimpleDB</a>. It’s not super fancy or built for massive amounts of data, but it has exactly the properties we need:</p><ul><li><a href="http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/WorkingWithDataPut.html">Arbitrary “columns” (actually, attributes)</a> to store and search for our key-value pairs</li><li>Easily accessible, but <a href="http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/UsingIAMWithSDB.html">protected using IAM (Identity and Access Management)</a></li><li>A query language that <a href="http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/SimpleQueriesSelect.html">reads like SQL</a>, but doesn’t require us to construct cross-products of our tag table;</li><li><a href="https://aws.amazon.com/simpledb/pricing/">Dirt-cheap to run</a>: 25 machine-hours per month <em>for free</em>; followed by 14 cents per machine-hour thereafter (not including transfer costs, which are miniscule as well)</li></ul><p>We tried it out and it worked perfectly. Remember our complex query builder, above? It looks like this now (again, Ruby):</p><pre>simpledb = Aws::SimpleDB::Client.new</pre><pre># See note below about the lack of prepared query support<br>where_clause = tags.map {|k, v| &quot;#{k} = &#39;#{v}&#39;&quot; }.join(&#39; AND &#39;)</pre><pre>resp = simpledb.select(<br>   select_expression: &quot;SELECT bucketName, objectName from images &quot;\<br>                      &quot;WHERE #{where_clause} &quot;\<br>                      &quot;INTERSECTION _timestamp IS NOT NULL &quot;\<br>                      &quot;ORDER BY _timestamp DESC&quot;)</pre><p>SimpleDB doesn’t support prepared statements and placeholders like many SQL clients do, but since SELECT is the only SQL-like operation you can perform with it, it’s inherently immune to SQL injection attacks.</p><h3>Conclusion</h3><p>If you need a simple tag database, don’t overlook Amazon SimpleDB. It doesn’t get a lot of fanfare, but it just might be the tool you might need to get the job done. And it’s <em>practically free</em> for low-volume use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ifmax3iY3Fwgop5NO0M8NA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9404034ec506" width="1" height="1" alt=""><hr><p><a href="https://zendesk.engineering/resurrecting-amazon-simpledb-9404034ec506">Resurrecting Amazon SimpleDB</a> was originally published in <a href="https://zendesk.engineering/">Zendesk Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Docker and Consul Get Along]]></title>
            <link>https://zendesk.engineering/making-docker-and-consul-get-along-5fceda1d52b9?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fceda1d52b9</guid>
            <category><![CDATA[consul]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Thu, 02 Mar 2017 19:15:51 GMT</pubDate>
            <atom:updated>2017-03-07T00:29:47.322Z</atom:updated>
            <content:encoded><![CDATA[<p>If you manage the technology stack for an Internet business of any significant size, you’ve probably heard of <a href="https://www.consul.io/">Consul</a>. Consul is a fantastic solution for providing, among other things, powerful and reliable service-discovery capability to your network. It’s not surprising that you’d want to use it.</p><p>Let’s suppose you’ve also decided to run <a href="https://www.docker.com/">Docker</a> containers in production in your stack. Let’s also suppose that you want to publish the services running in your containers into Consul’s service catalog. How can you do so reliably, without driving yourself mad in the process?</p><h3>Summary</h3><ul><li>Install Consul and <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a> either directly on your host, or in a container using host networking (--net=host).</li><li>Create a <a href="http://www.tldp.org/LDP/nag/node72.html">dummy network interface</a> on the host with a link-local IP address (for example, 169.254.1.1).</li><li>Configure Consul to bind its HTTP and client RPC services to the dummy network interface’s IP address.</li><li>Configure dnsmasq to listen to the dummy IP address as well.</li><li>Configure your containers to use the dummy IP address as their DNS resolver and Consul server.</li><li>Use a program such as <a href="https://github.com/gliderlabs/registrator">Registrator</a> to publish the containers’ services.</li></ul><h3>Consul and Containerized Applications</h3><p>Suppose you’ve determined that you want to use Consul on your Docker host, and you have the following requirements:</p><ul><li>Containerized applications must be able to accurately determine the IP addresses and port numbers of other applications — whether those applications be on the same host or on a different host.</li><li>Containerized applications must be able to read from and write to Consul’s key-value database, and reliably perform lock operations.</li><li>Applications running on foreign hosts must be able to connect to the containerized application.</li><li>Applications that are failing health checks must be reported accurately to the Consul service catalog.</li><li>If a Docker host becomes unreachable, all applications on the host will be marked as down, and/or unpublished from the Consul service catalog.</li></ul><h4>Installing Consul on your Docker Host</h4><p>It’s considered a best practice to install and run the Consul Agent on every host in your network, including your Docker hosts. This has a few important benefits:</p><p>First, it makes configuring services a cinch. Services running on the host itself (i.e. that are not containerized) can simply drop service definitions, including health checks, into /etc/consul.d/&lt;service_name&gt;.json, and the Consul agent will load them at start or when signaled. The agent will then publish the services into the catalog, and perform any health checks you’ve designated at the frequency you specify.</p><p>Second, it provides for reliable failure detection. If your host becomes unreachable due to termination or any other reason, the network of Consul agents running on the other hosts in your network will quickly notice; and any services registered on the host will be marked as unavailable automatically.</p><p>Finally, it provides a host-local endpoint for accepting Consul DNS queries and HTTP API requests. Those requests need not go onto the network, which can help simplify security rules and reduce network chatter.</p><p>The most controversial question is, <strong>should you install the Consul Agent directly on the host, or install it in a container?</strong></p><p>The answer is: <strong>it doesn’t matter — but the network configuration does.</strong> Consul itself is a small, self-contained Linux binary; it has no dependencies. You can certainly run it as a container if you wish, but the benefit of runtime environment isolation that makes containers so appealing is minimal when the application doesn’t need isolation anyway. My personal preference is to run Consul as a first-class service on the host, alongside essential system services as the Docker engine and sshd daemon.</p><p>If you choose to run Consul in a container, that’s fine, too. Hashicorp itself publishes an <a href="https://hub.docker.com/_/consul/">official image in the Docker Hub</a>. The important part is that <strong>you must use the </strong><strong>--net=host option when you run the container:</strong></p><pre>$ sudo docker run -d --net=host consul:latest</pre><h4>Consul and the Loopback Interface</h4><p>When you run the Consul agent, it listens on six ports, all of which serve different functions. The three ports essential to our discussion are:</p><ul><li>HTTP API (default: 8500): handles HTTP API requests from clients</li><li>CLI RPC (default: 8400): handles requests from CLI</li><li>DNS (default: 8600): answers DNS queries</li></ul><p>By default, Consul allows connections to these ports only from the loopback interface (127.0.0.1). This is a reasonable default choice for security, and poses few problems on legacy hosts that don’t run containers. But it presents a difficulty for containerized applications, since <strong>the loopback interface in a container is separate and distinct from the loopback interfaces on the host</strong>. This is a consequence of the <em>private network namespace</em> that every container operates in by default under Docker. So if a containerized application tries to connect to Consul by addressing it at http://127.0.0.1:8500, it will fail.</p><h4>Ideas we considered, but rejected</h4><ul><li><em>Configuring Consul to bind to all interfaces. </em>That would make the HTTP and CLI RPC ports open to the world unless we also craft iptables(8) rules to block requests from foreign hosts. In addition, we’d have to ensure the containers know the IP address of the host they’re running on in order to communicate with its Consul agent.</li><li><em>Configuring Consul to bind to the Docker bridge IP address. </em>The routing would work properly, but: (a) typically, bridge interfaces are assigned dynamically by Docker; (b) there may be more than one bridge interface; (c) containers would have to know the IP address of the selected bridge interface; and (d) the Consul agent and dnsmasq (discussed below) would not be able to start until the Docker engine has started. We don’t want to create any unnecessary dependencies.</li><li><em>Installing a Consul agent per container.</em> Consul’s architecture anticipates a single agent per host IP address; and in most environments, a Docker host has a single network-accessible IP address. Running more than one Consul agent per container would cause multiple agents to join the Consul network and claim responsibility for the host, causing major instability in the cluster.</li><li><em>Sharing the Consul agent container’s network with application containers.</em> A container can have exactly one network namespace. So, if your application containers share the network namespace with the Consul agent’s container, they will end up sharing network namespaces with each other as well. This would deprive us the benefits of network isolation that is a prime benefit of using containers in the first place.</li></ul><h3>The Dummy Interface Solution</h3><p>Linux provides a little-known network interface type called a “dummy interface.” It’s much like a loopback interface, but you can give it any IP address you like, and you can create as many of them as you like (but we only need one). Here’s an example:</p><pre>$ sudo ip link add dummy0 type dummy<br>$ sudo ip link set dev dummy0 up<br>$ ip link show type dummy<br>25: dummy0: &lt;BROADCAST,NOARP&gt; mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000<br>    link/ether 2a:bb:3e:f6:50:1c brd ff:ff:ff:ff:ff:ff</pre><p>What IP interface should we assign to it? A good choice is 169.254.1.1. Addresses in the 169.254.0.0/16 network are reserved <em>link-local</em> addresses, which means they are not routable, either on your local network, or on the Internet. This means they’re effectively private to the host they’re assigned to. (A notable exception: Amazon EC2 utilizes a 169.254.169.254 address for retrieving instance metadata, but what we’re doing here won’t impact our ability to use that.)</p><pre>$ sudo ip addr add 169.254.1.1/32 dev dummy0 <br>$ sudo ip link set dev dummy0 up<br>$ ip addr show dev dummy0<br>25: dummy0: &lt;BROADCAST,NOARP,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UNKNOWN qlen 1000<br>    link/ether 2a:bb:3e:f6:50:1c brd ff:ff:ff:ff:ff:ff<br>    inet 169.254.1.1/32 scope global dummy0<br>       valid_lft forever preferred_lft forever<br>    inet6 fe80::28bb:3eff:fef6:501c/64 scope link <br>       valid_lft forever preferred_lft forever</pre><p>Every host can use the same 169.254.1.1 address with its dummy interface. This makes configuration a lot easier, since you don’t have to write scripts to determine the IP address and provide it to the programs that need it.</p><h4>Configuring the interface</h4><p>If your Linux distribution uses systemd, it’s easy to set up the dummy interface at boot time by creating two files. (You may need to install systemd-networkd via your distribution’s package manager, enable it, and start it.)</p><p>Place the following file into/etc/systemd/network/dummy0.netdev:</p><pre>[NetDev]<br>Name=dummy0<br>Kind=dummy</pre><p>Then place the following file into /etc/systemd/network/dummy0.network:</p><pre>[Match]<br>Name=dummy0<br><br>[Network]<br>Address=169.254.1.1/32</pre><p>Run sudo systemctl restart systemd-networkd and your new dummy0 interface should appear.</p><p>If you’re not using systemd, check the documentation provided with your distribution to learn how to create a dummy interface on your host.</p><h4>Configuring Consul to use the dummy interface</h4><p>Next, let’s configure the Consul agent to bind its HTTP, CLI RPC, and DNS interfaces to the 169.254.1.1 address.</p><p>Assume the agent is started with the -config-dir=/etc/consul.d option. We can simply create a file at /etc/consul.d/interfaces.json with the following content, substituting your host’s IP address for the value of HOST_IP_ADDRESS below.</p><pre>{<br>  &quot;client_addr&quot;: &quot;169.254.1.1&quot;,<br>  &quot;bind_addr&quot;: &quot;HOST_IP_ADDRESS&quot;<br>}</pre><p>You’ll need to restart the Consul agent after doing this.</p><h4>Configuring dnsmasq to use the dummy interface</h4><p>dnsmasq is a fantastic piece of software. Among other things, it can act as a local DNS cache on your host. It’s extremely flexible and can make integration with Consul’s DNS service a snap. We’re going to install it on our server; bind it to both our loopback and dummy interfaces; make it pass queries ending in .consul to the Consul agent; and configure /etc/resolv.conf on both the host and our containers to dispatch DNS queries to it.</p><p>First, use your operating system’s package manager (yum, apt-get, etc.) to install dnsmasq.</p><p>Next, configure dnsmasq to bind to the loopback and dummy interfaces, and forward Consul queries to the agent. Create a file /etc/dnsmasq.d/consul.conf with the following text:</p><pre>server=/consul/169.254.1.1#8600<br>listen-address=127.0.0.1<br>listen-address=169.254.1.1</pre><p>Then restart dnsmasq.</p><h3>Putting it together: Containers, Consul, and DNS</h3><p>The key to making everything work at this point is to ensure that the container itself, and the code running inside, point to the right address when resolving DNS queries or connecting to Consul’s HTTP API.</p><p>When starting your Docker container, configure it so that it uses the dnsmasq server as its resolver:</p><pre>docker run --dns 169.254.1.1 ...</pre><p>The containerized application will then be able to query addresses ending in .consul, because dnsmasq will forward those queries to the Consul agent.</p><p>How about Consul API access? The key is to set two standard environment variables called CONSUL_HTTP_ADDR and CONSUL_RPC_ADDR. Nearly all standard Consul client libraries use these values to determine where to send queries. <strong>Be certain your code uses these variables too — never hard-code Consul endpoints into your applications!</strong></p><pre>$ sudo docker run --dns 169.254.1.1 \<br>              -e CONSUL_HTTP_ADDR=169.254.1.1:8500 \<br>              -e CONSUL_RPC_ADDR=169.254.1.1:8400 ...</pre><p>Now, let’s see it in action!</p><p>Suppose we have a service already registered in Consul called myapp. Can we find it in our container? Certainly:</p><pre>$ sudo docker run --dns 169.254.1.1 \<br>              -e CONSUL_HTTP_ADDR=169.254.1.1:8500 \<br>              -e CONSUL_RPC_ADDR=169.254.1.1:8400 \<br>              -it \<br>              myImage:latest /bin/sh</pre><pre># curl <a href="http://$consul_http_addr/v1/catalog/service/myapp?pretty">http://$CONSUL_HTTP_ADDR/v1/catalog/service/myapp?pretty</a><br>[<br>   {<br>      &quot;ID&quot;: &quot;6c542e7f-a68d-4de0-bcc0-7eb6b80b68e3&quot;,<br>      &quot;Node&quot;: &quot;vessel&quot;,<br>      &quot;Address&quot;: &quot;10.0.0.2&quot;,<br>      &quot;ServiceID&quot;: &quot;myapp&quot;,<br>      &quot;ServiceName&quot;: &quot;myapp&quot;,<br>      &quot;ServiceTags&quot;: [],<br>      &quot;ServiceAddress&quot;: &quot;&quot;,<br>      &quot;ServicePort&quot;: 80,<br>      &quot;ServiceEnableTagOverride&quot;: false,<br>      &quot;CreateIndex&quot;: 60,<br>      &quot;ModifyIndex&quot;: 60<br>    }<br>]</pre><pre># dig +short myapp.service.consul<br>10.0.0.2</pre><p>It’s also a great idea to set CONSUL_HTTP_ADDR and CONSUL_RPC_ADDR as default environment variables in all users’ shells. To do that, you can simply edit the /etc/environment file on the host and set them there:</p><pre># /etc/environment<br>CONSUL_HTTP_ADDR=169.254.1.1:8500<br>CONSUL_RPC_ADDR=169.254.1.1:8400</pre><h4>Registering your containers</h4><p>Now that we’ve shown that containers can access the Consul agent, you’ll want to publish their services into the Consul catalog.</p><p>There are many tools and options for doing so. My favorite open-source tool for this task is <a href="https://github.com/gliderlabs/registrator">Registrator</a>, which is <a href="https://hub.docker.com/r/gliderlabs/registrator/">available from Docker Hub</a>.</p><p>Let’s install Registrator and have it publish a container. First:</p><pre>$ sudo docker run -d --name=registrator --net=host \<br>                  --volume=/var/run/docker.sock:/tmp/docker.sock \<br>                  gliderlabs/registrator:latest \<br>                  consul://$CONSUL_HTTP_ADDR</pre><p>Now, let’s start a simple container that runs Nginx:</p><pre>$ sudo docker run -d --name=webservice \<br>                  -e CONSUL_HTTP_ADDR=$CONSUL_HTTP_ADDR \<br>                  -e SERVICE_NAME=webservice \<br>                  --dns 169.254.1.1 -P nginx:latest</pre><p>Registrator will notice, and publish to Consul. (Since the nginx image exposes two ports, Registrator will append -80 and -443 to the webservice service name when registering it with the catalog. You can change that behavior if you like by <a href="http://gliderlabs.com/registrator/latest/user/services/">setting other environment variables</a>.)</p><pre>$ sudo docker logs registrator<br>2017/02/17 22:50:52 added: cd09c82f01ba vessel:webservice:443<br>2017/02/17 22:50:52 added: cd09c82f01ba vessel:webservice:80</pre><pre>$ curl <a href="http://$consul_http_addr/v1/catalog/service/webservice?pretty">http://$CONSUL_HTTP_ADDR/v1/catalog/service/webservice-80?pretty</a><br>[<br>    {<br>        &quot;ID&quot;: &quot;6c542e7f-a68d-4de0-bcc0-7eb6b80b68e3&quot;,<br>        &quot;Node&quot;: &quot;vessel&quot;,<br>        &quot;Address&quot;: &quot;10.0.0.2&quot;,<br>        &quot;ServiceID&quot;: &quot;vessel:webservice:80&quot;,<br>        &quot;ServiceName&quot;: &quot;webservice-80&quot;,<br>        &quot;ServiceTags&quot;: [],<br>        &quot;ServiceAddress&quot;: &quot;&quot;,<br>        &quot;ServicePort&quot;: 32772,<br>        &quot;ServiceEnableTagOverride&quot;: false,<br>        &quot;CreateIndex&quot;: 496,<br>        &quot;ModifyIndex&quot;: 496<br>    }<br>]</pre><p>When the container is shut down, Registrator will automatically remove it from the Consul catalog.</p><h3>Conclusion</h3><p>With clever use of dummy network interfaces, we can allow Docker hosts to utilize a Consul agent without any difficult or confusing configuration.</p><p>And with Registrator, we can easily publish running Docker containers to Consul with minimal effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*BPHrSURIW9TBdOqabW1Jsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/115/1*eBY4z0LSCvBgPZZ7qR3Hqg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fceda1d52b9" width="1" height="1" alt=""><hr><p><a href="https://zendesk.engineering/making-docker-and-consul-get-along-5fceda1d52b9">Making Docker and Consul Get Along</a> was originally published in <a href="https://zendesk.engineering/">Zendesk Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dear Apple: Give Us Control Over Stalkerware]]></title>
            <link>https://medium.com/hackernoon/dear-apple-give-us-control-over-stalkerware-95c625f585fb?source=rss-3eb95feb0c13------2</link>
            <guid isPermaLink="false">https://medium.com/p/95c625f585fb</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[stalkerware]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[uber]]></category>
            <dc:creator><![CDATA[Michael S. Fischer]]></dc:creator>
            <pubDate>Sun, 04 Dec 2016 22:21:06 GMT</pubDate>
            <atom:updated>2019-05-13T05:21:02.582Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you, like me, would like to convince Apple to help us, please send a message to Apple referencing this page via their </em><a href="http://www.apple.com/feedback/iphone.html"><em>iPhone feedback form</em></a><em>. Apple does listen!</em></p><p>Dear Apple:</p><p>I love that you care about our privacy. You fight hard for us when you <a href="http://www.nytimes.com/2016/02/21/technology/apple-sees-value-in-privacy-vow.html">refuse to hand governments the keys to our phones</a>. You say that enforcing privacy is a <a href="http://bits.blogs.nytimes.com/2015/09/29/tim-cook-apples-chief-speaks-on-civic-duty/">civic duty</a>. It’s important to me and to millions of other users. Your stance on privacy protections is one of the many reasons your customers choose <a href="https://hackernoon.com/tagged/apple">Apple</a> products over those of your competitors.</p><p>Today, we need your help in a small but important way.</p><p>It’s come to light that <a href="https://hackernoon.com/tagged/uber">Uber</a> and other companies have begun tracking our locations in more circumstances than ever. We’ve always relied on their apps to use our location — to do helpful things like find us a fast and convenient way to get where we want to go.</p><p>But this time, they’ve gone too far. <a href="http://www.npr.org/sections/alltechconsidered/2016/12/01/503985473/uber-now-tracks-passengers-locations-even-after-theyre-dropped-off">They’re now insisting that we provide them our location, when we don’t need them to, or don’t want them to, to use their services.</a></p><p>Specifically, <strong>anyone who installed or upgraded the Uber app in the past few weeks and enabled them to view their location is now giving their location to Uber all the time</strong> (unless they subsequently manually disabled their access to their location). Uber can now track us whenever they like — even if we have no intent to use their service anytime soon, or haven’t used their app in months.</p><p>And most users don’t even know Uber and others have this ability. It’s creepy and it’s unnecessary, and makes us unsafe.</p><p>There’s a word for software that insists they know where you are all the time: <strong>Stalkerware.</strong></p><p>How have Uber and others developed such stalkerware? Through one small loophole, and one that can easily be remedied by Apple.</p><p>As you know, iOS allows users to control how apps can access the user’s location. There are three choices: “Always,” “When using the app,” or “Never.” These are reasonable options. Some users might never want an app to have access to their location. Others might have a strong trust relationship with the app and its authors and allow the app always to track them.</p><p>Most of us, though, fall into the middle camp: We want to allow apps to use our location for the purpose of providing a service, but want to control our privacy when the app or its authors cease doing business with us. So what we’re asking is simple:</p><p><strong>Don’t allow app developers to disable the “when using the app” Location privacy option.</strong></p><p>It’s simply unnecessary for Uber or others to track us when the app isn’t in use. How do we know this? <strong>Because these apps worked adequately before they disabled this option.</strong> We were able to meet our drivers by opening the app, finding our location, and hailing a driver. We gave them enough information to get the job done, and we were satisfied with the results.</p><p>Uber argues that they want to use more location data to improve the user experience — for example, to track a rider’s location between the time the driver was summoned and the time the rider was picked up, even if the rider closed the app. That may be so. But that doesn’t mean I or anyone else should be forced to give up my location to them, at their whim.</p><p>So, Apple, we ask you: Help us keep our privacy and safety. If app developers want to know our location, they can ask us. But <strong>we should have the right to give Uber and others our location only when they truly need it — and the mechanism for doing so already exists</strong>. We shouldn’t have to flip a switch to enable our location so we can use it, then flip the switch back to get our privacy back.</p><p>Thank you for your help.</p><blockquote><a href="http://bit.ly/Hackernoon">Hacker Noon</a> is how hackers start their afternoons. We’re a part of the <a href="http://bit.ly/atAMIatAMI">@AMI</a>family. We are now <a href="http://bit.ly/hackernoonsubmission">accepting submissions</a> and happy to <a href="/service/mailto:partners@amipublications.com">discuss advertising &amp;sponsorship</a> opportunities.</blockquote><blockquote>To learn more, <a href="https://goo.gl/4ofytp">read our about page</a>, <a href="http://bit.ly/HackernoonFB">like/message us on Facebook</a>, or simply, <a href="https://goo.gl/k7XYbx">tweet/DM @HackerNoon.</a></blockquote><blockquote>If you enjoyed this story, we recommend reading our <a href="http://bit.ly/hackernoonlatestt">latest tech stories</a> and <a href="https://hackernoon.com/trending">trending tech stories</a>. Until next time, don’t take the realities of the world for granted!</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95c625f585fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/dear-apple-give-us-control-over-stalkerware-95c625f585fb">Dear Apple: Give Us Control Over Stalkerware</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>