<?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 Wendy Sanarwanto on Medium]]></title>
        <description><![CDATA[Stories by Wendy Sanarwanto on Medium]]></description>
        <link>https://medium.com/@wendysanarwanto?source=rss-4e2de08e0c5f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gDhPUqo0VElS1WGLny-XPg.jpeg</url>
            <title>Stories by Wendy Sanarwanto on Medium</title>
            <link>https://medium.com/@wendysanarwanto?source=rss-4e2de08e0c5f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 16:10:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wendysanarwanto/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[Setup Node.JS-Typescript Project]]></title>
            <link>https://medium.com/@wendysanarwanto/setup-node-js-typescript-project-5d54e8b5fdd?source=rss-4e2de08e0c5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d54e8b5fdd</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Wendy Sanarwanto]]></dc:creator>
            <pubDate>Tue, 26 Dec 2017 10:41:41 GMT</pubDate>
            <atom:updated>2018-10-12T19:16:22.529Z</atom:updated>
            <content:encoded><![CDATA[<p>In my past project, I have been involved in developing node.js-based Backend application, using ES5 and later on, ES6 scripts. As our backend application grew into larger size, complex and hard to debug &amp; maintain, we also encountered an unexpected behaviour. We have an API which should return a success response with desired outcome response object. But, instead of we get the result object on one of the response’s property, we get error message in the property. We concluded that our code has violated the response contract’s specification.</p><p>Based on this outcome, we then decided to rewrite the Backend app and selected Typescript as the new language, than using ES6 again. We decided using Typescript, because we want to enforce strong typed contracts across fields, method’s arguments &amp; return type, so that we could eliminate the possibility of such that erroneous behaviour in the rewritten version. The outcome was we often faced build error when we tried passed in argument which has any type or mismatched type. We were happy, because it has improved the quality of our code and the error that we had when we used ES6, did not happen anymore.</p><p>Moving fast forwarded to today, I’d like to repeat our of success story by using Typescript language over ES6 when working on any node.js backend apps or libraries first, as I can. In this article, I’d like to share the steps of how to create a Typescript node.js project, in the next following sections.</p><h4><strong>Pre-requisites</strong></h4><ul><li>Ensure that you have installed node.js in your machine. Visit this <a href="https://nodejs.org/en/">link</a> to download the installer for Windows/Mac machine. For Linux machine, follow steps described in this <a href="https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions">link</a>.</li><li>Install typescript through running this command: npm i -g typescript@latest</li><li>Install tslint through running this command: npm i -g tslint@latest</li></ul><p><strong>Creating a new Node.js Project</strong></p><ul><li>Create a new folder and initialise the created folder as a Node.js project, through running npm init command in the created folder.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*y9JFeQptE0p4TtCBq2E6bg.png" /></figure><ul><li>Add a new .gitignore file and ensure the /node_modules/ folder should be ignored by git client later.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*rz0Y7S9YiRqw2NNuN-AjUQ.png" /></figure><h4><strong>Setup the Node.js project into a Typescript project</strong></h4><ul><li>Run tsc --init command to initialise the current directory as a Typescript project. Running the command will create tsconfig.json file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*kPJuP3b0nQiOlH_N1Acofw.png" /></figure><ul><li>Run tslint --init command to initialise Typescript linting setting in current directory. Running the command will create tslint.json file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*D3BrfF0-NJuefLOQq-GVlA.png" /></figure><ul><li>If you wish to let tslint passes any console.log line(s) within your code later, you need to open &amp; edit the tslint.json to be as in the following code snippet:</li></ul><pre>{<br>   &quot;defaultSeverity&quot;: &quot;error&quot;,<br>   &quot;extends&quot;: [<br>      &quot;tslint:recommended&quot;<br>   ],<br>   &quot;jsRules&quot;: {<br>   },<br>   &quot;rules&quot;: {<br>      <strong>&quot;no-console&quot;: [false]</strong><br>   },<br>   &quot;rulesDirectory&quot;: []<br>}</pre><ul><li>Run npm install ts-node tslint typescript typescript-eslint-parser @types/node rimraf --save-dev command for installing required minimum dependencies inside the project directory. After running this command, your package.json file should have devDependencies section which has name of the libraries that we have installed earlier</li><li>Create a new folder in the project’s root directory, and name the new folder as src .</li><li>Open &amp; edit the tsconfig.json with entries shown in the following code snippet</li></ul><pre>{<br>   &quot;compilerOptions&quot;: {<br>      &quot;target&quot;: &quot;es6&quot;,<br>      &quot;module&quot;: &quot;commonjs&quot;,<br>      &quot;outDir&quot;: &quot;dist&quot;,<br>      &quot;sourceMap&quot;: false,<br>      &quot;declaration&quot;: true,<br>      &quot;lib&quot;: [<br>        &quot;es2017.object&quot;,<br>        &quot;es2015&quot;,<br>        &quot;es2017&quot;<br>      ]<br>   },<br>   &quot;files&quot;: [<br>      &quot;./node_modules/@types/node/index.d.ts&quot;<br>   ],<br>   &quot;include&quot;: [<br>      &quot;src/**/*.ts&quot;<br>   ],<br>   &quot;exclude&quot;: [<br>      &quot;node_modules&quot;<br>   ]<br>}</pre><ul><li>Open &amp; edit the package.json file, and add these npm scripts, which will be used for building the project &amp; cleaning up the build artefacts.</li></ul><pre>{<br>...<br>  &quot;scripts&quot;: {<br>     &quot;build&quot;: &quot;tsc &amp;&amp; npm run lint&quot;,<br>     &quot;clean&quot;: &quot;rimraf ./dist&quot;,<br>     &quot;lint&quot;: &quot;tslint -c tslint.json &#39;src/**/*.ts&#39;&quot;,<br>     &quot;tsc&quot;: &quot;tsc&quot;,<br>     &quot;test&quot;: &quot;mocha -r ts-node/register src/**/*.spec.ts&quot;<br>  },<br>...<br>}</pre><h4><strong>Testing the setup</strong></h4><p>At this point, we shall have converted our node.js project as a Typescript project. As for the 1st testing step, we are going to add a new typescript file (let the file is named as app.ts) inside the src subdirectory. Then, we will edit the file with simple code and then run the build npm script. The expected outcome of the build process is, it should produce dist subdirectory and within the subdirectory, it should contain the app.ts file and also the transpiled app.js file. Below are the details steps:</p><ul><li>Create a new typescript file inside the src sub-directory and name it as app.ts In the typescript file, you write a simple code such in this following code snippet:</li></ul><pre>main();</pre><pre>function main() {<br>   console.log(`Hello Typescript!`);<br>}</pre><ul><li>Build the project by running npm run build . Confirm that there is no error build appears and a new app.js file is created inside src subdirectory.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*Bs8pDaHlJgTTRE4SCRnLGQ.png" /></figure><ul><li>Run node dist/app.js command to test whether the transpiled code is running well or not.</li></ul><h4>What’s next</h4><p>In the future, we may want to create more Typescript node.js projects by following this guide. Creating several projects by following the guidance steps in manual way, might take time and prone to human errors. Therefore, we will explore approaches to generate the Typescript node.js project using project scaffolding/generator tool such as Yeoman in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d54e8b5fdd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an ARM Computers Cluster using Raspberry Pis]]></title>
            <link>https://medium.com/@wendysanarwanto/building-an-arm-computers-cluster-using-raspberry-pis-24c48021dc69?source=rss-4e2de08e0c5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/24c48021dc69</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Wendy Sanarwanto]]></dc:creator>
            <pubDate>Mon, 28 Aug 2017 17:19:31 GMT</pubDate>
            <atom:updated>2017-08-29T02:34:16.476Z</atom:updated>
            <content:encoded><![CDATA[<p>Back to early 2000s, I have been thinking about deploying &amp; running my backend apps into my own clustered machines. However, I was held back due to the cost for building such this infrastructure would cost me lot of money, such for buying U1 racks or Blade machines and also preparing an air conditioned, wide place for housing these machines.</p><p>Fast forwarded to today, credit card sized ARM computer boards (SBC -Small Board Computer) are on rising. Hackers, hobbyist, students &amp; developers start looking on these tiny computers, mostly to be used as part of their Internet of Things (IoT) projects. Beside the mini ARM machines are used for IoT projects, some people also used a number of these boards, stacked them up, built them as Clustered Computer, similar to U1 racks or Blade machines but they’re seems like the minified version those machines. They used the “mini blade” for learning &amp; doing experimentation such as running Hadoop, web server farms, containers, databases, etc.</p><p>This fact awakes my dormant desire about running backend apps on my own cluster. I decided to start building my own, and would like to feel, see, experience the journey lies ahead of running my apps on my own -minified version of “Blade”. In this article, I am going to share my experience of building these stacked Tiny machines. Hope you, readers, would find it useful for building your own mini “Blade” as well.</p><p><strong>Shopping the Parts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ICR2PDuTwcKSEZBf9QE1rQ.jpeg" /><figcaption>Parts to build the ARMs cluster</figcaption></figure><p>I bought the parts from various online stores, hosted in one of eCommerce giant platform in Indonesia, the <a href="https://www.tokopedia.com/">Tokopedia</a>. Below is the list of these parts, as you could see in the above screenshot:</p><ul><li>Raspberry Pi 3 Model B (element 14 UK) — The ARM boards we are going to use for building the cluster</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gWZtJV6LzINbWg8jLfv-9w.jpeg" /><figcaption>Raspberry Pi 3 Model B ARM Small Computers</figcaption></figure><ul><li>Aluminium Heat Sink Heatsink — Aluminium block pieces that are going to be attached to surface of ARM Board’s chips, to dissipate an amount of heats during operation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MY3HpuSK2I7L2ZcSIpZq9A.jpeg" /><figcaption>Heat sink aluminium blocks</figcaption></figure><ul><li>16 GB sized Micro SD Cards — Each of these cards will be the storage media of the ARM SBCs. We will format and install Raspbian OS in them so that they could be used for booting our ARM SBCs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mg7cG1V_cbWtsrB8b4l9Xg.jpeg" /><figcaption>16 GB Micro SD cards</figcaption></figure><ul><li>UTP Patch Cord Cat-6 cables — These cables are used for connecting the ARM boards through attaching them into a Switch Hub. to build a Local Area Network for the Cluster.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qIYr-KNowQcUr5KzI_oq7A.jpeg" /><figcaption>UTP CAT 6 LAN Cables</figcaption></figure><ul><li>8 Ports Switch Hub — connecting all of ARM Boards (through UTP cables), to form a Local Area Network which is a important part of the Cluster.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VjwpbvzMUM32xfx504UMYQ.jpeg" /><figcaption>8 ports switch hub</figcaption></figure><ul><li>OTG USB Cables — The cable are used for connecting the ARM boards to Power Supply unit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T35Tz64FS2J2PdB8bazy7w.jpeg" /><figcaption>OTG USB Cables</figcaption></figure><ul><li>6 USB ports 60W 5v/12 A power charger</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUBNZ0TGZt7lLZnzwQ1ODQ.jpeg" /></figure><ul><li>Multi-level casing for housing the stacked RPis</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mSj544vsPMvg7ZUFEw6VlQ.jpeg" /></figure><p>The money that I spent for buying all of these parts in the list, is roughly $370 USD. To me, the cost is attractive for building a 5 ARM Boards cluster.</p><p><strong>Install Raspbian OS on SD Cards</strong></p><ul><li>I picked one of the SD Card packages, unwrapped &amp; unsealed. Then, I put it into my USB SD Card reader stick’s slot.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WqbOiz8L61bPvIe2X_kXsA.jpeg" /><figcaption>SD Card Reader USB stick</figcaption></figure><ul><li>Once the SD Card is seated in, I plugged the USB stick into my Desktop PC running Ubuntu 16.04.3 LTS, then began erasing partition in the SD card using GParted application</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*-XGPJNW_aVOsXVa8nlrU5g.png" /><figcaption>Selecting existing partition on SD Card to delete.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*MIXMQ-3ZMysGId3nZNLESQ.png" /><figcaption>the SD card with no partitions</figcaption></figure><ul><li>Next, I opened Disksapplication, select the SD Card device and restore the Raspbian image into the SD Card.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0uNwkruxaDzgcgX-Vwt3A.png" /><figcaption>Selecting Raspbian Image to restore to the Empty SD Card</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*qefRF7EJJst-KN1BOwT1fQ.png" /><figcaption>Restoring Raspbian Image to the SD Card</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*uiTfkotqS2SQGwW1PYCzxw.png" /><figcaption>SD Card with restored Raspbian</figcaption></figure><ul><li>Ejected the SD card to USB stick and ejected the SD card from the USB stick as well.</li><li>I repeated prior steps against other remaining SD Cards</li></ul><p><strong>Plugged the SD Card to one ARM board and boot it up</strong></p><ul><li>I picked one ARM board, and put the aluminium heatsink pieces on the ARM board’s chips. The heatsinks that I bought, have sticky, termal paste on its bottom surface. So when I put the heatsinks, with the sticky surface on top the chip, the heatsinks sit &amp; stick on the chip.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cSpjK3xI516whgfQyz9_Pg.jpeg" /><figcaption>Attached Heatsinks on the Rpi’s Chips</figcaption></figure><ul><li>Plugged the SD Card with Raspbian OS into the Rpi’s SD Card slot.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7HLeq-i5vNgltDZlDSm6A.jpeg" /><figcaption>Insert the SD Card into Rpi’s SD Card slot</figcaption></figure><ul><li>Plugged PC USB keyboard &amp; Mouse into the Rpi’s USB ports</li><li>Plugged the Desktop LED Monitors into the Rpi’s HDMI port.</li><li>Then, I plugged a USB OTG power cable into the Rpi’s USB OTG female connector to power up the rpi. At this point, I had confirmed that the Raspi’s boot-up screen was shown up on my Desktop LED Monitor.</li><li>I fired up terminal window and began running sudo apt-get update &amp;&amp; sudo apt-get upgrade -y for updating current softwares &amp; libraries in the Rpi, into the latest version. Before I shutdown the RPi, I also changed /etc/hostname and /etc/hosts files, put static IP address in there so that the RPis could be accessed from my PC, or I could access them from other connected RPis later.</li></ul><p><strong>Clone the SD Card’s OS to other SD Cards</strong></p><p>I shutdown the RPi. plugged my monitor &amp; keyboard back to my PC and ejected the SD card from the turned off RPi. I inserted the SD Card back into my USB SD Card reader and backup the content by running dd command such as dd if=/dev/sde of=/home/wendysa/raspi-backups/raspbian-jassie_pristine.img bs=1M</p><p>Once I obtained the image file, I then restore the image on other SD cards and inserted them into the rest of RPis. By doing this way, I do not need to repeat prior steps to setup other RPis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iI0C-pXYF_3GMjzSrfWB1A.jpeg" /></figure><p><strong>Assemble the Stacked ARM Boards</strong></p><p>After all of RPis have been setup, I then bolted each of RPi to each of Multi Case’s plates. Then, I stacked &amp; bolted each plates one to another using provided standoffs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9JCGLLwKBkp7KXWwX0Y5qg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f8_1WJeoQLEI9Sf8W5K4wQ.jpeg" /></figure><p>I connected each of RPis into the 8-ports Switch/Hub with UTP cat 6 cables , connect the switch into my Desktop PC, created a private Local network for them. Lastly, I connected the Anker USB Power Hub with the stacked RPis, before I powered the RPis up.</p><p><strong>Unleash the Kraken !</strong></p><p>Once all Network &amp; USB Power Cables have been plugged, I then connected the Switch’s adaptor &amp; USB Port Power hub into the main power outlet to bootup the RPis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZX4aM8qzXmTV662uJlp8A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfGfRHeVVfPBZpd8siPcNg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TiWIAappTeLZYZRWt93QCg.jpeg" /></figure><p>From here, I then setup the network interfaces of the RPis, <a href="https://medium.com/@wendysanarwanto/sharing-internet-connection-to-raspberry-pis-wired-to-local-network-937d864fe205">sharing the internet connection on my desktop to them</a> and <a href="https://medium.com/@wendysanarwanto/setup-domain-name-for-raspberry-pis-wired-to-local-network-5dd04b60140d">setup DNS server in the Private Local Network</a> so that I could reach each of them by their Hostname instead of by IP Addresses.</p><p><strong>Next plan to do</strong></p><p>In the near future, I am going to setup Docker Swarm on the RPis cluster. Then, I already have a number of things I’d like to try on the cluster, such as running Jenkins Master-Slave nodes for providing CI/CD when developing backend apps, cryptocurrency mining , load balancing , HA simulation and many more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24c48021dc69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup Domain Name for Raspberry Pis, wired to Local Network]]></title>
            <link>https://medium.com/@wendysanarwanto/setup-domain-name-for-raspberry-pis-wired-to-local-network-5dd04b60140d?source=rss-4e2de08e0c5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dd04b60140d</guid>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[raspbian]]></category>
            <dc:creator><![CDATA[Wendy Sanarwanto]]></dc:creator>
            <pubDate>Sun, 20 Aug 2017 09:54:01 GMT</pubDate>
            <atom:updated>2017-11-11T20:07:03.380Z</atom:updated>
            <content:encoded><![CDATA[<p>In my <a href="https://medium.com/@wendysanarwanto/sharing-internet-connection-to-raspberry-pis-wired-to-local-network-937d864fe205">previous article</a>, I have shared my experience about sharing internet connection received by my Desktop PC, to the RPis. While this setup is okay to me, there is a small matter that bugged me. Whenever I need to reach other RPi from another RPi or from my connected desktop PC (e.g. doing SSH), It requires me to remember &amp; type in the target machine’s IP Address. I want to improve this experience further by just typing the hostname of the target machine such as ssh pi@rylai instead of ssh pi@10.128.20.12</p><p>I understand that in order to achieve this, I would need to setup &amp; run Domain Name System (DNS) servers in my RPis LAN. But, it’s another “I know ( what I should do), but I don’t know (the technical detail of how to do it)” problem to me. After I spent a couple of days searching references which fit to my case, I then bumped with <a href="https://techpolymath.com/2015/02/16/how-to-setup-a-dns-server-for-a-home-lab-on-ubuntu-14-04/">this article</a>. Someone has done it, but I’d like to prove it and see if it fits &amp; works on my RPis LAN.</p><p>In this article, I am going to share my experience of how I setup the primary &amp; secondary servers on my Desktop PC and my old Raspbery Pi 2 Model B, I connected to the RPis Private Local Network.</p><p><strong>Updated the IP Addresses</strong></p><p>I did not change any physical parts that are involved in the private network. However, in order to get this done by following the <a href="https://techpolymath.com/2015/02/16/how-to-setup-a-dns-server-for-a-home-lab-on-ubuntu-14-04/">article</a>, I changed each RPis and my desktop PC’s IP Addresses as in the following list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*mm_63YaF8lUQ3mwvwX-7xw.png" /><figcaption>List of each machine’s new IP Addresses</figcaption></figure><p>Since I updated the network’s address to xxx.xxx.0.0 (netmask 255.255.0.0), these updates will allow me to connect more nodes up to 255 x 255 = 65k devices. Thus, I won’t need to feel worry with re-updating my network’s IP Addresses in the future, when I’ll add more devices into the private network.</p><p>I applied the new IP Addresses to RPis through reverting the IP Address configuration I made in dhcpcd.conf file, moved them into /etc/network/interfaces file and also changed the host’s IP Address in the /etc/hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*tBMANLgR2vhNBxvmXz8lQQ.png" /><figcaption>Added a new entry which map the new IP address to the new host name.domain name</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*L63PTySrMTmn92KV89QLlw.png" /><figcaption>/etc/dhcpcd.conf in each RPis were reverted into default</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*5D5bQN8KkDxGMgBoMCKYMg.png" /><figcaption>/etc/network/interfaces in each RPIs.</figcaption></figure><p>I also did similar change on my Dekstop PC’s /etc/network/interfaces and /etc/hosts files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*A3off2x0gszXHhtL6X-r9g.png" /><figcaption>Changed /etc/network/interfaces file with the new IP on my PC’s LAN port (enp6s0)</figcaption></figure><p>I then restarted all RPis and my PC after making these changes on each of these machines, to ensure the changes took effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*7JOA76o_jS2LRxXMTDwMjA.png" /><figcaption>The new IP Address reported by ifconfig command, after rebooted the RPi</figcaption></figure><p><strong>Setup Primary DNS Server on My Ubuntu PC</strong></p><p>The software which runs DNS server in Linux OS is bind9. I installed bind9 and an additional software(dnsutils ) software on my Ubuntu Dekstop PC, through running this command:</p><p>sudo apt-get update &amp;&amp; sudo apt-get install bind9 bind9utils bind9-doc dnsutils</p><p>Then, I modified bind9’s default config to ensure that it will run on IPV4 mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*BQNEeVM1Il7ppyiM1CfhBA.png" /><figcaption>Modified /etc/default/bind9 to force bind9 runs in IPV4 mode</figcaption></figure><p>Next, I modified /etc/bind/named.conf.options , /etc/bind/named.conf.local files to put my Private network’s address and the new IP Addresses of each connected hosts, into bind9 ‘s configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*V6LBH6F-NerdOKM75nka7w.png" /><figcaption>Adjusted /etc/bind/named.conf.options file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*t02xAjUWplzuTy-e_sl_jw.png" /><figcaption>Adjusted /etc/bind/named.conf.local file</figcaption></figure><p>Then, I created /etc/bind/zones/db.&lt;my private network&#39;s domain name&gt; as the zone’s config file and /etc/bind/zones/db.&lt;my private network&#39;s unmasked ip address&#39;s parts&gt; as the reversed zone’s config file. I changed these files, as shown in the following screenshots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*ckvM3MrMNJsEVDBjkmXvSg.png" /><figcaption>The Zone File</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*ThULBxeUg2Xhfzgjk9HLQQ.png" /><figcaption>The Reversed Zone file</figcaption></figure><p>After I modified &amp; created these files, I then run named-checkconf &amp; named-checkzone commands to ensure that the changes are valid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*LCK-0hJ0nAzVS-0mqeThLQ.png" /><figcaption>Validate changes in bind9’s config files</figcaption></figure><p>I also wanted to ensure my desktop PC still could access the connected RPis by specified hostname, instead of IP address later. To achieve this, I replaced /etc/resolv.conf file with a symbolic link to /run/resolvconf/resolv.conf .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*DBBpja69G3RJK0FiTO3lZg.png" /><figcaption>Replaced /etc/resolv.conf with a link</figcaption></figure><p>Then I modified /etc/resolvconf/resolv.conf.d/head file, by entering nameserver entries with IP Addresses of Google’s DNS servers and my Desktop PC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*1CSoo9wt_5_A5v5bpWu29A.png" /><figcaption>edited /etc/resolvconf/resolv.conf.d/head file</figcaption></figure><p>Lastly, I rebooted my Ubuntu Dekstop PC to see if all changes that I made would take effect and the Primary DNS server ran properly.</p><p><strong>Setup Secondary DNS Server on the Raspberry Pi 2 Model B</strong></p><p>Setup a secondary DNS is an optional path. I decided to do it anyway, just to make sure when my PC is turned off and my clusterd RPis are still running, the RPis still could reach each other by specifying their host names. I decided to run the secondary DNS server on my Raspberry Pi 2 Model B, so that I could maximise the number of RPis 3 in the private network to be focusing on actual works that will happen in future.</p><p>Setup bind9 on my RPi 2 is quiet similar to setting it up on my Desktop PC earlier. 1st, I did SSH to the Rpi 2, ran update repository command followed by apt-get command for installing bind9, bin9utils, bind9-doc &amp; dnsutils .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*0zRmFHE3WfnOkaDop4KVzw.png" /><figcaption>Install bin9 and utils on RPi 2</figcaption></figure><p>Then, I did same changes on my PC’s bind9 default config file, to enforce bind9 will run on IPV4 mode later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*rhlHDbbTXbPmpf5eh88JXA.png" /><figcaption>Enforce bind9 runs in IPV4 mode</figcaption></figure><p>Next, I edited both/etc/bind/named.conf.options &amp; /etc/bind/named.conf.local files as shown in these following screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*HmdyvL-5Hzx70zTk94ORoQ.png" /><figcaption>/etc/bind/named.conf.options file of Secondary DNS server</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*QdK9ihwJctKjfSuUKtUFxA.png" /><figcaption>/etc/bind/named.conf.local file of Secondary DNS server</figcaption></figure><p>Notice the different settings in the named.conf.local file compared to the Primary DNS’s file: the type of each zones are set as slave and within each of zones, there is masters entry which points to the Primary DNS’s IP address.</p><p>I did not create zone files for secondary DNS server. Thus, I just rebooted my Raspberry Pi 2 to see the changes that I made earlier.</p><p><strong>Testings</strong></p><p>Once I rebooted my desktop PC and my Raspberry Pi2, I then began conducting a number of Tests, to confirm that the Primary &amp; Secondary DNS are working properly. For 1st Test, I did ping, dig&amp; ssh from my Dekstop PC to one of Raspberry Pi3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*sYLJ4j9fPaTUM52pIfDOiw.png" /><figcaption>Ping &amp; SSH other nodes by their hostnames from Primary DNS Server</figcaption></figure><p>As we could see, the Primary DNS server (My PC) was able to reach the RPis by their hostnames. Next, I ran dig against one of the RPis by host name, from my PC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*wHAfCqHeoIt7Q-RPaSdoOA.png" /><figcaption>Run dig against one of RPi3 by hostname &amp; domain name</figcaption></figure><p>We noticed more interesting info appeared from dig , such as the IP Addresses of Primary &amp; Secondary DNS servers, beside the RPi’s full domain name and its IP Address.</p><p>2nd Test was doing same thing as in 1st Test, but this was done from within an RPi3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*ygTMWnIhgXmyajzZfrx6kA.png" /><figcaption>Ping &amp; SSH test from within an RPi3 to other machines</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*bEuKyOarYqIB62skEUVgsA.png" /><figcaption>Running dig against other nodes from the RPi 3</figcaption></figure><p>Lastly, for the final test, I turned off bind9 service on my Desktop PC, to simulate if the Primary DNS server is downed, the Secondary DNS server will serve as the Naming server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*ROJl1wQw-TORm0QCevJN5w.png" /><figcaption>Disabling the bind9 on the Primary DNS server</figcaption></figure><p>Then I performed ping &amp; ssh commands from within an RPi 3 to other RPi3 or 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*1lTZkNWGmcbUW40tH6HEgA.png" /><figcaption>ping &amp; ssh from a RPi3 to other machines when Primary DNS is turned off</figcaption></figure><p>As shown in the screenshots, the secondary DNS server was successful took over the Primary DNS server’s role when it is turned off.</p><p><strong>Next plans</strong></p><p>At this point, my clustered RPis can “talk” each other by specifying their host names, instead by their IP Addresses. Also, we could ensure that this feature won’t be gone when I turned off my PC (the Primary DNS server), as long as my RPi 2 B (the Secondary DNS server) is still connected &amp; functional.</p><p>In the future, I am going to utilise these clustered ARM Small Computers for serving as my personal R&amp;D infrastructure, supporting my backend application’s development, such as: running Jenkins build in master/slaves mode, running clustered Redis database instances, simulating HA &amp; Load Balancing test scenarios against my Application’s Backend API, security tests, running Docker swarm master/worker containers and many more.</p><p><strong>Reference(s)</strong></p><ul><li>How to Setup a DNS Server for a Home Lab on Ubuntu 14.04 — <a href="https://techpolymath.com/2015/02/16/how-to-setup-a-dns-server-for-a-home-lab-on-ubuntu-14-04/">https://techpolymath.com/2015/02/16/how-to-setup-a-dns-server-for-a-home-lab-on-ubuntu-14-04/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dd04b60140d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sharing internet connection to Raspberry PIs, wired to Local Network]]></title>
            <link>https://medium.com/@wendysanarwanto/sharing-internet-connection-to-raspberry-pis-wired-to-local-network-937d864fe205?source=rss-4e2de08e0c5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/937d864fe205</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[computer-network]]></category>
            <dc:creator><![CDATA[Wendy Sanarwanto]]></dc:creator>
            <pubDate>Mon, 14 Aug 2017 16:51:34 GMT</pubDate>
            <atom:updated>2017-08-14T16:51:34.392Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometime before I write this article, I bought 5 units of Raspberry Pi 3 Model B, along with : 6 pieces of UTP Cat 6 RJ-45 cables, 5 Sandisk 16GB Micro SD cards, an 8 ports TP-Link TL-SF1008D LAN Switch, and an Anker 6 ports USB Power Adapter with 6 USB OTG cables as well. I ordered those parts, to be used for building an ARM based Computers Cluster, wired altogether forming a Local Area Network.</p><p>Once I have setup Raspbian Jessie OS on each of these RPis, I then booted them, (by using my Desktop PC’s Keyboard , Mouse &amp; HDMI monitor) and began on assigning host name &amp; static IP on each of the RPis (through editing their /etc/hostname &amp; /etc/hosts files). I did this because I want to remote the RPis from my own desktop PC using SSH or Remote Desktop, by specifying their static IP Address.</p><p>I wired the Rpis using the UTP Cat6 cables to the LAN Switch, and also connected my Ubuntu Desktop PC into the Switch as well. I planned the topology of the wired Network as shown in this following picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*oePVIu4z-eaD3Q_LCjkqWg.jpeg" /></figure><p>I did ping test from an RPi to other connected RPis, from my Desktop PC to RPis, run ssh command from my desktop PC to the RPis, and the outcome were all went well.</p><p>A problem arise when I connected my Desktop PC to internet. Either through tethering my iPhone to my PC or connecting the PC to my Wireless MiFi modem, I could get access to internet from my Desktop PC, <strong>BUT not from the RPis in the wired LAN</strong>. It seemed that my Desktop PC did not share the Internet connection it receives to my RPis.</p><p>It took me few hours to understand, how sharing internet connection from my Ubuntu PC to my RPis can be done. Through google-ing efforts and trial-error attempts, I bumped into this <a href="http://www.nairabytes.net/81-linux/418-how-to-set-up-a-nat-router-on-ubuntu-server-16-04">article </a>&amp; followed partial steps in the article to get this done.</p><p>In this article, I am going to share my experience about how to share the internet connection received by my Ubuntu Desktop PC to the wired Raspberry Pis via Local Area Network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pATVXgdDOn2g-ARs_jPN-A.jpeg" /></figure><p><strong>Configure DHCP Client service on each of RPis</strong></p><p>Defining a static IP address on an RPi through writing it on /etc/hosts file , helped me remoting the RPi from my Desktop PC. However, it’s not enough to help the RPis for recognising my Desktop PC as the Gateway to Internet. Also, we need to define the address of DNS servers that the RPi should lookup to, so that when they browse to a specific URL Site, they could find it by the site’s Domain name (e.g. www.intel.com), instead of by its IP Address (e.g. 103.56.234.57).</p><p>Through experimentation, I also found that each of RPis runs DHCPCD server. It is a daemon software which helps the RPi receiving dynamic IP assigned by DHCP server. On one of my RPi, it gave me trouble: it overridden the defined Static IP, replaced it with Dynamic IP (e.g. 169.71.55.12).</p><p>In order to prevent this and also `telling` RPis that they should lookup for valid DNS server and recognise my PC as Gateway to the internet, I modified the /etc/dhcpd.conf file in the RPi as in the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*KHdDeFjLfCJqbpcN-RJznQ.png" /><figcaption>Editing /etc/dhcpcd.conf file</figcaption></figure><p>Additional changes in the red-squared lines are interpreted as follow:</p><ol><li>interface eth0 — Next configuration lines are applied to the LAN interface of the RPi, the eth0 .</li><li>static ip_address — This line defines the static IP of current RPi and the subnet mask (/24)</li><li>static routers — Defines the Gateway’s IP. In this case, it points to the IP Address of my Ubuntu PC.</li><li>static domain_name_servers — Define IP addresses of valid DNS servers. In this case, I defined IP Addresses of Google’s DNS servers.</li></ol><p>I saved the changes and then reboot the RPi. By the time my RPi was rebooted successfully, I ran ifconfig to confirm the IP address of eth0 interface has been assigned with the Static IP defined in /etc/dhcpd.conf earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*3as_Ko6KP7kiTK63QyH5UQ.png" /></figure><p>Then, I ping my ubuntu Desktop and I can confirm that the RPi still can reach out my PC.</p><p>I repeated these modification steps against the rest of RPis, except I gave different IP Address but still under same subnet address (e.g. RPi #2 = 192.168.8.202, RPi #3 = 192.168.8.203, etc).</p><p><strong>Configure IP Tables on the Ubuntu Desktop PC</strong></p><p>At this point, It was still half way to share the internet connection to the RPis. Then, I added Network Address Translation ( NAT ) configuration on my PC, through running thisiptables command in terminal window:</p><p><strong>sudo iptables -t nat -A POSTROUTING -o wlx6466b309ab63 -j MASQUERADE</strong></p><p>Then followed by running this command, to ensure that the IP packets routed from any wired RPis, will be forwarded to wlx6466b309ab63 wireless interface:</p><p><strong>sudo iptables -A FORWARD -i enp6s0 -o wlx6466b309ab63 -j ACCEPT</strong></p><p>Lastly, we run this iptables command to forward incoming packets from wlx6466b309ab63 interface to corresponding RPis, when the packets have an established initial request.</p><p><strong>sudo iptables -A FORWARD -i wlx6466b309ab63 -o enp6s0 -m state --state RELATED,ESTABLISHED -j ACCEPT</strong></p><p>To confirm that the changes were applied, I browsed a web page from any of the connected RPi and I confirmed that the web page is loaded on my RPi’s Chromium.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYGDyFK05O6wd-T95ZUhZw.png" /><figcaption>Confirming that the Internet is shared to Rpi</figcaption></figure><p><strong>Persist the Changes on IP Tables, permanently</strong></p><p>In this moment, I have configured NAT &amp; packets forwarding rules in my Ubuntu Desktop PC for sharing the internet to my RPis. To ensure that these configuration won’t be gone at next time I restart my PC, I installed iptables-persistent tool (run sudo apt-get install iptables-persistent for installing it) and then I ran sudo netfilter-persistent save command in terminal window. This will ensure that the IP Tables Configuration that I has made will be persisted and reloaded at next time I restarted the PC.</p><p><strong>Where to go from here</strong></p><p>I felt excited, seeing my RPis are fully connected in Local Area Network and also able to access Internet. Next, I would like to setup DNS server(s) in the LAN, so that each of nodes in the LAN would have their own internal domain name, such as mydesktop.nextresearch.local Once I could setup this, I would like to setup DHCP server in the LAN, so that each of the connected parties will have Dynamic IPs.</p><p><strong>Reference(s)</strong></p><ul><li><a href="http://www.nairabytes.net/81-linux/418-how-to-set-up-a-nat-router-on-ubuntu-server-16-04">http://www.nairabytes.net/81-linux/418-how-to-set-up-a-nat-router-on-ubuntu-server-16-04</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=937d864fe205" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Redis Docker Image for Raspberry Pi]]></title>
            <link>https://medium.com/@wendysanarwanto/building-redis-docker-image-for-raspberry-pi-b8d18e731289?source=rss-4e2de08e0c5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8d18e731289</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Wendy Sanarwanto]]></dc:creator>
            <pubDate>Sat, 05 Aug 2017 16:48:45 GMT</pubDate>
            <atom:updated>2017-08-11T02:22:37.834Z</atom:updated>
            <content:encoded><![CDATA[<p>During the weekend, the time I wrote this article, I have a plan to spend my off-time by creating a simple docker swarm project, which comprising my Desktop PC as the Swarm manager and my Raspberry Pi 2 Model B unit (attached to wireless LAN to my PC) as the worker node. The Rpi worker node is designated to run Redis server, as shown in this following picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hhcj5ixBdeiu8HTsStzQrQ.jpeg" /><figcaption>Simple Docker Swarm with the Worker Node running Redis</figcaption></figure><p>Right after initialised the Swarm and joined the Rpi as a worker node to the swarm, I then started pulling the newest version of Redis image container in my Rpi: <a href="https://hub.docker.com/r/library/redis/tags/4.0.1-32bit/">redis:4.0.1–32bit</a>. However, when I run a container using this image in my Rpi, it did not work. I remembered that the image is intended for x86 machine, while Rpi is an ARM based computer. I should pick the ARM version of the Redis image &amp; I don’t see any of it on <a href="https://hub.docker.com/r/library/redis/tags/">redis official docker hub page.</a></p><p>Then, I found some guys in Hypriot created dockerfile &amp; script for building Redis-Rpi, although it is quiet old. I want to run the latest version of Redis on the Rpi (version 4.0.1) and it would require me to making some changes on Hypriot’s Dockerfile, before building the image: replacing Raspbian:wheezy with <a href="https://hub.docker.com/r/raspbian/jessie/tags/">Raspbian:jessie</a> and change the Redis version from 3.0.4 to 4.0.1. To make these changes, I forked Hypriot repo and made the necessary changes, under a new branch on the <a href="https://github.com/WendySanarwanto/rpi-redis">forked repo</a>.</p><p>In the next lines, we will cover more detailed steps for making the latest version of Redis runs on my Rpi 2 Model B.</p><h3>Making required changes on Hypriot’s Dockerfile</h3><p>After I forked Hypriot’s repo, I cloned the forked repo into my PC and make this following necessary changes on the Dockerfile:</p><ul><li>Replace the OS image from raspbian:wheezy to raspbian/jessie — I want the image to run the latest version of Raspbian.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*AMe0LMyv7w2dUm5QOCmopQ.jpeg" /><figcaption>Upgrade Raspbian’s wheezy to jessie</figcaption></figure><ul><li>Update the Redis’s version, download URL &amp; Hash Code. These are taken from this <a href="https://github.com/antirez/redis-hashes/blob/master/README">site</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DnLNiXROHIXaHKGI6Ub-vg.jpeg" /><figcaption>New version of Redis and it’s download URL</figcaption></figure><ul><li>Change the last line to ensure when the container is running later, it will allow other connected machines, accessing the redis database.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*wzlKldUzFsUVBa7OQ2i4Kw.jpeg" /><figcaption>Turn off protected mode upon starting the server, to allow access to the database</figcaption></figure><ul><li>I pushed the changed Dockerfile to the forked repository, under “redis-4.0.1” branch.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2QN4cN49877dyT7w_bqAA.jpeg" /><figcaption>Pushed the updated Dockerfile into “redis-4.0.1” branch, on my github repo</figcaption></figure><h3>Build the Docker image on the Rpi</h3><ul><li>Open a new Terminal window and ssh into the Rpi.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*OeF2JYTKd47vmZKxmOdGcQ.jpeg" /><figcaption>SSH the Rpi</figcaption></figure><ul><li>Clone the forked repo.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*KELpsuyU493DzABFdJbwaw.jpeg" /><figcaption>Clone the forked repo</figcaption></figure><ul><li>Checkout the “redis-4.0.1” branch.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*HVJ-FXdBiJGte5SZDWTQBQ.jpeg" /><figcaption>Checkout “redis-4.0.1” branch</figcaption></figure><ul><li>Run `docker build -t &lt;dockerhub user id&gt;/&lt;repository name&gt;:&lt;tag&gt; .` command to start building the image, as shown in this following example:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*0ezSAu5UehLS20OXf3y0Nw.jpeg" /><figcaption>Run `docker build -t` to build the image from the Dockerfile</figcaption></figure><ul><li>Confirm that building image is success. Run `docker images` command to ensure that the image is created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*IfTZ-63CRJFL9CL2gI7QRQ.jpeg" /><figcaption>The Redis Docker Image</figcaption></figure><h3>Run &amp; Test the Image</h3><ul><li>Now, we will run a container from the created image through running `docker run` command.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*0rQsFhr75-VrfBiMTe2geg.jpeg" /><figcaption>Running `docker run` command to create &amp; run the redis container</figcaption></figure><ul><li>Then followed by running `docker ps` command to confirm that the container is up and still running.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*G6n2CC-Gjyxy7I8fntms7A.jpeg" /><figcaption>Confirming that the redis container is up &amp; running</figcaption></figure><ul><li>Now, we test the Redis container through doing CRUD against it, from the connected Desktop PC. We are going to use `redis-cli` for doing these query operations. If you don’t have the cli tool in your machine, run `sudo apt-get install redis-tools -y` command to install it.</li><li>To connect on the Raspi which runs the redis container, run `redis-cli -h &lt;rpi’s hostname or ip address` command. Confirm that no error message shown and the terminal enters Redis-Cli prompt</li><li>On the redis-cli prompt, run a query to store STRING data (e.g. set app.version 1.0). Confirm that the query returns ‘OK’. Next, run a query to get the STRING data back. Confirm that the query return correct result.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*_7PD34AXB7FJVfQXzoH3qQ.jpeg" /><figcaption>Connect to the Rpi Redis container using redis-cli and performs queries</figcaption></figure><h3>Push the image to Docker Hub</h3><p>In this point, we have created Rpi-Redis docker image that is ready to be used by our Raspberry Pis. However, we would like to have our future Raspberry Pis able to pull it from one common place. In this case, we are going to push our Rpi-Redis image into Docker Hub repository.</p><ul><li>Before we could push our image into Docker Hub, ensure that we have created Docker Hub account and then login into Docker Hub in the terminal, through invoking this command `docker login — username &lt;your docker hub account’s username&gt; — password &lt;your docker hub’s password&gt;`</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*ltjTxj5mdDLjtruMetmZDQ.jpeg" /><figcaption>Login to docker hub</figcaption></figure><ul><li>Finally, we run the `docker push &lt;dockerhub user id&gt;/&lt;repository name&gt;:&lt;tag&gt;` to push the image into Docker hub.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*-ixJrGaPVsTboKinQVp-Yw.jpeg" /><figcaption>Pushed Rpi-Redis docker image into Docker Hub</figcaption></figure><ul><li>We also should see our Rpi-Redis docker image, appears on Docker Hub’s Repository page now.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nJKaDvczdFs0WCwKzb_N8w.jpeg" /><figcaption>Docker hub page for the rpi-redis</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*y_rOHl8LgCJTV7EIDF8qzA.jpeg" /><figcaption>Rpi-redis image version 4.0.1</figcaption></figure><h3>Where do we go next from here</h3><p>Creating Rpi-Redis image is just one step from several steps required for seeing the Docker Swarm sample showing some actions. My next research will be understanding the concept of Service Discovery in a Docker Swarm and its benefits, through using <strong>Consul</strong>. Then, I have a plan to create my own Consul Docker Image targeted for both x86 &amp; ARM (Rpi) platforms and then put this piece into the Swarm to get it working altogether.</p><h3>Reference</h3><ul><li>Hypriot’s rpi-redis — <a href="https://l.facebook.com/l.php?u=https%3A%2F%2Fgithub.com%2Fhypriot%2Frpi-redis&amp;h=ATNbrG7HUWLlTfpLgqiSmbTLmWSPs6_EdaDmmT4b0OEf7s9rKq7vCQZVwux3ApLtJs6Wc2H9pHFXqAv7DxA0yx62MuXTSifbgwGoYyjXRNIO0yDgkAG6YdZGiYCxbuEu_yE&amp;s=1">https://github.com/hypriot/rpi-redi...</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8d18e731289" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>