<?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 Hareesh Polla on Medium]]></title>
        <description><![CDATA[Stories by Hareesh Polla on Medium]]></description>
        <link>https://medium.com/@hareeshbabu82?source=rss-a6395136acde------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Hareesh Polla on Medium</title>
            <link>https://medium.com/@hareeshbabu82?source=rss-a6395136acde------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:10:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hareeshbabu82/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[Harnessing AI for Text-to-Speech: Indic Languages and English Locally]]></title>
            <link>https://hareeshbabu82.medium.com/harnessing-ai-for-text-to-speech-indic-languages-and-english-locally-2455cae4211b?source=rss-a6395136acde------2</link>
            <guid isPermaLink="false">https://medium.com/p/2455cae4211b</guid>
            <category><![CDATA[ai4bharat]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[text-to-speech]]></category>
            <category><![CDATA[indicf5]]></category>
            <dc:creator><![CDATA[Hareesh Polla]]></dc:creator>
            <pubDate>Sun, 22 Jun 2025 13:38:41 GMT</pubDate>
            <atom:updated>2025-06-22T14:17:16.916Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zOIBCJ2Nl3YopfupkfHKCg.png" /><figcaption>Robot Talking Language for Human instructions</figcaption></figure><h3>Why Local TTS Matters</h3><ul><li>Text-to-Speech now sounds almost like real humans</li><li>Open-source models run on your computer — no internet needed, no monthly costs, complete privacy</li><li>Several Tools available for multiple languages and use cases:</li><li>— <a href="https://github.com/AI4Bharat/IndicF5">IndicF5</a> for Indian languages (Telugu, Tamil, Hindi, etc.)</li><li>— <a href="https://github.com/SWivid/F5-TTS">F5 TTS</a> for English (Foundation for IndicF5)</li><li>— <a href="https://github.com/resemble-ai/chatterbox">Chatterbox</a> for English (also called <em>ChatterTTS</em>)</li><li>With GPU acceleration, these tools now work smoothly on personal computers</li></ul><h3>IndicF5: Speaking Indian Languages</h3><p><strong>IndicF5</strong> created by <a href="https://ai4bharat.iitm.ac.in/">AI4Bharat</a> (IIT Madras) is a speech model that supports 11 Indian languages. It was trained on 1,417 hours of speech data.</p><h4>Key Features</h4><ul><li>Works with <strong>Assamese, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, Telugu</strong></li><li>Speech quality that sounds like real humans</li><li><strong>Voice cloning</strong> using voice samples</li><li>High-quality 24 kHz audio output</li></ul><h4>Getting It Working</h4><ul><li>At first, I had trouble setting it up despite the clear documentation. This was mostly due to my limited experience with <a href="https://huggingface.co/">Hugging Face</a> and TTS models.</li><li>After several hours of research, I got it working on my system and even improved it to use the MPS (Apple Silicon) GPU on my Mac Studio, which made it much faster.</li><li>To make it easier for others, I created a modified version of IndicF5 that I can run with a single command, either directly on my computer or through Docker on self hosted server.</li><li>All credit goes to the AI4Bharat team - I simply made it easier to install and use locally, which helps me with my large collection of Indian language texts.</li></ul><h4><strong>Run It On Your Computer</strong></h4><pre># Download the code<br>git clone https://github.com/hareeshbabu82ns/TTSIndicF5.git<br><br># Start it (for Mac with MPS support for PC uses Nvidia GPU or just runs on CPU)<br>./start_api.sh</pre><ul><li>The script will check for conda or venv and create one if needed</li><li>It installs all necessary software and starts the app at <a href="https://localhost:8000/api_demo.html">https://localhost:8000/api_demo.html</a></li><li>The web interface was created with Github Copilot</li><li>The app includes two AI reverence voices: PAN_F_HAPPY_00001 - IndicF5 (for Indian languages) and ENG_M_WIKI_00001 - F5TTS (for English)</li><li>Just type your text and click Generate Speech</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-L3DxS-KHs6lrfTMfw-wVg.png" /><figcaption>Generating Telugu</figcaption></figure><ul><li>Listen to the Generated Audio: <a href="https://github.com/hareeshbabu82ns/TTSIndicF5/blob/670a567acb95b7bacd6a39cbfaaf1c8fa9661d2d/article/intro/01_tts_gen_telugu.wav">01_tts_telugu.wav</a></li><li>For this 62-word Telugu sample, my Mac Studio (M4 Max 64 GB) took 39 seconds</li><li>I added language switching to make it more useful. We can mix languages in one text, like this example that starts with Telugu, switches to English, and returns to Telugu</li></ul><pre>మరి ఆ బండిని తోలే ఎద్దు సంగతి చెప్పాలా? ఊళ్ళో అన్నిటికన్నా ఆరోగ్య వంతంగా, <br>బలంగా ఉన్న ఎద్దును ఎంచుకునేవారు.<br>&lt;refvoice key=&quot;ENG_M_WIKI_00001&quot;&gt;Now speaking in English and <br>going to switch back to Telugu&lt;/refvoice&gt;<br>ఆ ఎద్దు చర్మం నిగనిగలాడేలా దానికి స్నానం చేయించి, బొట్లు పెట్టి, <br>గంటలు కట్టి పట్టు వస్త్రాలు వేసేవారు. ఆహ! చాలా చూడ ముచ్చటగా తయారు చేసేవారు.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PEHECL-c6IdX5KwkBsDFg.png" /><figcaption>Generating Telugu-English</figcaption></figure><ul><li>Listen to the Generated Audio: <a href="https://github.com/hareeshbabu82ns/TTSIndicF5/blob/670a567acb95b7bacd6a39cbfaaf1c8fa9661d2d/article/intro/02_tts_gen_tel_eng_switch.wav">01_tts_telugu_english.wav</a></li></ul><h4><strong>Run Using Docker</strong></h4><pre># Build and run locally<br>docker compose -f docker-compose.yml --env-file .env up<br><br># Or use the pre-built version (not production ready, just named prod)<br>docker compose -f docker-compose-prod.yml --env-file .env.prod up -d</pre><ul><li>Sample .env.prod file:</li></ul><pre>VERSION=0.0.7<br>PORT=8000</pre><h3>What The API Can Do</h3><p>App provides a simple API with FastAPI:</p><ul><li>/tts endpoint for text-to-speech functions:</li><li>— Converts text to speech using your chosen voice</li><li>— Breaks long text into smaller chunks (300 characters or full sentences)</li><li>— Handles voice switching with &lt;refvoice key=&quot;&quot;&gt;text&lt;/refvoice&gt; tags</li><li>/referenceVoices lets you manage voice samples</li><li>/files helps you view and play created audio files</li><li>/docs shows all available API functions</li></ul><p>The web interface lets you type text, pick voices, adjust settings, and listen to the results.</p><h3>What You Can Do With It</h3><ul><li>Create <strong>podcasts</strong> in English or Indian languages</li><li>Make <strong>educational content</strong> with AI narration of stories or news</li><li>Improve <strong>accessibility</strong> with screen readers in regional languages</li><li>Add <strong>voice narration to games</strong> in multiple languages</li></ul><h3>Wrapping Up</h3><p>Huge thanks to <a href="https://ai4bharat.iitm.ac.in/">AI4Bharat</a> for creating these models and making them available, and to <a href="https://huggingface.co/">Hugging Face</a> for hosting so many AI models that are easy to find and use.</p><p>Open-source AI now lets us run high-quality voice models on our own computers. With <strong>IndicF5</strong>, I built a flexible system that works with both English and Indian languages — with no cloud services needed, full control, and expressive voices.</p><p>I believe in using AI to boost my productivity rather than becoming dependent on it. AI is a great tool, but relying too much on it for research can limit learning opportunities. The best part of learning comes from exploring on your own and discovering new things.</p><h3>Ethical Considerations</h3><p>AI text-to-speech technology must be used responsibly and ethically. Users should only generate speech with their own voice samples or those they have explicit permission to use, rather than attempting to clone or imitate others’ voices without consent. This is especially important as these local TTS models become more realistic and accessible to everyone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2455cae4211b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharging Development with GitHub Copilot Agent Mode: My Journey with HOcr App]]></title>
            <link>https://hareeshbabu82.medium.com/supercharging-development-with-github-copilot-agent-mode-my-journey-with-hocr-app-6186d332721b?source=rss-a6395136acde------2</link>
            <guid isPermaLink="false">https://medium.com/p/6186d332721b</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[github-copilot]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Hareesh Polla]]></dc:creator>
            <pubDate>Fri, 16 May 2025 13:22:53 GMT</pubDate>
            <atom:updated>2025-05-16T13:22:53.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlFeM64dVfghtaqt6z0R1g.png" /></figure><p>As a full-stack developer architecting HOcr, a NextJS-based Optical Character Recognition (OCR) application leveraging TypeScript and Prisma with MongoDB, I’ve witnessed firsthand the paradigm-shifting capabilities of GitHub Copilot’s Agent mode. In this technical deep-dive, I’ll delineate my evolution from rudimentary prompts to implementing comprehensive instruction manifests, and how this transformation exponentially amplified my development velocity and architectural consistency.</p><h4>Why HOcr? Selecting the Perfect Testing Ground</h4><p>I deliberately selected HOcr as my testbed for GitHub Copilot Agent mode experimentation for several strategic reasons. As the most recent application in my development portfolio, HOcr presented an ideal comparative opportunity, its architecture remained fresh in my memory, allowing me to conduct a rigorous side-by-side evaluation between traditional development workflows and AI-augmented methodologies.</p><p>The technical complexity of HOcr, with its diverse requirements spanning document processing, OCR integration, and structured data management, provided a comprehensive assessment landscape. The application’s multi-faceted nature demanded solutions across frontend UI components, server-side processing, state management patterns, and database interactions, precisely the engineering diversity needed to thoroughly evaluate Copilot Agent’s capabilities across the full development spectrum.</p><h4>Starting Simple: Basic Prompts with Copilot</h4><p>When I began developing HOcr, my interactions with GitHub Copilot were rudimentary and syntactically naive. I’d type simplistic comments like:</p><pre>// Create a function that processes an uploaded image using tesseract.js</pre><p>Copilot would generate syntactically valid but architecturally agnostic code. It was the equivalent of hiring a junior developer who hadn’t been onboarded to the codebase conventions yet. For instance, it might suggest:</p><pre>async function processImage(file: File) {<br>  const { createWorker } = require(&quot;tesseract.js&quot;);<br>  const worker = await createWorker();<br>  const result = await worker.recognize(file);<br>  await worker.terminate();<br>  return result.data.text;<br>}</pre><p>While functionally operational, this implementation lacked the rigorous type safety protocols and exception handling patterns. I found myself performing substantial refactoring to reconcile these suggestions with architectural paradigms, negating much of the productivity gain.</p><h3><strong>The Game-Changer: Agent mode with Instruction Files</strong></h3><p>Everything changed when I started using a comprehensive .github/copilot-instructions.md file that detailed:</p><ul><li>Project architecture and folder structure</li><li>TypeScript best practices and type safety requirements</li><li>Server action patterns with TanStack Query</li><li>Form implementation standards with zod validation</li><li>Error handling approaches</li></ul><p>Rather than hoping Copilot would guess my architectural intent, I could reference these instructions with: <a href="https://gist.github.com/hareeshbabu82ns/f44192ea5e584bdb45451251cec38f8c">Gist: copilot-instructions.md</a></p><p><em>(ofcourse I took help of AI and several prompts to build a satisfactory instruction set for my initial requirements)</em></p><p>After the elaborated instructions were finalized, it was time to meticulously craft the data schema using Prisma under prisma/schema.prisma.</p><p>To ensure Copilot maintained contextual awareness of the database architecture during code generation, I configured it to always reference this schema definition using .vscode/settings.json:</p><pre>{<br>  &quot;github.copilot.chat.codeGeneration.instructions&quot;: [<br>    {<br>      &quot;file&quot;: &quot;prisma/schema.prisma&quot;<br>    }<br>  ]<br>}</pre><p>Finally, its now time to generate the app with following simple command and watch it build the basic app.</p><blockquote>Note: I tried several agent LLMs available through default Github Copilot Agent Dropdown, but Claude 3.7 Sonnet worked best for me.</blockquote><pre>start building the nextjs app following the instructions</pre><h3>The Results Were Remarkable</h3><ul><li>The generated app might not be perfect or no way near the finished product, but it has all the components needed to start and the App layout with TailwindCSS theme and Dark mode is awesome to see work at the first iteration.</li><li>Initially, I was both astonished and humbled by the application Copilot generated. My reaction wasn’t due to any inability to build it myself, but rather because the system produced a fully functional initial rendition in approximately 10 minutes. Remarkably, I could immediately run and navigate through all pages of the application without encountering any/minor issues.</li><li>Any runtime errors, I would prompt Agent to run the app and fix the errors and it would run the app in seperate terminal and observe the errors as I navigate the pages and fixes itself.</li><li>The App also generated a <strong>Landing page</strong> that looks very promising</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dix0K3iPDwHPk-LscXircQ.png" /><figcaption>App Landing Page</figcaption></figure><ul><li>further prompts requested are</li><li>— to add version number and icon size and color adjustments</li><li>Here is a peak at final <strong>Document uploads page</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DURkFUlSgCCB2d0GAUJ4Q.png" /><figcaption>Document Upload Page</figcaption></figure><ul><li>further prompts requested are</li><li>— to replace upload functionality to use react-dropzone and enable drag and drop the file</li><li>— calculating number of pages on client side</li><li>— auto populating document title and number of pages from the pdf file</li><li>Out of all <strong>Document OCR processing page</strong> came with perfect layout of what I envisioned although the OCR process was not working yet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NNCljfFXzoGfGy9ADsWRJA.png" /><figcaption>Document OCR Processing Page</figcaption></figure><ul><li>further prompts requested are</li><li>— to enhance the OCR functionality using tesseract.js (a minor refactoring was necessary here as Copilot encountered non-deterministic edge cases in the OCR processing pipeline)</li><li>— implement Canvas-based rendering instead of pdf.js for granular control over viewport manipulation, zoom interpolation, and OCR text overlay</li><li>— implement fullscreen modal view with progressive rendering and selective page processing capabilities</li><li>Most impressively, when prompted to implement bounding box overlay on the Canvas, Copilot generated coordinate transformation algorithms with 90% spatial accuracy. The remaining edge cases required only minor adjustments to achieve acceptable alignment.</li><li>When implementing the document processing form, instead of generic suggestions, Copilot now generated:</li></ul><pre>&quot;use client&quot;;<br><br>import { useMutation, useQueryClient } from &quot;@tanstack/react-query&quot;;<br>import { processDocument } from &quot;@/app/actions/document-actions&quot;;<br>import { useForm } from &quot;react-hook-form&quot;;<br>import { zodResolver } from &quot;@hookform/resolvers/zod&quot;;<br>import { z } from &quot;zod&quot;;<br>import { toast } from &quot;@/components/ui/toast&quot;;<br><br>const formSchema = z.object({<br>  name: z.string().min(1, &quot;Document name is required&quot;).max(100),<br>  fileUrl: z.string().url(https://medium.com/&quot;Valid%20file%20URL%20is%20required&quot;),<br>  language: z.string().default(&quot;eng&quot;),<br>  enhanceImage: z.boolean().default(false),<br>  confidenceThreshold: z.number().min(0).max(100).default(80),<br>});<br><br>type FormValues = z.infer&lt;typeof formSchema&gt;;<br><br>export function DocumentProcessForm() {<br>  // Perfect implementation following the patterns<br>  // ...<br>}</pre><p>The code was not only functional but followed exact patterns for:</p><ul><li>Type safety with zod validation</li><li>Error handling with try/catch</li><li>Integration with TanStack Query patterns</li><li>Consistent naming conventions</li></ul><h4>Beyond Code Generation: Deployment</h4><p>I have also generated following with simple prompts</p><ul><li>Dockerfile to build the Docker image of the NextJS App</li><li>.github/workflows/build.yml to build the Docker image using github actions</li><li>docker-compose.yaml file to deploy the application on to my HomeLab Server</li></ul><p>all are so accurate and close to my existing build scripts that are successful on the first attempt, impressive.</p><h4>Beyond Code Generation: Architectural Consistency</h4><p>The biggest win wasn’t just faster code generation, it was consistency. With the detailed instructions, Copilot ensured:</p><ol><li><strong>Type Safety</strong>: Suggestions always used proper TypeScript patterns with discriminated unions for state management</li><li><strong>Error Handling</strong>: All generated code properly handled errors with established patterns</li><li><strong>Performance Optimization</strong>: Suggestions incorporated memoization and proper React patterns</li><li><strong>Accessibility</strong>: Generated UI components adhered to my Web App requirements</li></ol><h3>Lessons Learned</h3><p>Through this journey, I’ve discovered some best practices for working with Copilot Agent mode:</p><ol><li><strong>Be specific with instructions</strong>: The more detailed your instructions file, the more accurate the suggestions</li><li><strong>Include code examples</strong>: Concrete examples in your instructions help Copilot understand your patterns</li><li><strong>Update instructions as your project evolves</strong>: Keep your instructions file current with architectural decisions</li><li><strong>Reference specific sections</strong>: Use comments to direct Copilot to relevant parts of your instructions</li></ol><h3>Conclusion</h3><p>GitHub Copilot Agent mode with detailed instruction files has transformed how I build Web Applications. Rather than just a code completion tool, it became a pair programmer that understands the architecture, patterns, and best practices.</p><h4>The Cautionary Perspective: Technical Vigilance Required</h4><p>While the results with Copilot Agent mode have been impressive, I must emphasize a critical observation from my development experience: Engineer oversight remains essential. Despite sophisticated instructions, the AI occasionally generates code that diverges significantly from architectural requirements or introduces subtle logic errors that static type checking cannot catch.</p><p>In approximately 15–20% of cases, I encountered what I call “conceptual drift” — where initially correct implementation patterns gradually shifted toward non-compliant approaches within the same file. This was particularly evident in:</p><ol><li><strong>State Management Logic</strong>: Occasionally mixing Redux patterns with Context API approaches within the same component tree</li><li><strong>Form Validation</strong>: missing the validation patterns and fields</li><li><strong>Database Interaction</strong>: Generating correct Prisma queries that sometimes referenced non-existent fields or relationships</li><li><strong>Generate duplicates: </strong>Sometimes it generates UI components which are duplication and I need to post additional prompts to fix this</li></ol><p>To mitigate these risks, I established a verification protocol:</p><ul><li>Review all generated code against a checklist of architectural requirements</li><li>Run comprehensive test suites after each significant code generation session</li><li>Implement stricter ESLint rules to catch pattern deviations automatically</li><li>Periodically review the codebase holistically to identify inconsistencies</li></ul><p>This balanced approach — leveraging AI acceleration while maintaining engineering oversight — has proven most effective. As these models continue to evolve, the oversight requirement will likely diminish, but for now, the partnership between human judgment and AI capability delivers the optimal engineering outcome.</p><h4>The Observations: Treditional and Copilot Agents</h4><p><strong>Development Time:</strong></p><ul><li>Traditional approach took me ~120 hours development time</li><li>with Copilot Agent mode I was able to cover all the development within ~40 hours</li><li>refactoring or enhancing is a breaze and accurate with Agents</li></ul><p><strong>Code Quality Metrics:</strong></p><ul><li>reduction in TypeScript type errors during development</li><li>adherence to architectural patterns</li><li>3x faster implementation of complex Canvas-based OCR overlay functionality</li></ul><p><strong>Learning Curve:</strong></p><ul><li>Junior developers onboarded to the codebase faster due to consistent patterns</li><li>Documentation requirements decreases as Copilot suggestions serve as self-documenting examples</li></ul><p><strong>Common Pitfalls:</strong></p><ul><li><strong>Overreliance on AI-generated Code</strong>: Assuming AI Agents can build anything flawlessly creates dangerous blind spots. I’ve learned to approach all generated code with appropriate verification procedures, particularly for security-critical components and complex business logic.</li><li><strong>Hallucination Management</strong>: AI hallucinations can cause serious consequences without rigorous review. In several instances, Copilot confidently generated references to non-existent APIs or fabricated library functions that appeared plausible but would fail at runtime.</li><li><strong>Instruction Quality Matters</strong>: Insufficient or imprecise instructions yield suboptimal outcomes. When my prompts lacked architectural specificity, the generated code often diverged significantly from established patterns, requiring extensive refactoring that negated productivity gains.</li></ul><h4>Some final thoughts</h4><p>By benchmarking against previous projects with similar complexity, I could isolate the impact of comprehensive instruction sets versus ad-hoc prompting. The results consistently demonstrated that well-structured instruction files transformed Copilot from a helpful code-completion tool into a true architectural alignment partner that understood established patterns and implementation standards.</p><p>The most profound shift in my development paradigm has been the evolution of my role from code implementer to solution architect. With Copilot Agent mode following my detailed instructions, I found myself operating more as a Product Owner/Architect than a traditional developer, defining patterns, establishing standards, and guiding implementation through carefully crafted prompts rather than manual coding. This partnership model, where I articulate architectural intent and Copilot materializes the implementation, represents a significant advancement in how we might conceptualize the modern development workflow.</p><p>For any team looking to maximize their efficiency with AI assistance, I highly recommend creating comprehensive instruction files that document your project’s unique approaches. The initial investment in documentation pays massive dividends in development speed, consistency, and code quality.</p><p>Have you tried using instruction files with GitHub Copilot? I’d love to hear about your experiences in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6186d332721b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zero to App — Single Codebase (Android, iOS, and Web) — Flutter Development Story]]></title>
            <link>https://hareeshbabu82.medium.com/zero-to-app-single-codebase-android-ios-and-web-flutter-development-story-866bb82835ce?source=rss-a6395136acde------2</link>
            <guid isPermaLink="false">https://medium.com/p/866bb82835ce</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Hareesh Polla]]></dc:creator>
            <pubDate>Sat, 13 Mar 2021 13:12:21 GMT</pubDate>
            <atom:updated>2021-03-13T13:12:21.499Z</atom:updated>
            <content:encoded><![CDATA[<h3>Zero to App — Single Codebase (Android, iOS, and Web) — Flutter Development Story</h3><p>Although this is not my first <strong>App development</strong>. But this is definitely a joyful moment to release an App for all major platforms like Android, iOS, and Web with a <strong>“<em>single codebase</em>”</strong>. I wanted to share my experience of the technologies used to achieve my goal.</p><p><strong>About the App:</strong> This app is developed for a Temple nearby as volunteer work, so that Temple Admins can publish current/recurring Events held at Temple along with email notifications on bookings.</p><p>The goal of this App is to provide a basic platform for the Temple management to publish few Events and remind or notify (occasionally) users of special events. For users, it will be easy to get registered and book events on desired dates. Also using emails for communication and confirmation.</p><p><strong>Whom this Article for?</strong> Developers who want to develop simple apps for personal or small-scale projects with zero/low-cost options. This article only talks about the choices and does not have any technical details or debates on why these are selected over other options.</p><p><strong>Disclaimer:</strong> As a sole developer working on it, I had more freedom in choosing the technologies and make quick decisions. This might not be possible/suitable for big projects with different departments involved. But can certainly be adopted with minor tweaks. Also, this is not built for commercial purposes and developed only with my free time, all my decisions are aimed at quick solutions and low-cost.</p><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*X9V7ni3qHW5gD3xI6G4XxA.png" /></figure><h3>Components</h3><h4>Firebase</h4><p>At its core, we need to decide how to manage the Server side of things like Database, User Management, Authentication, Access Contol, Server logic, Web Hosting, the list goes on… Enter Firebase.</p><p>Firebase provides all these and much more out of the box and can be started with a free tier and pay as you grow. I have been using Firebase for my personal projects too and I love that Google took it to the next level.</p><p><a href="https://firebase.google.com/">Firebase | Google&#39;s Mobile and Web App Development Platform</a></p><ul><li><strong>Cloud Firestore</strong> is the scalable NoSQL database that provides, push updates to the clients when data changed on the server. Firestore comes with a wide range of client/server libraries to interact with. Firestore has good data query and indexing capabilities for building blazing-fast UI.</li><li><strong>Cloud Storage</strong> is object storage to upload and host static content of the user, like images or documents.</li><li><strong>Hosting</strong> is a service to host the final built progressing web application over the internet.</li><li><strong>Cloud Functions</strong> are to write the server logic as individually executable Javascript functions over HTTPS without managing the servers. Firebase auto-scales these over Google’s infrastructure as per the demand on these functions.</li><li><strong>Security Rules</strong> are the way to control granular access to the resources like Files or database entries, to provide secure access over different interfaces.</li><li><strong>Authentication</strong> manages user registrations and password resets. Also, social logins like Google, Facebook, and Apple sign-in can be enabled.</li><li>Apart from the above, Firebase provides other services like Cloud Messaging for Push Notifications, Machine Learning, etc.</li></ul><h4>Flutter and Dart</h4><p>Before starting a line of code, one of the hard questions that need to be answered is how to develop an app for iOS, Android, and the Web. Especially they talk different languages. As there is a constraint on resources, it&#39;s hard to manage 3 different codebases iOS — Swift, Android — Java/Kotlin, and for Web — Javascript/NodeJS.</p><p>Flutter is a framework that provides the best cross-platform solution for all needed platforms and the best thing is that it uses Dart as a programming language for all. Dart is a super simple and Javascript-like language, but with Strong Type support and Null Safety.</p><p>Flutter is also a UI library with which we can compose beautiful and fluid UIs across the board. Best of all, Flutter has a great developer community and support on the net.</p><p><a href="https://flutter.dev/">Flutter - Build apps for any screen</a></p><p>All through the development of this App, I have been testing for iOS, the best thing about Flutter is it was very easy to port it to other platforms with minimal or no code changes.</p><p>I am glad that, right after releasing the app to AppStore and PlayStore, Flutter entered version 2, which brings Web support to the Stable channel and I have ported the App just with few steps for Web using Firebase Hosting.</p><h4>SendGrid</h4><p>Now for the communication between Temple management and Users, I have opted for SendGrid. Which provides client libraries for most platforms to send the emails.</p><p>With SendGrid, we can create <strong>Mail Templates </strong>for a specific purpose such as User registration templates or thanking mail on event booking. We can also pass variables to fill in the templates.</p><p>SendGrid also supports running <strong>Campaigns</strong> to send segmented emails for events.</p><p><a href="https://sendgrid.com/">Email Delivery, API, Marketing Service</a></p><h3>Build and Release</h3><ul><li>With the single source, the building of the App with Flutter just comes down to few adjustments for platform-specific tweaks like App Assets and Metadata. Flutter has consolidated the steps for <a href="https://flutter.dev/docs/deployment/android">Android</a>, <a href="https://flutter.dev/docs/deployment/ios">iOS</a>, and <a href="https://flutter.dev/docs/deployment/web">Web</a>, which is very useful.</li><li><strong>Assets</strong> like App Icons and Promo Images are a bit difficult for individuals, especially where there is no designing team. But with iPad Pro with Apple Pencil, apps like <a href="https://apps.apple.com/us/app/procreate/id425073498">Procreate</a> and <a href="https://apps.apple.com/us/app/affinity-designer/id1274090551">Affinity Designer</a>, and spending some time on <a href="https://www.udemy.com/">Udemy</a> for learning basics of Drawing, it&#39;s not too hard to produce them.</li><li>Another challenge before submitting the App to either store is to generate a lot of App Icons for various screen sizes. Where App Icon Generators will help a lot.</li></ul><p><a href="https://appicon.co/">App Icon Generator</a></p><ul><li>Finally submitting to app stores is just answering few details about the App and uploading the assets. Both App Store and Play Store have very easy interfaces for this and feel like a breeze.</li><li>For the web, we could use several options like <a href="https://firebase.google.com/docs/hosting">Firebase Hosting</a> or <a href="https://www.netlify.com/">Netlify</a>, which is just running few commands on the terminal.</li></ul><h3>App Links</h3><ul><li><a href="https://karumari-amman-temple-ca.web.app/">kat_events_flt</a></li><li><a href="https://apps.apple.com/ca/app/karumari-amman-temple-events/id1556149591">‎Karumari Amman Temple Events</a></li><li><a href="https://play.google.com/store/apps/details?id=io.terabits.kat.events">Karumari Amman Temple Events - Apps on Google Play</a></li></ul><h3>Conclusion</h3><p>Although there is much more that will go into the development, I have tried here to provide high-level details, which can help developers who are taking their first steps towards App Development or searching for backend options.</p><p>You can find me at:</p><p><a href="https://www.linkedin.com/in/hareeshbabu82/">Hareesh Polla - Senior SAP Technical Consultant - IBM | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=866bb82835ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes (K8S) Cluster with CI/CD pipeline — Infrastructure as Code]]></title>
            <link>https://hareeshbabu82.medium.com/kubernetes-k8s-cluster-with-ci-cd-pipeline-infrastructure-as-code-e2c76eaad3bf?source=rss-a6395136acde------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2c76eaad3bf</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[k3d]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[rancher]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Hareesh Polla]]></dc:creator>
            <pubDate>Sat, 13 Feb 2021 16:03:44 GMT</pubDate>
            <atom:updated>2021-02-13T16:03:44.033Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kubernetes (K8S) Cluster with CI/CD pipeline — Infrastructure as Code</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-rh5r89dP-n4WIH9CIzKzg.png" /></figure><p><strong>Kubernetes(k8s), DevOps, and CI/CD </strong>became buzz words and not limited to Big Clouds anymore. Thanks to projects like MicroK8S from Canonical, K3S from Rancher Labs (now part of SUSE), Kind, and MiniKube. These can be deployed on the development systems for learning and testing. Some support Production-ready High Availability Clusters setup on IoT/Edge devices.</p><p>This article is not a comparison between tools, rather as an individual developer, how can I build an environment to run a k8s cluster at home for running few applications or throw away clusters for learning. Also, the idea is to build on <strong>Infrastructure as Code</strong>, so that it is easy to re-build in case of failures.</p><p>I am using the following tools to achieve my goal:</p><ul><li><a href="https://rancher.com/docs/k3s/latest/en/quick-start/"><strong>k3s</strong></a> a fully compliant Kubernetes distribution</li><li><a href="https://k3d.io/"><strong>k3d</strong></a> a lightweight wrapper to run <strong>k3s</strong> in <strong>Docker</strong> for deploying the cluster</li><li><a href="https://www.ansible.com/"><strong>Ansible</strong></a> for setting up systems and building clusters as code</li><li><a href="https://www.drone.io/"><strong>drone.io</strong></a> for automating build, test, and deployment process as code</li><li><a href="http://slack.com/"><strong>slack.com</strong></a> incoming webhook for pipeline notifications</li><li><a href="https://www.docker.com/"><strong>Docker</strong></a> is the base of the whole container system</li><li><a href="https://rancher.com/products/rancher/"><strong>Rancher</strong></a> for a beautiful dashboard and managing k8s cluster</li></ul><p><strong>Who is this article for? </strong>For developers/individuals exploring options to build their own infrastructure end-to-end ( Development, Test, Deployment), for running few public-facing web applications and microservices for internal communications on Kubernetes.</p><p><strong>Where can I find the Code?</strong></p><p><a href="https://github.com/hareeshbabu82ns/k3d-cicd-demo">hareeshbabu82ns/k3d-cicd-demo</a></p><p><strong>What to expect in the Article?</strong> As a developer, learning constantly evolving technology can be daunting and I am on the trajectory of learning. The main goal of this article is to show a simple (may not be perfect or best) way of setting up the k8s cluster and run some personal applications on their own servers <strong>End-to-End</strong>, without relying on Cloud infrastructure. This article is not about explaining the concepts or advantages of one over the other.</p><p><strong>Prerequisites</strong>:</p><ul><li>Although, the code provided here is self-explanatory and a bunch of commands to execute in a shell. Basic knowledge of Kubernetes, Ansible, Docker, and k3d/k3s is recommended.</li><li>As I am trying to build a public-facing Server, a registered domain name is preferred. Could work with free domain registrars (but not tested).</li><li><strong>Domain for the site</strong>: I am using <strong>AWS Route53</strong> config to the domain name, for reference we call it “<strong>example.com</strong>”</li><li><strong>CNAME</strong> records for <strong>docker.</strong>example.com, <strong>drone.</strong>example.com, and <strong>*.uat.kube.</strong>example.com</li></ul><p><strong>System Config:</strong></p><ul><li>Either a Virtual Machine or Bare metal system</li><li>OS: Ubuntu 20.04 LTS Server x86_64</li><li>8G RAM</li><li>2 Cores</li><li>60G Hard Disk Space</li><li>Server Name: utmp, User: deploy</li><li>with SSH Server</li></ul><p><strong>Prepare the environment:</strong></p><ul><li>Copy SSH ID to the server, to log in remotely for Ansible, for more instructions click <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-20-04">here</a>.</li></ul><pre>$ ssh-copy-id deploy@utmp</pre><ul><li>Set up Ansible in the local system (other than Server) to execute commands, please find the steps for installing on ubuntu <a href="https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-ubuntu">here</a>.</li></ul><pre>$ sudo apt update<br>$ sudo apt install software-properties-common<br>$ sudo apt-add-repository --yes --update ppa:ansible/ansible<br>$ sudo apt install ansible</pre><ul><li>fork the repository to your namespace and git clone to the local system</li><li>create file vault.pass at project_folder/ansible with some super strong password for encrypting Ansible vault variables</li><li>create file vault.yml at project_folder/ansible/inventory/host_vars/utmp with all vault_* variables mentioned below to execute Ansible scripts</li><li>encrypt the vault.yml file to secure sensitive data</li></ul><pre>$ ansible-vault encrypt inventory/host_vars/utmp/vault.yml</pre><blockquote>Note: All <strong>ansible-* </strong>commands should be executed from project_folder/ansible</blockquote><p><strong>Prepare Variables: </strong><strong>vault.yml</strong></p><pre><em># password to execute shell commands as SUDO</em><br>vault_become_pass: deploy</pre><pre><em># root domain of your site (must be changed)</em><br>vault_root_domain: example.com</pre><pre><em># route53 config for the domain<br></em>vault_aws_dns_email: aws-user@gmail.com<br>vault_aws_r53_access_key_id: route53-access-id<br>vault_aws_r53_secret_access_key: route53-access-key</pre><pre><em># docker registry password for basic authentication<br></em>vault_docker_pass: sample-docker-pass</pre><pre><em># github auth for drone integration<br></em>vault_github_client_id: github-client-id<br>vault_github_client_secret: github-client-secret</pre><pre><em># drone API token from user settings (after drone setup step)<br></em># optional - script &#39;drone-secrets&#39; will try to fetch it from DB<br>vault_drone_api_key: drone-api-token</pre><pre><em># to securely connect between drone server and runner<br></em>vault_rpc_secret: some-random-pass</pre><pre><em># your github user id used in drone<br></em>vault_github_user: hareeshbabu82ns</pre><pre><em># Slack webhook settings<br></em>vault_pipeline_notifier: &quot;https://hooks.slack.com/services/T2../B0..&quot;<br>vault_pipeline_notifier_oauth: &quot;xoxb-7425...&quot;</pre><pre><em># k8s server url from `kubeconfig` (after cluster setup step)<br></em># optional - script &#39;drone-secrets&#39; will try to fetch it from k8s<br>vault_k8s_server: &quot;https://192.168.86.74:33333&quot;</pre><p><strong>Command Summary (Happy Path) to building the cluster:</strong></p><pre>$&gt; cd ansible <br>$&gt; echo &quot;some-password&quot; &gt; vault.pass </pre><pre><em># add vault variables</em> <br>$&gt; vi inventory/host_vars/utmp/vault.yml </pre><pre>$&gt; ansible-vault encrypt inventory/host_vars/utmp/vault.yml  </pre><pre>$&gt; ansible-playbook site.yml --tags &quot;prepare&quot; </pre><pre>$&gt; ansible-playbook site.yml --tags &quot;swag-up&quot; </pre><pre>$&gt; ansible-playbook site.yml --tags &quot;registry-up&quot; </pre><pre>$&gt; ansible-playbook site.yml --tags &quot;drone-up&quot;  </pre><pre><em># after login to drone ui at drone.example.com, make yourself admin</em> <br>$&gt; ansible-playbook site.yml --tags &quot;drone-admin&quot; </pre><pre>$&gt; ansible-playbook site.yml --tags &quot;drone-cli&quot;  </pre><pre><em># install k3d cluster</em> <br>$&gt; ansible-playbook site.yml --tags &quot;k3d&quot; </pre><pre>$&gt; watch kubectl get deployments -A  </pre><pre><em># (optional) helm charts</em> <br>$&gt; ansible-playbook site.yml --tags &quot;helms&quot;  </pre><pre><em># activate forked repo your_user/k3d-cicd-demo in drone ui</em><br><em># set drone secrets for the forked repo</em><br>$&gt; ansible-playbook site.yml --tags &quot;drone-secrets&quot;  </pre><pre><em># update and commit to master branch to start pipeline execution</em> </pre><pre><em># open app at https://rnginx.uat.kube.example.com</em></pre><p><strong>Project Structure:</strong></p><ul><li>ansible contains all code related to building infrastructure</li><li>— inventory contains hosts to connect to and variables to substitute in tasks</li><li>— roles contains task collection</li><li>— — tasks contains related tasks</li><li>— — — main.yml includes all tasks with tags, each task contains a sequence of steps to be performed on respective host</li><li>— — defaults contains role-specific variables</li><li>— — templates contains files to be parsed with runtime variables from vaults</li><li>— — vars contains role-specific encrypted variables</li><li>— ansible.cfg specifies where to look for vault password file, inventory, and roles</li><li>— site.yml contains the entry points to the scripts</li><li>react-nginx contains sample React web application to be deployed on Successful Pipeline execution</li><li>.drone.yml contains instructions to the Drone server/runner on how to build, test, deploy and notify using docker containers</li></ul><p><strong>Spills on Architecture</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-rh5r89dP-n4WIH9CIzKzg.png" /></figure><ul><li><strong>swag</strong> handles all HTTP/HTTPS traffic from the internet</li><li><strong>docker registry</strong> will act as a central place to push/pull docker images that we build as part of the CI/CD pipeline process</li><li>alternatively, the registry can be built right into the k3d cluster, but I chose to be out of the cluster so that it will be a source for all my clusters in IoT devices like Raspberry Pi.</li><li><strong>The drone server</strong> will handle/monitor changes to the source on GitHub/GitLab and schedule <strong>drone runners</strong> to perform actual task execution.</li><li><strong>drone runner</strong> uses docker containers to perform each step, this way it is not limited by the functionality as we can use community or custom Docker images to run the tasks.</li><li><strong>drone runner</strong> uses Docker-in-Docker to build docker images and push them to our private registry</li><li>finally, <strong>drone runner</strong> uses sinlead/drone-kubectl image to connect to our k3d cluster using the service account we created above and deploy apps</li><li>react-nginx/deployment-react-nginx.yaml contains the instructions to Deployment, Service, and Ingress to expose on k8s</li></ul><p><strong>Finally, Building the Cluster</strong></p><pre>$ ansible-playbook site.yml --tags &quot;prepare&quot;</pre><ul><li><strong>prepare </strong>script<strong>, </strong>updates server usingapt and installs Docker, kubectl, k3d tools along with required pip python-support libraries.</li></ul><pre>$ ansible-playbook site.yml --tags &quot;swag-up&quot;</pre><ul><li><strong>swag-up </strong>creates a docker container with Nginx reverse-proxy to route the external traffic to other docker containers or k8s cluster.</li><li>ansible/roles/swag/templates contains configuration options</li><li>— route53.ini to configure secrets of AWS Route53</li><li>— *.conf files are to provide additional routing for Nginx</li><li>— current.env contains environment variables for the docker container</li><li>— docker-compose.yaml contains instructions to start/stop the docker container</li><li>more config options can be found for swag <a href="https://docs.linuxserver.io/general/swag">here</a>.</li></ul><p><a href="https://docs.linuxserver.io/general/swag">SWAG setup</a></p><pre>$ ansible-playbook site.yml --tags &quot;registry-up&quot;</pre><ul><li><strong>registry-up</strong> creates a private docker registry with basic authentication</li><li>ansible/roles/registry/templates contains config options</li><li>— subdomain.confwjill be served to swag instance</li><li>a password will be served from vault_docker_pass variable</li></ul><pre>$ ansible-playbook site.yml --tags &quot;drone-up&quot;</pre><ul><li><strong>drone-up</strong> creates both drone server and drone runner containers with shared vault_rpc_secret variable</li><li>also used vault_github_client_id and vault_github_client_secret for authenticating/integrating Github webhooks to Continuous Integration</li><li>once the server container is up, we can visit <a href="https://drone.example.com/">https://drone.example.com</a> to give authentication with Github and sync projects</li></ul><p><a href="https://www.drone.io/">Drone CI - Automate Software Testing and Delivery</a></p><pre>$ ansible-playbook site.yml --tags &quot;drone-admin&quot;</pre><ul><li><strong>drone-admin</strong> makes current user configure in vault_github_user as admin, which will allow admin access on drone UI</li></ul><pre>$ ansible-playbook site.yml --tags &quot;drone-cli&quot;</pre><ul><li><strong>drone-cli</strong> installs drone utility binary to update secrets from the command line</li></ul><pre>$ ansible-playbook site.yml --tags &quot;k3d&quot;</pre><ul><li><strong>k3d</strong> script installs Kubernetes cluster using k3d</li><li>uses ansible/roles/k3d/master/templates/k3d-config.yaml to create k3d cluster</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsBW95r8SXNhrfVZTT3ozA.png" /><figcaption>k3d nodes after finishing the script</figcaption></figure><ul><li>creates cluster admin using service-account.yaml along with registy-secret for private docker registry</li><li>manifests folder contains Persistent Volume and Volume Claims for host folder to each k3s agent</li><li>installs Helm Charts binary and installs Certificate Manager and Rancher</li><li>$ watch kubectl get deployments -A to watch for deployment status</li><li>once the above step finished, we can visit <a href="https://rancher.uat.kube.example.com/">https://rancher.uat.kube.example.com</a> for further setup</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iag5qP49nefSzs7k-vNZTQ.png" /><figcaption>Rancher initialization</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rnP125sfgZOaE9podsKylw.png" /><figcaption>Rancher Dashboard</figcaption></figure><pre>$ ansible-playbook site.yml --tags &quot;helms&quot;</pre><ul><li><strong>helms</strong> script is <strong>optional</strong> and will install sample helms like heimdall and nginx , just for showing how we can use helms to install required apps to clusters</li><li>helm values can be configured from ansible/roles/k3d/helms/templates</li><li>can visit apps on <a href="https://heimdall.uat.kube.example.com/">https://heimdall.uat.kube.example.com</a> and <a href="https://nginx.uat.kube.example.com/">https://nginx.uat.kube.example.com</a></li></ul><p><strong>Setup Pipeline Notifier:</strong></p><ul><li>Pipeline notifier is just a webhook to a Slack channel</li><li>instructions to configure can be found <a href="https://api.slack.com/messaging/webhooks">here</a></li></ul><p><a href="https://api.slack.com/messaging/webhooks">Sending messages using incoming webhooks</a></p><ul><li>configure the values to vault variables</li><li>vault_pipeline_notifier — for webhook URL</li><li>vault_pipeline_notifier_oauth — app OAuth token</li></ul><p><strong>Setup CI/CD Pipeline using Drone:</strong></p><ul><li>activate the cloned project from <a href="https://drone.example.com/">https://drone.example.com</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T__Kf-OHV05e2DPLL0vWsA.png" /></figure><ul><li>Configure as Trusted project and point to .drone.yml file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K6k0Ff-4avYNgE5hFk5pIg.png" /></figure><ul><li>This is a good time to run the script to update project-specific Drone secrets</li></ul><blockquote>update git_repo variable in file ansible/roles/drone/tasks/main.yml to match the git repository name to set the secrets</blockquote><pre>$ ansible-playbook site.yml --tags &quot;drone-secrets&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bc91qIAgVPLpqbks9mP89w.png" /></figure><p><strong>Now, its time for executing our pipeline:</strong></p><ul><li>update some code in react-nginx/src/App.js</li><li>commit changes and push changes to the master branch to the forked repository</li><li>our Drone instance should automatically pick the push and start the pipeline</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVCLpYx6O5-VaYqiWBQgjA.png" /><figcaption>Drone repository build status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZRAt71wfa63nhh5qSOe7Qw.png" /><figcaption>Drone build steps</figcaption></figure><ul><li>When Pipeline finishes, it invokes the Slack webhook to notify</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hl1m7jMD3Ej5Gqrb1Z6ZLg.png" /></figure><ul><li>Finally, check the app deployed at <a href="https://rnginx.uat.kube.example.com/">https://rnginx.uat.kube.example.com</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*kBhtsXiX7tjpLc3IJnkllw.png" /><figcaption>Finally Deployed React App</figcaption></figure><h3>Conclusion</h3><p>As we can see here, with simple <strong>k3d </strong>configuration we can setup clusters and use <strong>drone.io</strong> to CI/CD. Ansible on top of all to provision Infrastructure as Code.</p><p>Its interesting to explore such options as it will be safe to developer build test clusters to deploy the apps while developing with out effecting Dev or UAT clusters which will effect whole team.</p><p>Although this is simple and scoped to a small usecase, I am confident with little collaboration within teams, it could be used for wider scenarios.</p><p>Thanks for reading, I would love to hear any comments or suggestions to improve.</p><p>You can find me at:</p><p><a href="https://www.linkedin.com/in/hareeshbabu82/">Hareesh Polla - Senior SAP Technical Consultant - IBM | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2c76eaad3bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL + SAP ABAP: The Inspiration]]></title>
            <link>https://hareeshbabu82.medium.com/graphql-sap-abap-the-inspiration-eb6d4f305681?source=rss-a6395136acde------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6d4f305681</guid>
            <category><![CDATA[sap]]></category>
            <category><![CDATA[crm]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Hareesh Polla]]></dc:creator>
            <pubDate>Thu, 30 May 2019 23:44:42 GMT</pubDate>
            <atom:updated>2019-09-12T23:04:52.836Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3TtezqVKyb6acGjb.png" /></figure><p>This two-part article will discuss details we need to know about the GraphQL implementation in SAP ABAP. How it was born, what it offers, and how to use it. As this is my first Blog ever and I am not an expert in either ABAP or GraphQL, the article may contain few mistakes. Also, this article is not designed to be a comparison of REST or OData vs GraphQL.</p><p><strong>Disclaimer</strong>: All proprietary names mentioned about SAP ABAP, SAP CRM, BOL/GenIL are copyrighted to SAP AG, I wrote only the GraphQL ABAP Server implementation and Exposing of BOL/GenIL as ABAP classes.</p><p>For those who look for keywords: SAP, ABAP, CRM, GraphQL, API. This article expects knowledge of SAP ABAP and GraphQL.</p><p>As part of Digital Transformation, we were looking for better ways to expose our existing data through new APIs which helps our development and maintenance times low. As an ABAP developer tried few ways to produce APIs out of SAP.</p><p>Earlier being <strong>ICF Services</strong> exposing data using ABAP to JSON converter utility classes created in-house. Which were bare minimum implementations of APIs that can be exposed out of SAP using <strong>SICF</strong>. Which is equivalent of <strong>Express Server</strong> in <strong>NodeJS</strong> world.</p><p>Although ICF services are quite powerful and provide total control over what can be sent over responses, we were still looking further for better options.</p><h3>GraphQL</h3><p>As I also work with NodeJS to develop Web Applications and Server-Side APIs, I have been following GraphQL from its earlier stages since Facebook has made it public and I am very much fascinated by the way GraphQL standardizes the access of our backend Relational Data.</p><p>Although this article is not in any way the introduction to GraphQL, I would like to just talk about a few features it brings to the table.</p><p>The quotes on <a href="https://graphql.org/">https://graphql.org</a> <strong>Describe your data</strong>, <strong>Ask for what you want</strong> and <strong>Get predictable results</strong> provides all there is to know about GraphQL in a nutshell.</p><p>One of the advantages I love about GraphQL is the ability to traverse through the relationships of our Data model. Which provides superpowers to the clients requesting data and puts totally in charge. This makes sense in the multi-platform world that A mobile App can choose to fetch fewer data from the same API endpoint as opposed to a Web Application which has more screen area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TMA0EltapJq7vvyS" /><figcaption>Request and Response to GraphQL Server (image taken from <a href="https://www.howtographql.com/">https://www.howtographql.com</a>)</figcaption></figure><p>Another advantage of GraphQL which simplifies API development and maintenance is that we can get rid of versioning APIs and maintaining several endpoints and flavors of the same domain data. As GraphQL provides <strong>Queries</strong> (Read), <strong>Mutations</strong> (Create, Update and Delete) and <strong>Subscriptions</strong> all under single endpoint, scaling and maintaining is much simpler. Instead of versioning API, GraphQL has the functionality to flag fields for <strong>Depreciation</strong> along with the reason. Adding new fields will not be affecting existing API unless clients request for it.</p><p>The GraphQL <strong>Type System</strong> will provide the <strong>Documentation</strong> by default so that the consumers are well aware of what to request and expect back from the Server.</p><p>As the popularity of GraphQL increases, so are the Tools and Libraries around it. The GraphQL community is really awesome and can find a lot of resources online for learning about it.</p><ul><li>The <strong>GraphiQL</strong> tool is one used to interact with GraphQL server and has several flavours to improve usability. GraphiQL provides auto-completion of queries and shows the documentation from Server.</li><li><a href="https://www.apollographql.com/"><strong>Apollo</strong></a><strong> and </strong><a href="https://facebook.github.io/relay/"><strong>Relay</strong></a><strong> </strong>libraries provide easy to integrate GraphQL into the development workflow</li></ul><h3>SAP ABAP</h3><p>As an SAP CRM technical consultant, I have been using ABAP all the time and I feel it is a very simple, elegant and Business like language.</p><p>One of the advantages of programming in SAP ABAP is it comes with a complete set of tools for developers End-to-End like IDE, Data Explorer, Versioning, Transport system and Debugging all in one place.</p><p>I would like to mention about <strong>SAP CRM</strong> module as well here, as my end goal is to expose CRM customer data as APIs. CRM has divided the functionality into Business Partners and One Order, which is already exposed to CRM UI with the help of <strong>BOL(Business Object Layer)/GenIL(Generic Interaction Layer)</strong>. My Idea is to leverage what has been working for several years and extend to expose as a GraphQL API.</p><p>If we look closely, BOL/GenIL has several similarities with GraphQL.</p><ul><li>BOL defines Advanced Search Entities which can be related to Query Types in GraphQL</li><li>Query Parameters can be converted as Arguments</li><li>Root Entities/ Result Entities can be related to Custom Types</li><li>Each attribute of the Entity can be exposed as Type fields</li><li>Each consequent relation can be considered as Related/Sub Types and can be resolved with getRelatedEntitie(s) function calls of GenIL</li><li>Data Element values or Value Tables for each BOL field can be converted as Enum</li><li>Last but not least, GenIL Create Entity, Update Entity and Delete Entities can be mapped to Mutations</li></ul><p>This view of mapping from BOL/GenIL to GraphQL compelled me to invest more time in building the GraphQL server to expose as a unified interface into SAP CRM.</p><p>Initially, I have started to implement GraphQL in NodeJS and call custom REST endpoints into SAP. Even though this approach allowed me to build an initial Proof of concept. I am not convinced that simply calling REST endpoints behind GraphQL NodeJS implementation and applying filters outside SAP, is a huge task and we can not fully leverage features BOL/GenIL. I feel that it&#39;s just a hack to expose data from SAP.</p><p>I have started looking into GraphQL implementation in ABAP and failed to find one at the time I started building one myself (around Jan 2018). I took the code of Java implementation as a reference in building GraphQL server within ABAP. There has to be a lot of adjustments and sacrifices in porting the Java code to ABAP, as ABAP OOPs is slightly different and I need to strip out Threading as our SAP ICM(Internet Communication Manager) will manage this for us at the request level. Also changed the implementation to work with the idea of loading config from tables instead of Schema files in Java.</p><p>Once the GraphQL server is built and ready in ABAP, It was easy to expose BOL/GenIL to the server as reading from Config tables already available in SAP CRM.</p><p>Enough of the story, we shall now dive into technical stuff in this <a href="https://medium.com/@hareeshbabu82/graphql-sap-abap-demo-and-technical-details-92a511ed8e4a">second part</a> of the Article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb6d4f305681" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL + SAP ABAP: Demo and Technical Details]]></title>
            <link>https://hareeshbabu82.medium.com/graphql-sap-abap-demo-and-technical-details-92a511ed8e4a?source=rss-a6395136acde------2</link>
            <guid isPermaLink="false">https://medium.com/p/92a511ed8e4a</guid>
            <category><![CDATA[abap]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[sap]]></category>
            <dc:creator><![CDATA[Hareesh Polla]]></dc:creator>
            <pubDate>Thu, 30 May 2019 23:42:23 GMT</pubDate>
            <atom:updated>2020-03-23T03:35:24.309Z</atom:updated>
            <content:encoded><![CDATA[<h3>GraphQL + SAP ABAP: Architecture and Technical Details</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*3TtezqVKyb6acGjb.png" /></figure><p>This article is the second in series, explains the technical details and includes few screenshots to give a preview. If you want to read some background and boring stuff, is covered in the <a href="https://medium.com/@hareeshbabu82/graphql-sap-abap-the-inspiration-eb6d4f305681">first part</a>.</p><p>Before going to the details, a few product vision key features I have considered.</p><ul><li>Leverage what SAP/ABAP has to offer most. ex. ICM, OOPs</li><li>Modularize the implementation</li><li>Independent JSON converters</li><li>GraphQL Service Handler knows nothing about the schema</li><li>Resolvers can be independent of Schema generation logic</li><li>BOL Resolvers to generate Dynamic schema and resolve all CRUD operations using GENIL operations</li><li>Schema can be saved to Database Tables to be re-loaded/configured manually</li><li>SAP Sessions to improve performance with BOL and retaining Schema across requests</li><li>Testable Code and ABAP Test Scripts for code coverage</li></ul><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hXf-7ko61R-1tGlrq8SQag.png" /><figcaption>Architecture Diagram</figcaption></figure><ul><li>GraphQL server is exposed as an ICF service from ABAP, which accepts and provides JSON data</li><li>ICF handler class takes JSON string and convert to ABAP GraphQL Schema classes and validated</li><li>Schema is built only for the first time if the Session is enabled</li><li>The user input Query will be parsed and the Execution Context is created</li><li>Resolver class will be called for individual resolver identifications</li><li>Resolver will either go to BOL/GenIL or APIs or can directly talk to DB to fetch data</li><li>Data will be submitted back to ExecutionContext as JSON classes</li><li>Finally, JSON classes will be validated and converted to JSON string as ICF service response</li></ul><h3>Accessing the API</h3><p>Note: currently this is under active development, watch this space for updates and code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MIRC8H6cqontCMlI21RB8A.png" /><figcaption>MYSAPSS2 token for authentication</figcaption></figure><p>Follows standard SAP authorization like MYSAPSSO2 header/cookie in the Request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csa7o63VYxwTxKXaZWpZcw.png" /><figcaption>API Documentation</figcaption></figure><p>GraphQL API provides API documentation by default and can be accessed using Schema Queries. Which will provide information to frontend team to browse through the contract to know what fields/operations are supported by the API</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVqoyX-3tuKvu22aX1XSgQ.png" /><figcaption>Queries — using BP Advanced Search</figcaption></figure><p>Query is the way to get some data from API, which is same as HTTP “GET” operations. Query can have Arguments which will help filter the results from the API. Query should end with requesting necessary field by the UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHk_oltACDwf1ZObcU_zXQ.png" /><figcaption>BP Advanced Search Results</figcaption></figure><p>Here we can see the Results as sent back from API, which exactly matches the Requested 4 fields from the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aptQ7L5WELIa1sNSAOlo3w.png" /><figcaption>Mutations — Creating BP with Deep Data</figcaption></figure><p>Mutations are a way to change some data on the server. Here we are creating a BP along with the child relations like Address and Marketing Attributes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OG1cStNfQoIeIaReHCIaGw.png" /><figcaption>Mutations — Creating Child data of BP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PUZuQGxmWzvwJdFdix_JnQ.png" /><figcaption>Mutations — Updates and Deletes</figcaption></figure><h3>At a Glance</h3><h4>Packages</h4><ul><li>ZGRAPHQL — Main Package</li><li>ZGRAPHQL_LANG — contains all the Language/Schema Implementation classes</li><li>ZGRAPHQL_API — contains base Service classes to expose CRM data as API</li><li>ZGRAPHQL_CORE — Base Server Classes</li></ul><h4>Message Class — ZGRAPHQL</h4><h4>Important Classes</h4><p><strong>ZGQLSCL_SCHEMA</strong></p><ul><li>responsible for creating the GraphQL Schema (Type System)</li><li>can create either from Internal Tables or from Database Tables</li><li>Validates and Creates Schema Object</li><li>loads all required components into Memory</li><li>Builds Introspection Resolver and Holds User Resolver</li></ul><p><strong>ZGQLCL_API_SERVICE_BASE</strong></p><ul><li>Base SICF handler class to handle basic functionality of the GraphQL server</li><li>All Sub-classes are only expected to provide Schema from PREPARE_SCHEMA method</li></ul><p><strong>ZGQLCL_TABLES_RESOLVER</strong></p><ul><li>which builds Schama using given ABAP table names</li></ul><p><strong>ZGQLCL_BUIL_GENIL_RESOLVER</strong></p><ul><li>Class to resolve all Business Partner related BOL operations</li><li><strong>ZGQLCL_BUIL_CUST_RESOLVER</strong> is a specialization which allows restricting</li><li>BOL entities and Relationships exposed</li><li>Mapping for the Relationship names</li></ul><p><strong>ZGQLSIF_RESOLVER</strong></p><ul><li>Resolver to provide links to Operation and Data</li><li>All Implementation classes must provide</li><li>Schema to be initiated</li><li>Resolving Method for each Operation</li></ul><p><strong>ZGQLSCL_INTROSPEC_RESOLVER</strong></p><ul><li>responsible for resolving Schema Introspection queries</li></ul><p><strong>ZCX_GQL_EXCEPTION</strong></p><ul><li>Base Exception class available globally to throw Errors</li><li>The server automatically handles this error and passes to Client as <strong>“errors”</strong> array in response</li><li>can handle BOL errors and BAPI errors</li></ul><p><strong>ZGQLCL_EXECUTION_CONTEXT</strong></p><ul><li>the class is responsible for keeping the current Context until the end of the operation execution</li><li>Validates the current Operation submitted by Client before starting the execution</li><li>holds Schema, Operation currently being executed, Selections requested by Client</li></ul><p><strong>ZGQLCL_EXECUTOR</strong></p><ul><li>the class is responsible for executing Query, Mutations and handle Errors</li></ul><ol><li>EXECUTE_QUERY</li></ol><ul><li>the method resolves Query operations</li></ul><p>2. EXECUTE_MUTATION</p><ul><li>the method performs Mutation (update) operations</li></ul><p>3. EXECUTE_SELECTION_SET</p><ul><li>method to resolve each field requested by the Client</li><li>recursively resolves each Custom Type until it reaches Leaf Nodes</li></ul><p><strong>ZGQLCL_LOG</strong></p><ul><li>used for logging the requests to the GraphQL server</li><li>logs Request Operations, Response Errors</li><li>Transaction: SLG0, Object — ZGRAPHQL, Sub Object — ZGQL_GEN</li></ul><p><strong>ZGQLCL_UTILS</strong></p><ul><li>utility functions for reading AppSet Entries and Domain Values</li></ul><p>The benefits I observe from this approach are:</p><ul><li>Higher Abstraction of the API Implementation</li><li>Easy Integration using widely popular toolchain on UI running outside SAP</li><li>Above all, Performance can be tweaked within SAP as we run the logic near Database</li></ul><p>Even though I started this as an exploring project not knowing if I could finish it on my own or not, spending my evenings and holidays, After seeing the final result, I requested my Manager to spend some time for a small Demo.</p><p>Having no expectations, with the CRM experience my Manager immediately identified the potential of this solution and the advantages our Organization can get in exposing CRM data using GraphQL. With his support, I have managed to present to higher management.</p><p>And today we are experimenting and building unified enterprise-level services for multiple Web Applications with minimal friction and with High performance. The feedback from the Web developers is that ‘Fast development times, Ease of use and more options in choosing client libraries’.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92a511ed8e4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>