<?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[Altitude - Medium]]></title>
        <description><![CDATA[Welcome to our Engineering Blog, our team will detail various components of the solution architecture of Altitude. Altitude is the all in one smart accommodation platform built to simplify the process — we’re providing you the building blocks to succeed. www.altitudehq.com - Medium]]></description>
        <link>https://medium.com/altitudehq?source=rss----d04c820dd957---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Altitude - Medium</title>
            <link>https://medium.com/altitudehq?source=rss----d04c820dd957---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:25:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/altitudehq" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Let LLMs Visualize Data For You!]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/altitudehq/let-llms-visualize-data-for-you-a8a494abbbbf?source=rss----d04c820dd957---4"><img src="https://cdn-images-1.medium.com/max/673/1*OuiMNwVgcwQcEpcGVV7ENA.png" width="673"></a></p><p class="medium-feed-snippet">Visualizing data is the nearly final step in a data pipeline, and it could be the most important step because from this we can see the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/altitudehq/let-llms-visualize-data-for-you-a8a494abbbbf?source=rss----d04c820dd957---4">Continue reading on Altitude »</a></p></div>]]></description>
            <link>https://medium.com/altitudehq/let-llms-visualize-data-for-you-a8a494abbbbf?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/a8a494abbbbf</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Thắng Đỗ]]></dc:creator>
            <pubDate>Wed, 14 Jan 2026 09:14:46 GMT</pubDate>
            <atom:updated>2026-01-14T09:14:46.046Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What’s inside OpenAI Codex?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/altitudehq/whats-inside-openai-codex-63a43ea94a48?source=rss----d04c820dd957---4"><img src="https://cdn-images-1.medium.com/max/2600/1*outIkRpwTCFj5np4vMVPmg.gif" width="3002"></a></p><p class="medium-feed-snippet">We have just entered the decade of agents, especially coding agents. I think most developers have used coding agents like Copilot, Cursor&#x2026;&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/altitudehq/whats-inside-openai-codex-63a43ea94a48?source=rss----d04c820dd957---4">Continue reading on Altitude »</a></p></div>]]></description>
            <link>https://medium.com/altitudehq/whats-inside-openai-codex-63a43ea94a48?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/63a43ea94a48</guid>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[codice]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[Thắng Đỗ]]></dc:creator>
            <pubDate>Tue, 24 Jun 2025 18:05:39 GMT</pubDate>
            <atom:updated>2025-07-01T08:37:13.885Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Has LLM killed traditional NLP?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/altitudehq/is-traditional-nlp-dead-05544ae7d756?source=rss----d04c820dd957---4"><img src="https://cdn-images-1.medium.com/max/1792/1*5RLfLXMRpJ77ibv0_rzCTA.png" width="1792"></a></p><p class="medium-feed-snippet">Natural Language Processing (NLP) has had a relatively long development period. It is often broken down into smaller problems: text&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/altitudehq/is-traditional-nlp-dead-05544ae7d756?source=rss----d04c820dd957---4">Continue reading on Altitude »</a></p></div>]]></description>
            <link>https://medium.com/altitudehq/is-traditional-nlp-dead-05544ae7d756?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/05544ae7d756</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[bert]]></category>
            <category><![CDATA[mllm]]></category>
            <dc:creator><![CDATA[Thắng Đỗ]]></dc:creator>
            <pubDate>Mon, 13 Jan 2025 07:11:26 GMT</pubDate>
            <atom:updated>2025-01-14T09:13:27.454Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Hacking on the cloud: An effective and cost optimization approach]]></title>
            <link>https://medium.com/altitudehq/hacking-on-the-cloud-an-effective-and-cost-optimization-approach-8e5a943d1e6c?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/8e5a943d1e6c</guid>
            <category><![CDATA[solution-architect]]></category>
            <category><![CDATA[cloud-system]]></category>
            <category><![CDATA[altitude]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Tran Quoc Viet]]></dc:creator>
            <pubDate>Mon, 07 Feb 2022 04:06:39 GMT</pubDate>
            <atom:updated>2022-02-07T04:06:39.871Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xQfBMjSANDZcB_jEgrRqsQ.jpeg" /></figure><p>A few words before we start: this article isn’t about Hacking so you don’t have to worry about not having security-relate skills to continue reading. This article only take Recon and Scanning phases of Hacking, which usually very time consuming, as a model for the main subject: <em>Design an effectively Cloud Solution while keeping the cost optimized.</em></p><p>Also Hacking without permission is illegal. The only purpose of hacking is to secure networks, and think like a hacker to be able to secure networks.</p><p>In case you didn’t know, Altitude is a fully cloud integrated platform to simplify the process of building a smarter accommodation, and as we deal with both our partners and customers data, security is one of our fore most concerns. Here at Altitude we always remind ourselves this:</p><blockquote>A breached system is a dead system</blockquote><p>to keep remind ourselves of how much important our customer data is, as they put their trust into us, we must response in kind.</p><h3>Who am i?</h3><p>My name is Tran Quoc Viet, currently working as Technical Advisor at Altitude. Since Altitude most concern is the safety of its customer data, we have built a security team from the early day and i had the honor of being one of the team first members.</p><p>During the time with the team, i have developed a strong interest in Security, and since then have been working as ethical security hacker for Altitude and her partners during my spare time. My task is to look for vulnerabilities in our networks, and <strong>report it</strong>.</p><p>With all the security skillsets and tools built over the years , and as Altitude cloud solution architect, one day i decided to move all those tools into the cloud as my machine started to take <strong>weeks</strong> to finish its given task. My choice is of course <strong>AWS cloud services </strong>as Altitude also using this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*aAaruYL9YZ8rdMBfgyrIzg.gif" /><figcaption>AWS cloud services</figcaption></figure><h3>Problems with cloud base hacking tools</h3><p>My naive old self back then thought that the solution was simply to get some AWS EC2 instances, move my tools over (dockerized and ready to run anywhere) and call it a day. But reality isn’t that simple, my tools needs a lots of CPU and RAM, either one or both, so after finished my math, a few high tier EC2 instances were required, and even with reserved instances it costed me around 250$/month. And that was just the cost for EC2 instances only, so as poor as i were, i gave up on that solution.</p><blockquote>Cloud solution cost a lots if you don’t pay attention to what you use</blockquote><p>There was something else i noticed: the inconsistent usage. Below are the usage charts of Altitude and my tools:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TwZnyANeF9sOEaUqI1uTOw.png" /><figcaption>My Tools CPU utilization chart</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIhA71O5qt3dzPsi4TwrcA.png" /><figcaption>Altitude CPU utilization chart</figcaption></figure><p>The problem is pretty obvious, Altitude is a huge system used by a lots of users across the world so it must have high availability and the usage always remain high. My tools, on other hand, mostly in idle state, except for when i run it again a target.</p><p>Noticed such different, i gave up on trying to imitate Altitude Cloud Structure, and instead design a completely different approach.</p><p>Before a cloud solution architect can design a solution, they must first understand the <strong>problem </strong>and<strong> </strong>the <strong>goal </strong>of the target system. That is what we will try to do in this section.</p><h3>The 5 steps of ethical hacking</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jfFcuGBHLxOnBE07zQjTQ.jpeg" /><figcaption>5 steps of ethical hacking (credit: itperfection.com)</figcaption></figure><p>These are a lots of models for ethical hacking but the 5 steps model is probably one of the most popular. Since hacking isn’t our article main subject, let quickly go over all five.</p><p><strong>Reconnaissance</strong></p><p>In this phase hackers will try to gather information about the target, as many as they can. This is the most important phase out of all five.</p><blockquote>If you know the enemy and know yourself, you need not fear the result of a hundred battles.<br>-<strong>Sun Tzu-</strong></blockquote><p>The more information hacker can gather, the better change of success they have. There is no “too much information” for this phase, they will try to gather everything, no matter how trivial. I can list a few examples:</p><ul><li>IP ranges, information relate to IP such as whois</li><li>Domains, subdomains, domain owner information</li><li>Domain records such as A, TXT, CNAME, DKIM,…</li><li>Email, phone number, name, address, key words, …</li><li>TCP and UDP services</li><li>and a lots more</li></ul><p><strong>Scanning</strong></p><p>With the information gather during Reconnaissance phase, the hacker will scan the network for specific information. For example with the collected IPs, they can scan for open ports, vulnerabilities,… associate with said IPs.</p><p>From my experience, most of the scanning phase is all about running the scanning tools with the input from Reconnaissance phase. Of course to have good result, you must know to run which tools on which data. A good hacker also have their own or personal-tuned tools, which set them apart from the rest.</p><p>One important thing to note: Scanning phase usually take VERY LONG TIME, even after narrowing down the target surface.</p><blockquote>Scanning might take DAYS to finish</blockquote><p><strong>Gaining Access</strong></p><p>This phase is when the attack actually start. With all the information from Recon and Scanning phase, hacker will be able to draft an attack plan and excuse it.</p><p><strong>Maintaining Access</strong></p><p>Once successfully gained the access into network, hacker will want to keep that access for future exploitation and attacks. These can be so many ways, like creating a backdoor, or take over an Administration account inside the network, …</p><p><strong>Clearning Tracks</strong></p><p>Remove anything that might indicate that the network have been breached, or anything might lead back to the hacker. It might be logs, sent emails, files generated, bash history,…</p><h3>The goal: an automation hacking toolbox</h3><p>It was pretty fun at first, then i realize i pretty much repeated doing the same stuffs over and over with each new target, especially during the Recon and Scanning phases. So i decided to automate the process.</p><p>My aim is to build a cloud hacking toolbox which, after accept the target information, and my attacking scenario config as input, can automatically perform the Reconnaissance and Scanning phase using all my tools. The time consuming steps will be automatically ran, while i can go live my life until the notification come.</p><p>And that is the <strong>Goal</strong> we want to archive.</p><h3>The problems</h3><p>The inconsistent usage: i already mentioned this above so i wont go over it again. But the objective is cut the cloud cost when the toolbox is in idle state.</p><p>Long running process: some tools take hours, or even days to finish.</p><p>Highly customization: No hacker run all his tools again any target. He must pick which one to run depend on the target characteristic. For example it make no sense running WPScan again a non Wordpress target. The toolbox must be flexible to fit on any attacking plan. <br>And as a hacker continue with his work, he will employ more tools, so the process of adding new tool should also be easy.</p><h3>Design a solution</h3><p>Now with the Goal and Problem identified, time to get our hand dirty. The first task is to design the automation flow for the Recon and Scanning phases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kow_6whXd_QRmLCwtjICSA.png" /><figcaption>Automation recon + scanning flow</figcaption></figure><p>As two of our main problems are long running process and customization, a queue-base architecture is highly favor. Event-driven architect is also a very good option, but <strong>AWS Kafka</strong> price is too expensive for our project.</p><p>First let go over all the actors we see in the image first:</p><ul><li><strong>Command center</strong>: accept/log command from user, and generate the <strong>action stages</strong> for that command.</li><li><strong>Action stages</strong>: each stage represent a hacking action. For example, the recon phase consist of the following stages: scan for subdomains, probe sub domains,…. Each stage have its corresponding tool.</li><li><strong>Action queue</strong>: You can think of it as a message box, where you put in a message, and later someone will take out the message, read it and do what it said. ActiveMQ, RabbitMQ,… are a few popular examples.</li><li><strong>Artifact</strong>: a ZIP/RAR file contains all the files, documents, reports generated by a tool. Since some tools generate A LOTS of files, it is better to have a center storage for them, and i call it <strong>Artifact Storage.</strong></li><li><strong>Recon and Scan services</strong>: the recon and scan phases are actually consisted of many services, but to keep thing simple let assume they are just a single service.</li></ul><p>With the actors in place, our automation flow will be as follows:</p><ul><li>The hacker will trigger the flow by sending a command to <strong>command center</strong>.</li><li>The <strong>command center</strong> will generate the <strong>action stages</strong> , and then send the first one to <strong>action queue</strong>.</li><li>After a message are put into the queue, the recon and scan service will pick up the message, parse the message to get the stage information and use corresponding tools to process the stage action. After the tools finished its job, an <strong>artifact</strong> will be generated and upload to <strong>Artifact Storage</strong>.</li><li>Once the tool finish its task, the stage is consider done, and the service will inform the <strong>command center</strong>. The next <strong>action stage</strong> will be generated and put to queue, and be processed by recon and scan service. This will continue until the <strong>command center</strong> decided that there is no more <strong>action stage </strong>left.</li><li>Once all the action stages are finished, user will be notified via email/sms. Since the recon and scan usually take lots of time, a notification is required (you don’t want to check the status every few hours, do you?)</li></ul><p>This queue-base architecture help us resolves two of our problems:</p><ul><li>Long running process: by using queue-base solution, no service have to wait for a response from another. For example command center don’t have to open a processing thread to call <em>Nmap</em> service, then keep that thread open for 2 hours (or more) until <em>Nmap</em> finish its task. Instead command center simply drop a message into the queue, and call it a day until Nmap contact it later with the scan result. No more waste resource!</li><li>Highly customization: each action stage accept a Queue message as <em>input</em>, and product an Artifact as <em>output</em> , so there is almost no dependency between stages (except if the artifact will be used by another stage, but this is just a matter of order). This way you can easily add new action stage in the future without worrying it might break the flow.</li></ul><h3>Final problem: The inconsistent in usage</h3><p>If you ask 100 system architects how to deal with the inconsistent in usage, all of them will give you the same answer: <strong>scalability</strong> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKsF6B1lskVY_kyiRnDhUQ.png" /><figcaption>Sample of scalability</figcaption></figure><p>In short, it is the measure of a system’s ability to increase or decrease in performance and cost in response to changes in application and system processing.</p><p>Take Altitude as an example, during normal period, we have ten instances to host all our services. But during holiday period, the number of requests spikes, either 2 or 3 times more than normal. Thank to Altitude scalability ability, our system will automatically increase the number of instances to match the high demand without us have to do anything.</p><p>As for our toolbox, the different between low demand and high demand period are even more distinctive. Because when you don’t perform any hacking task, the system does almost nothing.</p><p>So how can we archive Scalability for our solution?</p><h4>Two categories of services</h4><p>The hard part of the Scalability is to select which target for the scaling. Thanks to the queue-base architecture we employed, it wont be too hard.</p><p>Our hacking toolbox consisted of many services, but in general, you can divide them into 2 categories:</p><ul><li>High processing services: tools which consume a lots of CPU and RAM, and took very long time to finish. For example: Nmap service which scan for working ports. Except for when these are tasks for them in Action Queue, they do absolutely nothing.</li><li>API-relate services: Command center, artifact storage and notification service belong to this category. They don’t require much resource, but should always in ready state, waiting for request from user or other services. These services should have short response time.</li></ul><p><strong>Our scalability strategy</strong></p><p>With our services perfectly divided like that, it is quite easy to decide a scalability strategy.</p><p>High processing services will be put into scalable instances, which will be boot up whenever there is a new task in the Job Queue, and terminate when there is no more task. Amazon have a perfect solution for this: <strong>AWS Auto Scaling</strong> service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*-jzH23UOLC5Mzt2q_WL78g.png" /><figcaption>Aws Auto Scaling</figcaption></figure><p>For API relate services, there are 2 options:</p><ul><li>Option 1: put them into EC2 instances which always in ready state. This approach allow the api to response quickly without delay, since there is no boot-up time required. But you will have to pay monthly fee for these instance. If the api are called frequently, this is the prefer option. But in our case it isn’t.</li><li>Option 2: Convert the API services into <strong>serverless</strong> services with <strong>AWS Serverless</strong>. The advantage of serverless services is that you only have to pay for what you use, in short, the cost depend on the number of requests you make that month. In our case the number of requests are quite low, so this is the approach that we will select. <strong>A side note</strong>: serverless services have a boot-up delay(change from terminated state to ready state) so it is a bit slower than the first approach, but in our case it isnt a problem.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tSpka7p_co37fgcEBnnxow.png" /><figcaption>AWS Serverless Computing (Credit: Xenonstack)</figcaption></figure><p>And that is it folks, we have our solution to build the hacking toolbox. All that left is to design the Infrastructure , and that is what we will do next.</p><p>With the solution figured out, design the infrastructure is quite straight forward:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSnHasTRl98bErnzqY-Rng.png" /><figcaption>The toolbox infrastructure</figcaption></figure><ul><li>A <strong>VPC</strong> with one private <strong>subnet</strong>, one public <strong>subnet</strong> span across 2 <strong>Availability Zones</strong>. With this design, even if by some reasons, a zone is inaccessible, our services can still be deployed in another one.</li><li>An <strong>internet gateway</strong> attaches to the VPC so our services can access the internet.</li><li>An <strong>Amazon MQ</strong> deployed in public subnet to act as our Action Queue. NOTE: the Amazon MQ brokers belong to same <strong>security group</strong>, which only allow access from our lambdas and private services.</li><li>A <strong>Cloudwatch Event</strong> which monitor the Amazon MQ status, will inform our <strong>AWS</strong> <strong>Auto Scaling</strong> whenever new message arrived.</li><li><strong>AWS Auto Scaling</strong> will do the following:<br>- If a topic dont have any new message for a period of time (let say 2 hours), terminate the <strong>auto scaling group</strong> associate with that topic. For example, if the topic for Scanning Service dont have any message for 2 hours, turn off all the Scanning tool services.<br>- If a new message arrived at a topic, boot up the services inside the <strong>auto scaling group</strong> associate with that topic.</li><li><strong>The lambda functions</strong>, each corresponding with one of our API endpoints.</li><li>The <strong>API gateway</strong>: Since we cannot access the lambda functions directly, all the https call must go through the API gateway. For example the following request<br>GET <a href="https://gatewaydomain.com/command/getCommandStatus">https://gatewaydomain.com/command/getCommandStatus</a><br>will be sent to API gateway, then the gateway will route the request to the <em>CommandCenter.getCommandStatus</em> lambda function.</li></ul><p>With this infrastructure, whenever your toolbox isn’t in use (idle for more than 2 hours), all the high processing (and expensive) tools are turned off. Also all the lambda functions are only charged when you call them, so you are pretty much don’t have to pay any money during the idle period (not counting the storage fee).</p><h3>Conclusion</h3><p>This infrastructure is exactly what i am using right now, and it help me save a lots of money and time while get the job done.</p><p>I hope this article show you the important of designing a suitable solution base on the system and its usage. Please look forward for our next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e5a943d1e6c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altitudehq/hacking-on-the-cloud-an-effective-and-cost-optimization-approach-8e5a943d1e6c">Hacking on the cloud: An effective and cost optimization approach</a> was originally published in <a href="https://medium.com/altitudehq">Altitude</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enabling an effective CI/CD pipeline for micro-services]]></title>
            <link>https://medium.com/altitudehq/enabling-an-effective-ci-cd-pipeline-for-micro-services-fe3ae76edcc0?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/fe3ae76edcc0</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Tran Quoc Viet]]></dc:creator>
            <pubDate>Wed, 02 Feb 2022 06:59:33 GMT</pubDate>
            <atom:updated>2022-02-02T07:06:17.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*lLko1uApoWelFy7ZUA-Tpg.jpeg" /><figcaption>CI/CD flow</figcaption></figure><p>Altitude is a platform to simplify the process of building smarter accommodation, as our slogan is “Making things simple”. Well, to be honest, I always think it should be “Making things simple for our customers” because the technology behind our system is anything but simple. Altitude offers a wide range of smart app and cloud-based platforms, from plug and play to an all-encompassing guest platform. So yeah, the slogan probably should include our development platform.</p><p>Joking aside, the system which fuels Altitude is constructed by applying the micro-service architecture, and at present, the total number of services are in the hundreds, with the counter showing no sign of stopping anytime soon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gRg1F-kfo8nC2zsVAhROdw.png" /><figcaption>A snapshot of an early micro-services map, each connection is service-to-service communication, or later links via a-sync messaging such as Kakfa or a MQ. Each node is clickable opening up service details, versions, releases and more.</figcaption></figure><p>As you might already know, a system such as Altitude should have multiple development stages (production, development, user testing, demo, etc) and we are no exception. We actually have more development stages as we need to make absolutely sure our customers will never have to experience any technical issues or downtime that could impact their business. But this leads to one issue: Money.</p><p>Cloud-based system are amazing, I wholeheartedly agree, but not so much when you get the bill at the end of each month. Of course we spare no expense when it come to any environment which affect our customers such as PROD, PRE-PROD,… But what about development? The development environment are only used by our developers so we don’t really need the High Availability with 100% uptime, that our PROD environment has. The most important thing is the CI/CD model which provide the seamless deployment process. Is there any way we can keep it as cheap as possible while still able to archive the CI/CD standard?</p><p>The answer is yes we did, and how we archive that is what this article is about. In this article i will show you how to automate the deployment process of services in a development environment while keeping the cost as low as possible.</p><h3>The goals</h3><p>To make it easier to follow, let us go over the results which we wish to achieve for our development environment:</p><ul><li>Automatic deployments for each commit — developers across our environments work closely so each deploy needs to be considered across apps and web</li><li>Alerts to team — let them know something has happened, a new deploy and what changes has happened</li><li>Simple to setup — single configuration and metadata files</li><li>Automatic testing triggers — trigger tests from unit test, postman and more to ensure we’re still operational</li><li>Security and dependency reviews — ensure we’re not releasing anything with any known vulnerabilities</li><li>Data driven analytics — metadata files which contain dependent services, environment variables, and enable our custom service map and service management service</li><li>Save the cloud cost at much as possible.</li></ul><p>Lets dive in.</p><h3>Hundred of micro-services, one poor operator</h3><p>Sound pretty bad, right? But only if you try to manually do everything. Even if we want to save some money, this is never an option as in the long run it actually create much more problems than just money.</p><p>But for this part, to make a point of how much work required to deploy a single micro service , let us assume that our Operator for some reason want to manually deploy a service in our Development Stage.</p><p><em>So Anthony</em> — Altitude’s most promising Developer — has finished his new service called “<em>SMS Sending</em>” service. Of course as good a developer as he is, the service is <strong><em>stateless</em></strong>, <strong><em>Docker-ready</em></strong>, and accompanied by <strong>unit</strong> <strong>test scripts</strong>. Now with such service ready to be deployed, and the Operator want to manually deploy this service to Development environment, here is what he will do:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*Zj0WajJrG5DmMokMdbF7Xw.png" /><figcaption>AltitudeHQ Deployment Process Diagram</figcaption></figure><p>First, pull the source code of “<em>SMS Sending</em>” to his work machine</p><p>Second, make sure the service is working as intended:</p><ul><li>Deploy the service inside Docker.</li><li>Run the unit tests. All tests must pass.</li></ul><p>Third, check source code quality:</p><ul><li>We make use of <strong><em>SonarQube</em></strong> to rate our source code, and unless the result reach a certain threshold, it is time for <em>Anthony</em> to check his code again.</li><li>Check any dependencies for known vulnerabilities.</li></ul><p>After passing all the steps above, it is time to deploy “<em>SMS Sending</em>” service:</p><ul><li>Build a Docker Image for the service, let call it “<em>SMS-Sending-Service” </em>then push it to a Docker Registry.</li><li>Access the server, pull “<em>SMS-Sending-Service”</em> image and start a container using that image and name it “<em>SMS-Sending-Service-Container”.</em></li><li>Config the reverse proxy or load balancer to work with “<em>SMS-Sending-Service-Container”. </em>In Development environment, we use the ever popular <strong>Nginx</strong>.</li></ul><p>As the service is deployed and ready to be used, there are a few more tasks he need to do in our CI/CD flow:</p><ul><li>Inform the developers via Slack that their service is ready</li><li>Note down the technical detail of the service into our custom services management service.</li></ul><p>And our Operator has successfully deployed the service to the Development environment, what a joyful moment, except there are 99 or more services to go. Time to automate this process.</p><h3>Altitude’s CI/CD solution for our Development Environment</h3><p>Why do I keep emphasizing “<em>Development Environment</em>”? Because as I already mentioned above, we have multiple stages, and the <em>Development</em> stage are the only stage different from the rest.</p><p>While the <em>Production</em> environments are much more polished, make use of the AWS Cloud latest technologies, with top quality architecture, security, high availability (100% uptime) and responsiveness. The <em>Development</em> environment, on other hand, is only used by our development team, so we keep the infrastructure as simple as possible for easy debugging, and to save money.</p><p>But just because we want to save money doesn’t mean we exchange the automation for some money back, far from it. What we did is to save money by using free solutions instead of <strong>AWS Cloud Services</strong> as you might already know, those services, as good as they are, but cost a lot. The <em>Development</em> environment still have everything an automation development process should have, and it take care of everything after developer commit his/her code.</p><p>So what solution/s did we pick? Well there are a lots of options, but the one which can cover most of our needs, and best of all, open source and completely free is Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*ANbJ0MtkactHNin9BzSxrA.jpeg" /><figcaption>The best butler</figcaption></figure><p>Before I go into details of how Jenkins can help us archive our goal, lets go over a few terms we will encounter in our next sections:</p><ul><li><strong>Bitbucket</strong>: Git-based source code repository hosting service. This is where we store our source code.</li><li><strong>AWS</strong>: Our system are running on AWS Cloud.</li><li><strong>AWS ECR</strong>: aka Amazon Elastic Container Registry. This is where we store our docker images.</li><li><strong>Jenkins</strong>: free and open source automation server. We will deploy Jenkins as our automation control center.</li><li><strong>Jenkinsfile</strong>: Jenkins task script written in Groovy.</li><li><strong>AWS EC2</strong> : Amazon Elastic Compute Cloud. In development environment, our micro services are deployed in Ubuntu-based EC2 instance.</li><li><strong>NGINX</strong>: Web server that can also be used as a reverse proxy, load balancer. We use Nginx instead of AWS Load balancer in development because it is free.</li><li><strong>Ansible Playbook: a blueprint of automation tasks</strong> — which are complex IT actions executed with limited or no human involvement. Most of our manually task will be converted to <strong>Ansible</strong> script and triggered by <strong>Jenkins</strong></li><li><strong>Services management service</strong>: Altitude’s number of services continue to grow, and with more than a hundred services, we need an effective way to manage the information of each service, its technology, documents, tests API schemas and the relation between services. At first we tried to use Google Docs, as well as some map drawing tools, but to no avail. So we decided to make our own solution, and this service is the result of that. <strong>Services management service</strong> is integrated into our CI/CD flow and will automatically pull the service information, relations using the metadata included in each service, then display the data in human-friendly UI, as well as provides lots of relation maps,…</li></ul><h3>Continuous Integration with Jenkins</h3><p>Simply put, Jenkins allows us to automate all the manual tasks (as mentioned above) except for the part where the developer pushes their commit to repository.</p><p>With Jenkins acting as our main automation center, our CI/CD model will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lXHdT6wgMc1MPvtoc2eisQ.png" /><figcaption>CI/CD Model — High level view</figcaption></figure><p>In reality there can be a lot more steps in our pipeline, but for the sake of keeping the article simple, I simply leaved them out and only keep <strong>Sonarqube</strong> and <strong>Services management</strong> as an example.</p><p>Now let us go over each section</p><h4>Repository: where everything starts</h4><p>This step is the only step which require human interaction in our CI/CD model. Whenever developer commit push to a certain branch, the whole CI/CD flow will start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*lAZAunDTziv1vq2GmDpJ1w.png" /></figure><ul><li>Developer commit a push to build branch of the service repository. Let call it <strong>dev-deploy.</strong></li><li>Bitbucket send a request to the webhook which is set in the service repository configuration.</li><li><strong>Jenkins pipeline job</strong> catch the <strong>webhook</strong> request, check if it match the branch inside the job configuration and if it is, pull the source code into <strong>Jenkins</strong> local storage, then trigger the <strong>Jenkinsfile </strong>to perform all the remain steps.</li></ul><h4>Inspection: (bad) code shall not pass</h4><p>The inspection step verifies two things:</p><ul><li>The source code quality: check for memory leak, bad coding convention, etc…</li><li>The dependent libraries: check for high and critical security vulnerabilities in all dependencies</li></ul><p>If the quality pass a certain threshold the inspection will be considered a success.</p><p>As mentioned above, we will make use of <strong>Sonarqube</strong> for this task. I wont go into detail of how we setup <strong>Sonarqube</strong> as it is out of this article scope but you can simply install it into an EC2 instance using Docker.</p><p>It is to no surprise that Jenkins already has plugins to support Sonarqube given how popular it is. The detail to setup said plugin can be found here: <a href="https://docs.sonarqube.org/latest/analysis/jenkins/"><strong><em>Sonarqube Jenkins Integration</em></strong></a></p><p><em>Fun story: The amount of “</em><a href="https://docs.sonarqube.org/latest/user-guide/concepts/"><em>code smells</em></a><em>” Sonarqube reports will also get a equivalent amount of </em>💩<em>emojis in Slack!</em></p><h4>Build: deploy and test</h4><p>This step will wind-up a version of the service inside a <strong>Docker</strong> container (at Altitude, all services <strong>must</strong> be dockerized) and perform all the unit tests on it. Note that during the testing, <strong>Jenkins</strong> still keep the previous version of that service running, the new version is deployed into a different container.</p><p>Once all the test passed with “<em>success”</em> status, the new version will be release to Development Environment.</p><h4>Release</h4><p>Continue from the previous step, <strong>Jenkins</strong> will point the <strong>Nginx</strong> to the new version, and tear down the previous one.</p><p>As mention in the previous section, each of our service when commit is accompanied with a metadata file, written by our developer in JSON format. This file is included in the source code, and provides extra information about the services such as which technologies the service uses, the list of dependent services, list of 3rd party services it required,… <strong>Jenkins</strong> will pickup this metadata , parse it and call our <strong>Service Management Service</strong> to update the current service record. This help us keep track of all the services in our system and alert the required parties or systems about any major changes.</p><p>After that depend on your configuration, Jenkins will inform the developer that the whole process finished. There is multi ways to do this like email, sms,… but our favorite method is to send a message to <strong>Slack</strong>.</p><p>The chart below shows the full deployment flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*mXA9rvvARCenmsXENLgbSg.png" /><figcaption>Deployment process with Jenkins at its core</figcaption></figure><h3>Verdict</h3><p><strong>Jenkins</strong> make the whole deployment process seamlessly and the Operator will have a much easier time now as each service can now be deployed by the developer in charge of it. He/she only need to work on each service the first time it was deployed (write the <strong>Jenkinsfile</strong> configuration).</p><h3>BONUS: Altitude Infrastructure for development stage</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITzNv9JI2mDQK3iiwlWCbg.png" /></figure><p>In case you wondering, here is an overview of our infrastructure for our development environment:</p><ul><li>A <strong>VPC</strong> : Amazon Virtual Private Cloud</li><li>A single <strong>Availability Zone</strong>: for other stages we recommend having more than 2</li><li>2 <strong>Subnets</strong>: 1 private, 1 public</li><li>An <strong>EC2</strong> which host <strong>Nginx</strong> inside public <strong>subnet</strong>: Instead of using aws load balance which cost money, instead we use a <strong>Nginx</strong> (free) to act as a load balancer. Since AWS micro instance is pretty cheap (even cheaper if you use reserved instance), this save you a bit of money. This instance can be accessed from anywhere if need since it is in public subnet, but we only allow access from our office.</li><li>An <strong>EC2</strong> which host <strong>Jenkins</strong>: In our case we categories <strong>Jenkins</strong> tasks into two groups:<br>- <em>Normal tasks</em>: Task which wont need much processing power, for example a task to push and pull, deploy a service.<br>- <em>Heavy tasks</em>: Task which require a lots of CPU or RAM. For example: build our CMS web UI. <br>Normally you will need a strong instance type to deal with both types, but that isn&#39;t cost effective as heavy tasks are rarely called. So here is our solution:<br>- Use t2.medium to host <strong>Jenkin</strong>, all <em>normal tasks</em> will be performed here<br>- Use <strong>EC2 Spot </strong>instance to handle <em>heavy tasks</em>: which allow us to quickly boot up a instance to handle heavy task, then turn off when task finished.</li><li>Multiple <strong>EC2</strong> to host our services: The number and size of each instance depend on how many services you have and how much ram they use. Make sure to always limit the service docker instance max ram, and then do the math to decide which <strong>EC2</strong> instance you need. For example, 100 services, each use around maximum 128 mb ram will require you to have a at least 12G ram , so a t2.large and a t2.medium will do the trick.</li><li><strong>Jenkin</strong> <strong>EC2 </strong>and<strong> Micro Service EC2 </strong>are put into private subnet: They can’t be accessed from anywhere except from inside the VPC. As you can see in the diagram, there is absolutely no reason to access them directly in the first place</li></ul><p>I hope you have a good understand how our infrastructure work. If you have any question or notice any part which need correction, please leave a comment. Thank you for reading our article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe3ae76edcc0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altitudehq/enabling-an-effective-ci-cd-pipeline-for-micro-services-fe3ae76edcc0">Enabling an effective CI/CD pipeline for micro-services</a> was originally published in <a href="https://medium.com/altitudehq">Altitude</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we customize and deliver our mobile app templates with fastlane & Jenkins]]></title>
            <link>https://medium.com/altitudehq/how-we-customize-and-deliver-our-mobile-app-templates-with-fastlane-jenkins-5c88f3a82633?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/5c88f3a82633</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[mobile-devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[fastlane]]></category>
            <dc:creator><![CDATA[Dong Mai]]></dc:creator>
            <pubDate>Wed, 02 Feb 2022 06:09:17 GMT</pubDate>
            <atom:updated>2022-02-02T07:09:16.286Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we customise and deliver on-demand our native mobile app templates automatically with Fastlane and Jenkins</h3><h3>Introduction</h3><p>In this article I want to share how we implement a solution that helps us customize on demand our native Altitude Guest app templates (<a href="https://www.altitudehq.com/guest/smart-guest-phone-app/">A smart hotel in your guests’ pocket</a>) without writing a line of code, and then deliver it to customers.</p><p>Some of you may have heard about “Print on demand”, it’s where you can go to custom a T-Shirt, a Mug, or a Blanket, you can upload your images here, change some text … once its done you can buy it through the checkout process. And after some days the item will be delivered to you looking exactly as same as your customization.</p><p>We want the same for our app templates. Imagine there is a webpage where you can customize an app, including the icon, styles, text color, turn on/off features, or change the app’s language. Then when you’re happy, with a click of a button, it will start building your app and notify you via email that it is ready to install on your devices.</p><h3>What problem does this solve?</h3><p>Below are three versions of the Altitude Guest app, it is a white label app that we can adjust configurations and styles and deliver different apps depending on customer needs from single source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*SBHHeONzoDc8Wpr5sILNkA.jpeg" /><figcaption>Example apps with different colors, styles and icons</figcaption></figure><h4>The current process</h4><p>First we made our apps code-base support templates and each time a new customer on-boards our customer success team and developers have to complete the manual tasks as below:</p><ul><li>Setup a new target for the customer and clone template files from existing targets</li><li>Update app configuration file (a JSON file that configures functionalities in the app, for example customer A might need feature X but customer B does not need it)</li><li>Update localization (we support multiple translations, plus allows a customer to set their preferred marketing languages, e.g. Stay vs Reservation. As well as cross industries: Student Accommodation vs Hotels)</li><li>Update images (for example; splash screen, logos, app icon, etc.)</li><li>Update app styles (a JSON file that styles the app — all elements style in app features, including button colors, header/text colors, shadows, corner radius and more)</li><li>Additional configuration and third party setup (like social logins, OS specific setup, push notifications and more)</li><li>Test app</li><li>Deliver apps to customers (for beta testing and store release)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*hjWkLtXgzzhdp8ijLfqVcA.jpeg" /><figcaption>The problem: Many manual tasks</figcaption></figure><h3>The solution</h3><p>Automation is the key to time and cost saving. Our web services already implement many levels of continuous deployment — why should our apps not.</p><p>Building automation tools saves time on setting up new customers but will also allow us to give potential and new customers a web page to configure their apps and click “Build My App” and all steps above are done automatically. As well as allow us and customers to update apps very simply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*HD5zggWe0EOUl45t8Vacsg.jpeg" /><figcaption>Expected result after applying the solution</figcaption></figure><h4>Main Components</h4><p><strong><em>1. The Web UI<br></em></strong>The font-end part that will works directly with customers to collect their requirement, it will have one service as its backend.</p><p>Here customers will customize the app as they need, we will list out what can be customized like app template (set of colors, style), localization&#39;s for display items, and more. The interface will also later include a web render of what their app will look like.</p><p><strong><em>2. The App Generation Service<br></em></strong>When users manipulate their apps on web UI we need a service to store the data for later use in the build process, plus it will have to communicate with the build machine for builds and keep track on build status/history (here we used Typescript for development).</p><p>The service is a series of CURD APIs and additional calls to 3rd party services (e.g. Firebase, Apple, Graph Facebook APIs, Google, etc.).</p><p><strong><em>3. Build machine with CI/CD tool</em><br></strong>The service itself cannot build and deliver apps (e.g. Apple OS can only build iPhone apps) so we need a build machine, here we use a Mac Mini (M1) that has an internet connection (can consider it as a Mac server) and it has Jenkins installed.</p><p>The Mac is set up in a way so the App Generation Service is able to communicate with Jenkins (securely) to tell it to do tasks as creating a job or triggering a build etc. Fortunately, Jenkins provides a <a href="https://www.jenkins.io/doc/book/using/remote-access-api/">Remote Access API</a> as well, as well as a <a href="https://www.npmjs.com/package/jenkins-api">NodeJS API wrapper</a> since we are writing the service in TypeScript.</p><p><strong><em>4. A tool that helps to do manually tasks automatically<br></em></strong>As mentioned above our developers have to complete manual tasks when we have a new customer; here we have <strong><em>fastlane</em></strong> come to the rescue: “<em>fastlane</em> is an open source platform aimed at simplifying Android and iOS deployment. <em>fastlane</em> lets you automate every aspect of your development and release workflow”, see: <a href="https://fastlane.tools/">https://fastlane.tools</a>.</p><p>With fastlane we can write custom functions in its script (Fastfile) to help to do all those tasks that developers have to do manually before building progress starts.</p><h4>Automation tasks we need to deal with</h4><p><strong><em>1. Auto configure app on Firebase console on the service<br></em></strong>In the app we provide Google login functionality, Firebase crashlytics and Firebase push notifications. So we have to manually configure for it on Firebase console every time we build new app for a new customer.</p><p>To automate this we use <a href="https://firebase.google.com/docs/projects/api/reference/rest">Firebase Management API</a>. We integrate the API with help of <a href="https://www.npmjs.com/package/firebase-admin">firebase-admin</a> library, for detail on how setting it up please take a look at <a href="https://firebase.google.com/docs/admin/setup">https://firebase.google.com/docs/admin/setup</a>.</p><p>Bellow are those APIs that I used:</p><ul><li>Create iOS app: <a href="https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.iosApps/get">projects.iosApps.create</a></li><li>Create Android App: <a href="https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.androidApps/create">projects.androidApps.create</a></li><li>Get operation detail: <a href="https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/operations/get">operations.get</a> when creating app (iOS/Android) it will return an operation name - you will use this name for the API. The API returns content of config file in base64 that when decoding will be the GoogleService-Info.plist if app is iOS and Google-Services.json if app is Android. You need to save those Base64 in database to update it in projects via fastlane script</li></ul><p>Note, you still manually need to create a Firebase project on Firebase console and make an account service key and give it to the service so it can be able to authenticate with Firebase Management API and do things for you.</p><p><strong><em>2. Auto configure Facebook logins on the service<br></em></strong>Our app also provides Facebook login and if you’re mobile developers you should be familiar with it that any time you setup for new app you have to go <a href="http://developers.facebook.com/">Facebook Developer</a> site to create a new one and configure it.</p><p>But there is an other way to do it via <a href="https://developers.facebook.com/docs/graph-api/">Graph API</a> provided by Facebook, below are those ones that I used:</p><ul><li><a href="https://developers.facebook.com/docs/graph-api/reference/application/#Updating">Update application API</a>: with this api you can add iOS app’s bundle id or android app’s package name to existing Facebook app</li><li><a href="https://developers.facebook.com/docs/facebook-login/access-tokens/#apptokens">Create app access token</a>: create access token per app to be able to call the update API</li></ul><p>We can’t create new applications via the API so we create a set of Facebook applications before hand, then use those ones to configure for new app that customer requests — because once we have Facebook app we can give the service it’s appID and secret that are two parameters need for generating app access token.</p><p><strong><em>3. Manage Jenkins job and build via API<br></em></strong>The service will communicate with Jenkins via its provided APIs to create jobs and trigger builds, we’ll create a job per customer app.</p><p>To make it easy we have created template jobs here with necessary setup including git repository, execute scripts, placeholder environment variables that we can easily replace when creating the job from service side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*P9Pgrrc4-JTfdGo8KgHNuw.png" /><figcaption>Job templates</figcaption></figure><p>Here I use <em>copy_job</em> function from the <a href="https://www.npmjs.com/package/jenkins-api">jenkins-api</a> library, but first you will need an <a href="https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/">API token</a> to call the api.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47494b01c793bf4f94616b3e41d4aa63/href">https://medium.com/media/47494b01c793bf4f94616b3e41d4aa63/href</a></iframe><p>While building is in progress we also need to keep track of build status so from the service we provide an API (<em>PUT /jenkins-job/jobId/updateLatestBuild</em>) and <em>fastlane</em> can consume it to update latest build status — there are build statuses we’re using: scheduled, running, finished, cancelled and paused.</p><p><strong><em>4. Fastlane helps do manual tasks<br></em></strong>Fastlane script — fastfile — is ruby so we can do with a custom ruby function. Additionally, fastlane also provides a list of ready-to-use <a href="https://docs.fastlane.tools/plugins/available-plugins/">plugins</a> and <a href="https://docs.fastlane.tools/actions/">actions</a> you can pick the ones suite your needs.</p><p>As mentioned above currently we have to setup a new target on iOS project or flavor in Android project for any new customers and clone template files from existing targets/flavors (of old customers) then update those files to match new requirements. To make it easy for fastlane we have made a <em>placeholder target/flavor</em> that have already have any template files it needs, and fastlane’s tasks are just updating files and configuring project no need to create any new files.</p><p><strong><em>4.1. Pull template data via API</em></strong><em><br></em>Firstly fastlane need to pull the template data for the app via the service, I wrote a custom function to get it and class using here is <a href="https://ruby-doc.org/stdlib-3.1.0/libdoc/net/http/rdoc/Net/HTTP.html">NET::HTTP</a>. Its quite simple like you do api calls in other client languages as Swift, Java … .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d0e03fc2f4f421367d521111bd32514/href">https://medium.com/media/5d0e03fc2f4f421367d521111bd32514/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84f29b362cb04ab68a923fbe396fbeb8/href">https://medium.com/media/84f29b362cb04ab68a923fbe396fbeb8/href</a></iframe><p><strong><em>4.2. Change app name and bundle ID/package name<br></em></strong>For <strong><em>iOS </em></strong>we use <a href="https://docs.fastlane.tools/actions/update_info_plist/">update_info_plist</a> action</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d572959a36bf263a5bb7551c419de692/href">https://medium.com/media/d572959a36bf263a5bb7551c419de692/href</a></iframe><p>For <strong><em>Android </em></strong>we use <a href="https://github.com/MaximusMcCann/fastlane-plugin-android_change_string_app_name">android_change_string_app_name</a> plugin to change app name, and for package name I’ve to write a custom function to parse <strong><em>build.gradle</em></strong> file and update <strong><em>applicationId</em></strong> field</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a6a9d5d40443e5ab9569a1c181c6c1d/href">https://medium.com/media/7a6a9d5d40443e5ab9569a1c181c6c1d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/43c5675763caa800957bbeb71dbe9a20/href">https://medium.com/media/43c5675763caa800957bbeb71dbe9a20/href</a></iframe><p><strong><em>4.3. change app icon<br></em></strong>All images the server will return as urls so we need a way to download them first before handling — here we use <a href="https://github.com/janko/down">down</a> tool for it. To be able to use it you need add gem &quot;down&quot; in the <strong><em>Gemfile</em></strong></p><p>for <strong><em>iOS</em></strong> we use <a href="https://github.com/fastlane-community/fastlane-plugin-appicon">appicon</a> plugin:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff03aea2b4607a9f3f2c749fa0d9a99c/href">https://medium.com/media/ff03aea2b4607a9f3f2c749fa0d9a99c/href</a></iframe><p>for <strong><em>Android</em></strong> we use <a href="https://github.com/fastlane-community/fastlane-plugin-appicon">android_appicon</a> plugin:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3509a19af01aa945a3d9d9c45167e58/href">https://medium.com/media/f3509a19af01aa945a3d9d9c45167e58/href</a></iframe><p><strong><em>4.4. Change app images<br></em></strong>Change other images is quite simple as it’s just replacing file, I wrote a function for it so can replace one by one with ease:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13c94b1f2b99c951852f43bf07549482/href">https://medium.com/media/13c94b1f2b99c951852f43bf07549482/href</a></iframe><p><strong><em>4.5. change app localizations and other files by replacing<br></em></strong>The service will return localization files in platform-specific format so again it’s just a simple replacing files</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/63934a1fe066d6a191c8dd5884ab3831/href">https://medium.com/media/63934a1fe066d6a191c8dd5884ab3831/href</a></iframe><p>and for other files like app configuration (json), GoogleService-info.plist, Google-Service.json we just need to replace it with contents returned by server</p><p><strong><em>4.6. Configure Facebook/Google logins<br></em></strong>For <strong><em>iOS</em></strong> we have to update plist file to add FacebookAppID and URL Schemes to make Facebook/Google logins working like bellow screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*kolWk221x-bRwl64QW0mrg.png" /></figure><p>so I’ve to write custom functions to modify the plist file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/71c099e16c0a7c01c67df1cd5a15ab90/href">https://medium.com/media/71c099e16c0a7c01c67df1cd5a15ab90/href</a></iframe><p>For <strong><em>Android</em></strong> I need to update <strong><em>config_string.xml</em></strong> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6ce931306ef49cabb457e42f48bea73/href">https://medium.com/media/e6ce931306ef49cabb457e42f48bea73/href</a></iframe><p>Finally, we’ve done all manually tasks with help of fastlane scripts, now let’s move on delivering apps…</p><p><strong><em>5. Deliver app<br></em></strong>For <strong>iOS</strong> side we use TF to deliver the app, but due to App Store limitation we couldn’t setup new apps 100% automatically via <a href="https://developer.apple.com/documentation/appstoreconnectapi">App Store Connect API</a>, as to setup new app ready for TF we need two steps:<br>- Setup new app identifier on <a href="https://developer.apple.com/">Apple developer site</a> (1)<br>- Setup the new app on <a href="https://appstoreconnect.apple.com/">App store connect</a> (2)</p><p>with App store connect API we can just do (1) so only got half the job done, finally we come to a solution that we made before hand a list of apps here as placeholders, we’ll pick one by one to deliver the app.</p><p>Additionally, we also provide an option to deliver the app to customer’s Apple account, this option will require customers to do some manually steps:<br>- Provide us API key with developer role<br>- Setup the new app on both Apple developer and App store connect</p><p>For <strong>Android</strong>, its much simpler for deploying beta testing app, we just upload it on AWS S3 then its done, and you can use <a href="https://docs.fastlane.tools/actions/s3/">s3 action</a> for it.</p><h4><strong>Conclusion</strong></h4><p>Huge time savings means we can relay the cost savings to our customers.</p><p>Automation within Jenkins allows us to do a lot of very exciting things — automation, auto-review code, alerts, tests, and more!</p><p>The future of our Altitude Apps include new and exciting products and our DevOps solutions will ensure we can continue to innovate with our applications and services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c88f3a82633" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altitudehq/how-we-customize-and-deliver-our-mobile-app-templates-with-fastlane-jenkins-5c88f3a82633">How we customize and deliver our mobile app templates with fastlane &amp; Jenkins</a> was originally published in <a href="https://medium.com/altitudehq">Altitude</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka retries and maintaining the order of retry events]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/altitudehq/kafka-retries-and-maintain-order-of-retry-events-313482044351?source=rss----d04c820dd957---4"><img src="https://cdn-images-1.medium.com/max/1904/1*a-CnRY4wIUkwPEgzqo5ZKg.png" width="1904"></a></p><p class="medium-feed-snippet">Retries are important especially in the microservices system where those services must often collaborate in order to handle a request&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/altitudehq/kafka-retries-and-maintain-order-of-retry-events-313482044351?source=rss----d04c820dd957---4">Continue reading on Altitude »</a></p></div>]]></description>
            <link>https://medium.com/altitudehq/kafka-retries-and-maintain-order-of-retry-events-313482044351?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/313482044351</guid>
            <category><![CDATA[maintain-order]]></category>
            <category><![CDATA[retry]]></category>
            <category><![CDATA[reprocess]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[orders]]></category>
            <dc:creator><![CDATA[Thắng Đỗ]]></dc:creator>
            <pubDate>Fri, 21 Jan 2022 06:30:17 GMT</pubDate>
            <atom:updated>2022-01-22T05:48:58.170Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Event Driven hotel reservations with Kafka]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/altitudehq/event-driven-for-reservation-with-kafka-b1c5ad2927fe?source=rss----d04c820dd957---4"><img src="https://cdn-images-1.medium.com/max/881/1*YOQc_y4rQbqb3X3xDchazw.png" width="881"></a></p><p class="medium-feed-snippet">Reservation data is the heart of a hotel digital platform as Altitude. Almost everything happens around reservation: mobile keys should be&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/altitudehq/event-driven-for-reservation-with-kafka-b1c5ad2927fe?source=rss----d04c820dd957---4">Continue reading on Altitude »</a></p></div>]]></description>
            <link>https://medium.com/altitudehq/event-driven-for-reservation-with-kafka-b1c5ad2927fe?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/b1c5ad2927fe</guid>
            <category><![CDATA[event-sourcing]]></category>
            <category><![CDATA[reservation-system]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[kafka-connect]]></category>
            <dc:creator><![CDATA[Thắng Đỗ]]></dc:creator>
            <pubDate>Mon, 04 Oct 2021 06:38:01 GMT</pubDate>
            <atom:updated>2021-10-10T08:43:26.696Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Powering real-time experiences for mobile and web with Altitude]]></title>
            <link>https://medium.com/altitudehq/powering-realtime-experiences-for-mobile-and-web-with-altitude-direct-socket-service-f3257189482b?source=rss----d04c820dd957---4</link>
            <guid isPermaLink="false">https://medium.com/p/f3257189482b</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[realtime]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[Thắng Đỗ]]></dc:creator>
            <pubDate>Fri, 09 Apr 2021 16:54:12 GMT</pubDate>
            <atom:updated>2021-11-10T05:08:53.464Z</atom:updated>
            <content:encoded><![CDATA[<h3>Powering real-time experiences for mobile and web with Socket.IO</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*QDgS5TfHYBJFDdc_AwRVnA.jpeg" /></figure><h3>Why?</h3><p>Goal is to enhance the web and app experiences to be real-time. For example:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FrQV6YsbGpYU&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DrQV6YsbGpYU&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FrQV6YsbGpYU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/be92f4097cedcbd891ab8125c830534f/href">https://medium.com/media/be92f4097cedcbd891ab8125c830534f/href</a></iframe><p>How do we add a new task in real-time? We often have 2 options: Push vs Pull (Polling). In the most cases, polling is not good, especially for a long time and with many clients. We need to pick a push solution.</p><h3>Our requirements</h3><ul><li>Support more platforms: web, native android &amp; iOS.</li><li>Each property is a space, client must be authenticated to access a space (using the Altitude JWT). Space can have many channels: notifications, tasks, alerts and more; and client can choose a channel to subscribe.</li><li>A central point to manage incoming clients. Other services want to send notification to clients then send via this central point with easy private API (e.g. via a http request).</li><li>Channel to subscribe is dynamic.</li><li>Client can subscribe more channels at same time or leave channel.</li><li>Server can actively disconnect from client for security reason</li><li>Scalability: support load balancing</li><li>Other service can broadcast to all clients in topic, data to broadcast is customizable. With this requirement, Pub/Sub paradigm is suitable</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*BvtKQaeIa2FzOelH-4R0vA.png" /><figcaption>4 options to make client real-time.</figcaption></figure><h3>Do we need another push?</h3><p>What’s problem with FCM:</p><ul><li>Throttling: Limit non-collapsible messages</li><li>Not really for realtime: you send 1000 messages to a single device (let’s also say that all is sent successfully), there’s a chance that GCM will throttle your messages so that only a few would actually push through OR each message will be delivered but not simultaneously to the device.</li><li>Hosted solution, third party and not free.</li></ul><p>Other options, such as Pusher, are also third party, less customizable and not free and hosted solution too.</p><p>We need a self-hosted solution: more control, customization and future proofed.</p><h3>High level design</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*HpGOrur-LVN58nMwt3EwPw.png" /></figure><p>We will define each property is a Space and a business logic component in property as Task, Maintenance… is a Channel</p><p>Client want to listen changing in Task, Maintenance then it must access to Space with authorization. After access success, client can start to join to channels and listen notifications.</p><p>Based on these requirements and y experience, <a href="http://socket.io/">socket.io</a> was the best fit: Space becomes Namespace and Channel becomes Room.</p><h4>What is socket.io (a quick overview)</h4><p><a href="http://socket.io/">Socket.IO</a> is a library that enables real-time, bidirectional communication between the client and the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*3BgG1Pyz_4Nvo8yI1f7Vdw.png" /></figure><p>Communication is event-based</p><p>Client side event:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d927bef563e1032a6a059d45b5cf73e7/href">https://medium.com/media/d927bef563e1032a6a059d45b5cf73e7/href</a></iframe><p>Server side event:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18ccb08a059216fc7e29619f47a78985/href">https://medium.com/media/18ccb08a059216fc7e29619f47a78985/href</a></iframe><h3>Design core components</h3><h4>Authorization uses the Altitude JWT</h4><p>We don’t want to create new authentication cause user must login twice, one for Altitude and one for Direct Socket service. The best way is to reuse the Altitude JWT and verify it.</p><p><a href="http://socket.io/">Socket.io</a> doesn’t have an official authentication. A suggestion from them is using middleware (same concept as Express middleware) to verify token but this function will be executed only once per connection meanwhile our JWT is short time token and must be renewed multiple times in a connection.</p><p>So we create a custom authentication based on a socket event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*jOugxqaLFKbrWAQbJBANig.png" /></figure><ul><li>Client connect to a space (property) of server</li><li>Client connected success</li><li>After client connected, server will set a timeout and wait client send event authenticate</li><li>If client send event authenticate with JWT before timeout then server will verify it with space that client want to connect</li><li>If an invalid JWT or a space isn’t in the client JWT or a timeout occurs then the server will disconnect client with reason unauthorized</li><li>Otherwise, the server sends authorized event to the client and then start exchanging messages</li><li>Every time server sends message to client, server will verify client JWT hasn’t expired yet. If it’s expired then send disconnect with reason unauthorized</li><li>Every time client receive new token, it must emit event authenticate with new JWT to server double check.</li></ul><h4>Client want to join or leave channel</h4><p>When connected to a space, client can join to any channel in space to listen notification in channel. If channel isn’t exist then server will create new one and add client in. Client need to ask server before join to channel by event join_room and wait until receive joined_room</p><p>We can add an authentication step when client ask to join channel but I feel it is unnecessary and complicated. When client is authenticated to access in space, it could listen all notifications in channel but we should not contain too much sensitive data in notification.</p><p>Client can ask server to leave channel by send event leave_room and wait until receive leaved_room</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*VVl13IQDL7lPvIH_Oqf-eQ.png" /></figure><h4>Join more channels in a space</h4><p>Client can be comfortable to join more channel in space by send more events join_room to server. For example listen task notification and maintenance notification at the same time.</p><p>Note that it is advisable to leave the channel as soon as possible to avoid listening too much notifications. For example when you are opening Task tab and switch to other tab then should leave channel task.</p><h4>Other services want to broadcast to clients</h4><p>For example in above video, how to web can receive task notification when a guest implement pre checkin?</p><p>It’s our flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*uUKU2-G1izlPqPFX4jgVfg.png" /></figure><p>Important step is what’s data Task service should send to direct socket service to broadcast to all clients?</p><p>This is request</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c083336f1b554934f348b2a7a0708ca/href">https://medium.com/media/7c083336f1b554934f348b2a7a0708ca/href</a></iframe><p>When receive this request, direct socket service will find space 5ca199fdda8ba619695b5728 in server then broadcast notification with type and data of request to all clients in channel task</p><h4>Send 1–1 notification</h4><p>How if we want send only private notification to a user. For example, admin send a message to staff to advise a delivery. We don’t want other staff can join this channel and listen, we want to create a separate channel for each user and no one else has access.</p><p>As noted above, we have only one step authentication at space so we can’t create a new channel for private notification. We need to create a private space and change way to verify JWT.</p><p>Each JWT always has a field sub that is subject of JWT. we can rely on it to create private space with format:</p><p>{serverUrl}/notification-subject/{subjectId}</p><p>So if client want to connect to this space, its files need sub in JWT match with subjectId in space.</p><h3>Scale design: support load balancing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*0RpI_wGySRMeBy8OyrmE8g.png" /></figure><p>First step we can think to scale this service is increase number of servers and using load balancer.</p><p>However we can fall into the following situation:</p><ul><li>We have 2 instance, instance A keep space Park Hotel and Beta Hotel, instance B keep space Grand Hotel.</li><li>Task service want to send notification to channel Task of space Grand Hotel</li><li>Request run via LB and redirect to instance A that least busy.</li><li>Instance A don’t keep space Grand Hotel so it cannot send notification to Web 3</li></ul><p>From this situation, instance A needs to inform the other servers that a notification on space Grand Hotel is need to send. Instance B listen and check it’s holding space Grand Hotel so it will start to handle.</p><p>To communicate between socket server, we will use Redis that support pub/sub paradigm.</p><p>Here is design in detail for this flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jzdctET5Z0-L1lHLeEAl-w.png" /></figure><ol><li>Server 1 start a timeout and put http request to its queue then it publish an event FA1 via Redis to found server holding space property A</li><li>Server 2 and 3 subscribe event FA1 and check if it holding space property A</li><li>Server 2 holding space property A so it get data from FA1 and broadcast to clients that join this space</li><li>After broadcast success, Server 2 publish an event FA2 to Redis to report all success.</li><li>Server 1 and 3 subscribe event FA2 via check http request in FA2 is in its queue</li><li>Server 1 know that it should handle this request so it read data from FA2 and return in http response</li><li>If timeout reached and Server 1 doesn’t receive FA2 yet to dequeue then it return error to other service.</li></ol><h3>Security</h3><h4>Encrypt data</h4><p><a href="http://socket.io/">Socket.io</a> uses WebSocket as a transport when possible. It initializes the connection with a http request.</p><p>Request then check if client support then it will establish a WebSocket. Otherwise it continue with HTTP polling.</p><p>Like HTTPS, WebSocket has a secure protocol wss:// that is encrypted, thus protecting against man-in-the-middle attacks.</p><p>Fortunaty, when we initialize a connection it is https, <a href="http://socket.io/">Socket.io</a> will then establish a WebSocket using wss without any additional line of code.</p><h4>What’s happen if the JWT expires and cannot refresh</h4><p>After authenticated, client JWT will be kept in socket connection. When server want to broadcast to clients in channel then it will check JWTs not expired. If it’s expired and not renew yet, client will be disconnected with reason unauthorized — the client will then begin the process of reauthirising with the authorisation server and reconnect to Direct socket service.</p><p>An another option is create a queue job to check JWTs and disconnect a client asap if it doesn’t renew token yet.</p><h3>Ongoing</h3><p>Enhanced load balancing: at the present time, more properties space run in one instance and when the number of properties increases, we add more instances. However, we can’t run one property space on more instances. This could be the problem if property has lot of socket connections or servers disconnect and loose messages. We need to improve this!</p><h3>What is Altitude?</h3><p>Altitude is a all in one smart hotel service, enabling hotels to connect with guests like never before and empower staff to provide more personalised services. Find out more at <a href="http://www.altitudehq.com/">www.altitudehq.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3257189482b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altitudehq/powering-realtime-experiences-for-mobile-and-web-with-altitude-direct-socket-service-f3257189482b">Powering real-time experiences for mobile and web with Altitude</a> was originally published in <a href="https://medium.com/altitudehq">Altitude</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>