<?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 Akhyar A. on Medium]]></title>
        <description><![CDATA[Stories by Akhyar A. on Medium]]></description>
        <link>https://medium.com/@akhy?source=rss-403af8c60168------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TbpHzK2fC7Mwx6aBYZ9s5A.jpeg</url>
            <title>Stories by Akhyar A. on Medium</title>
            <link>https://medium.com/@akhy?source=rss-403af8c60168------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 16:17:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akhy/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[What I learned from my first line of code, 15 years ago]]></title>
            <link>https://medium.com/chickenzord/writing-my-first-line-of-code-773a306b34e8?source=rss-403af8c60168------2</link>
            <guid isPermaLink="false">https://medium.com/p/773a306b34e8</guid>
            <category><![CDATA[90s]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[childhood]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Akhyar A.]]></dc:creator>
            <pubDate>Mon, 28 Nov 2016 14:34:46 GMT</pubDate>
            <atom:updated>2016-12-10T09:10:45.271Z</atom:updated>
            <content:encoded><![CDATA[<p>it was so BASIC, and I was just a 5th-grader at that time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*6L2nW6WZUPU30a-fQnDUMA.jpeg" /><figcaption>they were awesome</figcaption></figure><p>Indonesian 90’s child here. I spent my entire childhood with my parents and sisters <a href="https://en.wikipedia.org/wiki/Banjarmasin">in a small town Banjarmasin in South Borneo</a>, quite far away from the capital city of Jakarta (i.e. Relatively under-developed compared to other provinces in <a href="https://en.wikipedia.org/wiki/Java">Java</a>)</p><p>The most influential person that makes me a programmer is my own dad. He is just a high-school graduated civil servant officer who never formally learn to program. He bought his first computer when I was toddler. I don’t really remember what type it was, all that I know was that it could be used for him to do his overtime job in WordStar and Lotus 123.</p><p>My adventure in programming starts when I found my dad’s old programming books while cleaning a dusty bookshelf. They were all written for BASIC language (GOTO and GOSUB anyone?). I read them all out of curiosity, then the epiphany strikes. It was very exciting to know how to tell computer to do what I want. I love this technology!</p><p>Despite being very excited to understand clearly how to do it, I was never actually write a real program. I could only mentally run it in my mind. It’s exciting and frustrating at the same time! The problem was that my computer was using Windows 98 which doesn’t have Quick BASIC interpreter as mentioned in the books I read. I didn’t know how to get or install it either. Doh.</p><p>Knowing my interest in programming, my dad decided to bring me to his office after school. Whoa, it has an unused old computer that has BASIC interpreter installed as part of MS DOS! Hurray!</p><p>I quickly became addicted to code regularly using my dad’s office’s computer. One of the best thing I have ever code that time was a program that makes my keyboard act like a piano. The musical note pitches for each keys were adjusted based on what I learned in music class in school. It was very fun until I realize that the program used CPU beep to make sounds. The beeps were so loud and couldn’t be turned down that it annoyed all my dad’s coworkers!</p><p>Looking back at those times, I can say BASIC <strong>was</strong> a perfect programming language to start with. The syntax is simple and intuitive. As a child, I could easily follow the code flow because all lines are explicitly numbered (yes, you type the line numbers literally) and you can GOTO anywhere by those numbers. <strong>I must admit it, flowchart’s branching taught in CS101 makes more sense if you apply it with “GOTO” than plain “IF” block statements.</strong></p><p>But as I grow and learn many other programming languages, <a href="https://en.wikipedia.org/wiki/Spaghetti_code">I realized that the convenience of GOTO actually leads to what we know as “spaghetti code”</a>. It actually hard to follow the program execution flow and might introduces many unexpected results. Now I know the answer to my (once) frustration of its absence in modern languages.</p><p><em>Next, my adventure with Visual Basic, ActionScript, and Pascal.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=773a306b34e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/chickenzord/writing-my-first-line-of-code-773a306b34e8">What I learned from my first line of code, 15 years ago</a> was originally published in <a href="https://medium.com/chickenzord">chickenzord</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wrapping rancher-compose]]></title>
            <link>https://medium.com/prismapp/wrapping-rancher-compose-ab81803bd117?source=rss-403af8c60168------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab81803bd117</guid>
            <category><![CDATA[command-line]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[rancher]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Akhyar A.]]></dc:creator>
            <pubDate>Wed, 16 Nov 2016 03:41:14 GMT</pubDate>
            <atom:updated>2016-11-16T03:41:14.827Z</atom:updated>
            <content:encoded><![CDATA[<p>something like Gradle wrapper</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*oGfj0v0DEFWAPDq50oBevA.jpeg" /><figcaption><a href="https://www.flickr.com/photos/72153088@N08/6510934443">https://www.flickr.com/photos/72153088@N08/6510934443</a></figcaption></figure><p>While experimenting with <a href="http://rancher.com/rancher/">Rancher</a> as an automation engineer, my top plan on mind was to use it as automated as possible. Thus, manageability via CLI is a must.</p><p>Rancher has a configuration file named rancher-compose.yml that serves as additional configuration layer beside docker-compose.yml. It nicely adds infrastructure information like automated service scaling and load balancing. To make use of those features, we need a command line utility named rancher-compose, it manages our services via “Rancher Master” using rancer-compose.yml + docker-compose.yml.</p><p>Early in the experimentation with Rancher, <a href="https://github.com/rancher/rancher/issues/6047">I ran into an issue that prevents myself from playing even further</a>. That’s rancher-compose cannot communicate with Rancher master. I installed it via Homebrew on OSX. Then, it turns out that the version of my rancher-compose is not compatible with the Rancher Master!</p><p>As it is a compatibility issue, someone in GitHub recommended to download rancher-compose directly from link provided in the Rancher Master web UI (guaranteed to be compatible). That’s a good source of truth, but still feels a little wrong for me. Several questions popped out in my mind.</p><ul><li>Where should we put the downloaded binary?<br>I do not want to put it in any arbitrary working directory, it can be easily committed to Git repository by accident.</li><li>What if we have to manage several Rancher Masters with different versions?</li><li>Portability. How to make sure both our local machines (mostly OSX) and automation tools (currently Jenkins) can easily install the correct version?</li></ul><p>There was gradlew for Gradle in my old day as Android Engineer. I only know the general idea, it is a wrapper script that downloads and caches Gradle distribution version as specified by the project. With just a little knowledge and (many) assumptions about how gradlew does its jobs, I came with my own wrapper script for rancher-compose.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c64e438f913c7fafcea922223bac671/href">https://medium.com/media/7c64e438f913c7fafcea922223bac671/href</a></iframe><p>As it is just a plain text script, I do not mind committing it in a project repository, just like how gradlew is included in most Android project repositories.</p><p>It is far from perfect, but enough for our needs. At least, it supports version caching, and works on OSX and Linux.</p><p>Comments and suggestions are welcome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab81803bd117" width="1" height="1" alt=""><hr><p><a href="https://medium.com/prismapp/wrapping-rancher-compose-ab81803bd117">Wrapping rancher-compose</a> was originally published in <a href="https://medium.com/prismapp">prismapp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimasi cache pada Dockerfile]]></title>
            <link>https://medium.com/@akhy/optimasi-cache-pada-dockerfile-a6c559c36c06?source=rss-403af8c60168------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6c559c36c06</guid>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[bahasa-indonesia]]></category>
            <dc:creator><![CDATA[Akhyar A.]]></dc:creator>
            <pubDate>Mon, 29 Aug 2016 04:05:51 GMT</pubDate>
            <atom:updated>2016-08-29T04:05:51.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NH_Sd3Kd9lRrdEA80nQvjA.jpeg" /><figcaption>All the cool kids use Docker!</figcaption></figure><p>Siapa yang tidak kenal Docker. Tools yang sedang populer di dunia persilatan ini telah membantu kita semua mengatasi masalah “it works on my machine!”.</p><p>Lah, kalau “it works” kok dibilang masalah? Ya itu jadi masalah kalau di mesin lokalnya engineer jalan, tapi begitu di-deploy ke server ternyata beda dan bikin runyam. Betul? Padahal hal tersebut seringkali disebabkan hal sesepele lupa install dependency baru, PHP-nya beda versi, dll. Dengan Docker, masalah distribusi software tersebut teratasi secara elegan. <em>You define how to package the software, its dependencies, how to run, and that’s it. It runs anywhere!</em></p><p>Di sini saya menggarisbawahi bagian “how to package the software”. Dalam dunia per-Docker-an, ada file yang namanya “Dockerfile”. File ini mendeskripsikan langkah-langkah mengemas kode kita ke menjadi Docker image.</p><p>Satu contoh sederhana:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18939bef60a1df2966356f567a170957/href">https://medium.com/media/18939bef60a1df2966356f567a170957/href</a></iframe><p>Cukup intuitif kan? Gunakan Python versi 2.7.12 sebagai base image, kemudian install dependency dari “requirements.txt”, salin codebase ke direktori “app”, lalu gunakan “python app.py” sebagai command untuk menjalankan container. Selesai. Simpel.</p><p>Iya, semuanya terlihat baik-baik saja sampai saatnya build image. Khususnya di <em>local environment</em> yang membuat kita secara sadar tak sadar melakukan build yang sama berulang-ulang untuk memastikan <em>everything works well</em>.</p><p>Coba jalankan “docker build -t anu .” berulang-ulang tanpa mengubah apapun. Dalam kondisi normal, build yang sebenarnya hanya dilakukan sekali yang pada build pertama. Build kedua dan seterusnya akan berjalan sangat cepat berkat layer caching, selama cache masih valid (dengan kata lain tidak ada perubahan kode).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/699c05316accaa2a44c9102b586646a9/href">https://medium.com/media/699c05316accaa2a44c9102b586646a9/href</a></iframe><p>Sekarang coba ubah satu baris saja di file “app.py”. Perubahan apapun, tambah satu baris komentar juga boleh. Lalu lakukan build ulang. <em>What’ll happens</em>?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6973522b3c4bbcd91d9d4e55f0e2909b/href">https://medium.com/media/6973522b3c4bbcd91d9d4e55f0e2909b/href</a></iframe><p>Seperti bisa dilihat, perubahan sesepele menambah komentar pada <em>codebase</em> menyebabkan seluruh proses build image harus diulang dari awal. Proses unduh dependency yang makan waktu pun harus ikut diulang. Jelas ini bukan kondisi yang ideal. Eh, tapi kenapa ini bisa terjadi? <em>What’s wrong</em>?</p><blockquote>Setiap step pada Dockerfile akan membuat satu layer pada Docker image. Layer tersebut akan disimpan sebagai cache sehingga step yang sama dengan data yang sama tidak perlu dieksekusi ulang. Ketika ada satu layer yang cache-nya tidak valid lagi, seluruh layer di bawahnya akan turut menjadi invalid.</blockquote><p>Nah! Cache pada step “COPY . /app” menjadi invalid ketika pada direktori sumber tersebut terjadi perubahan konten (dalam hal ini, file app.py). Karena itu, seluruh cache pada step di bawahnya, terutama “pip install -r requirements.txt” pun turut invalid dan menjadi harus dieksekusi ulang.</p><blockquote>Then, how can we overcome this?</blockquote><p>Kuncinya adalah memisahkan instalasi dependency dari proses menyalin codebase pada Dockerfile.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c43b8fbc9f600ed8c9de1a23d7dc431c/href">https://medium.com/media/c43b8fbc9f600ed8c9de1a23d7dc431c/href</a></iframe><p>Nah, dengan cara ini perubahan pada codebase tidak akan mengganggu cache proses yang memakan waktu. Instalasi dependensi hanya akan dieksekusi ulang ketika terjadi perubahan pada file “requirements.txt”.</p><blockquote>Rule of thumb</blockquote><blockquote>Posisikan step yang kemungkinan cache invalidate-nya relatif lebih kecil di bagian atas Dockerfile. Dan sebaliknya, step yang datanya sering berubah (e.g. codebase) letakkan di bagian bawah.</blockquote><p>Secara garis besar, urutan ideal dalam Dockerfile adalah sebagai berikut:</p><ol><li>Install system dependencies (apt-get install, apk add, etc)</li><li>Install app dependencies (pip, composer, gem, npm, etc)</li><li>Copy code base</li></ol><p>Ngomong-ngomong, <em>why should I care about this</em>? Toh build image sudah dilakukan oleh mesin CI (Continuous Integration) kan? Lagipula, kalau mengandalkan cache, berarti build tidak bermula dari <em>clean state</em> kan? Nanti buildnya tidak konsisten dong?</p><p>Jadi begini…</p><ol><li>Cache yang benar dan efektif dapat mempercepat proses build secara signifikan. Ada <em>trade-off</em> di sini.</li><li>Docker cache lumayan menghemat space harddisk ketika menyimpan banyak docker image yang memiliki kesamaan layer.</li><li>Build step yang melalui TCP/IP (dalam hal ini, install dependency) sangat bergantung dengan kondisi jaringan.</li><li>Kalau takut dengan build yang tidak konsisten, <em>there’s probably something wrong with your dependency management</em>. Jangan gunakan <em>wildcard version</em>. Mari kita percayakan pada package maintainer dan package manager bahwa setiap versi yang sama pasti menghasilkan output yang sama.</li></ol><p><em>By the way</em>, masalah <em>clean state</em> dan <em>build consistency</em> ini mungkin bisa jadi bahan tulisan saya selanjutnya. Doakan saja bisa terlaksana 🙈</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6c559c36c06" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>