<?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 Teja Magapu on Medium]]></title>
        <description><![CDATA[Stories by Teja Magapu on Medium]]></description>
        <link>https://medium.com/@magaputeja?source=rss-df7492bc4cd8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tddFjtBDsLpVh9BGDA40GQ@2x.jpeg</url>
            <title>Stories by Teja Magapu on Medium</title>
            <link>https://medium.com/@magaputeja?source=rss-df7492bc4cd8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:43:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@magaputeja/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[CI/CD Pipeline for your Python Django Application Using Google Cloud]]></title>
            <link>https://medium.com/@magaputeja/ci-cd-pipeline-for-your-python-django-application-using-google-cloud-d5c636ce48f3?source=rss-df7492bc4cd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5c636ce48f3</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Teja Magapu]]></dc:creator>
            <pubDate>Thu, 19 Dec 2019 18:55:55 GMT</pubDate>
            <atom:updated>2019-12-19T19:01:36.909Z</atom:updated>
            <content:encoded><![CDATA[<p>Cloud infrastructure is one of those hot buzzwords we hear from techies everywhere. Here’s a simple introduction to setting up a CI/CD pipeline for your application using Google Cloud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x61oweaDbFIhFHq_.png" /><figcaption>Google Cloud and its various services</figcaption></figure><h3>Intro to CI/CD</h3><p>CI/CD stands for Continuous Integration Continuous Deployment. CI is the portion which is relevant to developers making constant code changes and pushes to their application/product. CD is relevant to the constant “roll-out” or deployment of the application. The beauty of CI/CD is that we can see our application change in real-time, and before it gets to a production environment, we can run necessary tests on it to make sure it is “healthy” enough to release. Common strategies include having a pipeline set up to deploy to a Development Environment before going to a QA environment, before finally going to a Production environment.</p><p>Many Cloud providers exist in today’s day and age. Some of the most popular ones are Amazon Web Services (AWS), Microsoft Azure, and Google Cloud. I personally went with Google Cloud as it gave me $300 in free credits as well as smoother integration with the cloud architecture I was going for.</p><h3>Initial Setup</h3><p>There are a few steps to be taken prior to get rolling with our CI/CD pipeline. We must set up our environment first. I won’t go over some of the simple stuff such as logging in to your google account to get started with Google Cloud as that is rather straightforward, but I will go over everything else relevant to setting ourselves up.</p><p>For starters, make sure you have Git and Docker installed on your machine. Both are free and relatively easy to use. Next, install the Google Cloud SDK here: <a href="https://cloud.google.com/sdk/docs/quickstarts">https://cloud.google.com/sdk/docs/quickstarts</a>.</p><p>After this we can easily get google cloud going locally on our terminal by running:</p><pre>./google-cloud-sdk/install.sh<br>gcloud init<br>gcloud config set accessibility/screen_reader true</pre><p>(I’ve added this as a script in my code as well)</p><p>A few steps that the user will have to make will be creating a project on the Google Cloud console, and cloning their git repository into the project. We need to only do this initially, after that the pipeline will take care of everything.</p><p>Luckily, we have good documentation from Google when it comes to all things cloud related. However, I did them one better by scripting out the initial setup. This script does everything relevant to setting up docker authentication on Google, all the way up to containerizing our application, running the docker image, and deploying it using Kubernetes. Here is a look at the script, just change the variables to match yours and it should run perfectly.</p><pre>#!/bin/sh</pre><pre>set -xe</pre><pre>PROJECT_ID = &quot;security-privacy&quot;<br>COMPUTE_ENGINE_ZONE = &quot;us-east1&quot;<br>CLUSTER_NAME = &quot;sec-privacy-cluster&quot;</pre><pre>docker build -t gcr.io/${PROJECT_ID}/dev:v1 . </pre><pre>docker images</pre><pre>gcloud auth configure-docker</pre><pre>docker push gcr.io/${PROJECT_ID}/dev:v1</pre><pre>docker run --rm -p 8080:8080 gcr.io/${PROJECT_ID}/dev:v1</pre><pre>gcloud config set project security-privacy</pre><pre>gcloud config set compute/zone us-east1</pre><pre>gcloud container clusters create sec-privacy-cluster --num-nodes=2 </pre><pre>gcloud compute instances list kubectl create deployment sec-privacy-cluster --image=gcr.io/${PROJECT_ID}/dev:v1</pre><pre>kubectl get pods kubectl expose deployment sec-privacy-cluster --type=LoadBalancer --port 80 --target-port 8080</pre><p>Upon successful completion of this script, we should see something like this to confirm our Kubernetes cluster has been created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MfGBoc2uOuNyq8wM" /><figcaption>Successful Creation of Kubernetes Cluster</figcaption></figure><h3>CI/CD Pipeline Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojWYK_6-isiIRv_9FUQmXg.png" /><figcaption>CI/CD pipeline architecture</figcaption></figure><p>This is the CI/CD pipeline architecture I went with. I used all relevant services that Google Cloud had to offer. I will go over all configurations, but in short, what essentially is happening here is that I configured Google Cloud’s code build to trigger every time there was a push to my repository on github. On code build I set it up so that my Dockerfile would be run and an image would be built and pushed. After this is successfully completed, the Kubernetes Engine would pick up the docker image and deploy it.</p><p>It’s alright if it takes a few attempts to get code build working. I played around with using Dockerfile versus a codebuild.yaml file, which is what resulted in a few unsuccessful builds, but generally it should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HetxdrqiiqtM5kcXIsEhIw.png" /><figcaption>Google Cloud Build</figcaption></figure><p>On the left hand side where it says “triggers”, we can do a whole bunch of things. We can tell it which branch to pick up from, if it should trigger only on pull request, and so on. I think a more professional CI/CD pipeline is one with a well defined codebuild.yml file which runs a bunch of health checks, such as making sure our environment is good, our tests pass, our code is well formatted, running a dockerfile, and so on. For the sake of the simple web application I wrote however, a Dockerfile sufficed. Here is what my configuration for triggers looks like. As you can see it is linked to my github repository and runs the Dockerfile</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fPRlb2MnKBWciCfmS0p-7g.png" /><figcaption>Cloud Build Trigger</figcaption></figure><p>The beautiful thing about Google Cloud’s Cloud Build is that it logs everything every time it is triggered to build. Here is what a successful build looks like, with the docker image being built and shown in the logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DGrXfWgWMMwolj_85m_FFA.png" /><figcaption>Code Build logging Docker Image</figcaption></figure><p>For those using Django, here is the the Dockerfile I wrote. It is very straightforward and applicable to nearly any Django application:</p><pre>FROM python:3</pre><pre>ENV PYTHONUNBUFFERED 1</pre><pre>RUN mkdir /code</pre><pre>WORKDIR /code</pre><pre>COPY requirements.txt /code/</pre><pre>RUN pip install -r requirements.txt</pre><pre>COPY . /code/</pre><pre>EXPOSE 8080</pre><pre>CMD [ &quot;python3&quot;, &quot;manage.py&quot;, &quot;migrate&quot;]<br>CMD [&quot;python3&quot;, &quot;manage.py&quot;, &quot;runserver&quot;]</pre><p>We can do a sanity check to make sure that our Docker image is on Google Cloud’s Container Registry simply by navigating to their container registry on the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LpmbsF0-jTMb5Lf7tyfRyQ.png" /><figcaption>Google Container Registry</figcaption></figure><p>As is customary for any cloud service, we can see all of these builds, images, and services via the command line interface since we have the Google Cloud SDK installed. However for this tutorial I will include screenshots from the Google Cloud Console, for the sake of simplicity.</p><p>The ultimate check to confirm we have done everything correctly is to simply go to the Google Kubernetes Engine. This will give us all the details about our cluster and if it has picked up our Docker image properly for deployment. At this point we should see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*anCv21Gu6AEov_UcIRqQYQ.png" /><figcaption>Google Kubernetes Engine</figcaption></figure><p>We can see under summary that the cluster is deploying: dev: gcr.io/security-privacy/dev:v1 — which is my desired docker image.</p><p>Upon committing any code, our newest docker image will continue to be deployed, thanks to Google Code Build.</p><p>At this point if you have no interest in configuring DNS settings and certificate authority (as I had done) clicking on that endpoint should take you to your application.</p><h3>Troubleshooting and Improvements</h3><p>A very obvious improvement I would make would be to create a codebuild.yaml file. I would probably flesh out a comprehensive test suite prior to the docker image being pushed. Additionally, I would also create a docker-compose file, as it is a better practice. I tried to do this but I did not successfully deploy my application with it. Ultimately it depends on what you the user wants. I went through multiple tutorials over the course of the last 3–4 months, and I found that doing this was best for me and my application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5c636ce48f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Russell Westbrook Effect]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/the-russell-westbrook-effect-7782b54bb860?source=rss-df7492bc4cd8------2"><img src="https://cdn-images-1.medium.com/max/1150/1*010Zeea_yo1zhfwFUX82_Q.png" width="1150"></a></p><p class="medium-feed-snippet">For 3 straight seasons he averaged a triple double in Oklahoma City. While the regular season numbers were stupendous, it didn&#x2019;t translate&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/the-russell-westbrook-effect-7782b54bb860?source=rss-df7492bc4cd8------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/the-russell-westbrook-effect-7782b54bb860?source=rss-df7492bc4cd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7782b54bb860</guid>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[basketball]]></category>
            <category><![CDATA[sports-analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Teja Magapu]]></dc:creator>
            <pubDate>Sat, 30 Nov 2019 00:59:41 GMT</pubDate>
            <atom:updated>2021-08-09T14:04:04.632Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Observations from Celtics vs. Clippers 11/20]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/observations-from-celtics-vs-clippers-11-20-baa284112434?source=rss-df7492bc4cd8------2"><img src="https://cdn-images-1.medium.com/max/600/1*NWEE5CpPc3WHdIhPm8OpAw.png" width="600"></a></p><p class="medium-feed-snippet">After a summer full of player movement and roster shuffling, one which we followed intensely, what exactly is going on here? Some of my&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/observations-from-celtics-vs-clippers-11-20-baa284112434?source=rss-df7492bc4cd8------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/observations-from-celtics-vs-clippers-11-20-baa284112434?source=rss-df7492bc4cd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/baa284112434</guid>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Teja Magapu]]></dc:creator>
            <pubDate>Sun, 24 Nov 2019 03:50:46 GMT</pubDate>
            <atom:updated>2021-08-09T14:05:57.089Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What the numbers tell us about a “Kawhi Effect”]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/what-the-numbers-tell-us-about-a-kawhi-effect-2f48fbdb7a1?source=rss-df7492bc4cd8------2"><img src="https://cdn-images-1.medium.com/max/640/1*B2iVS6P_5VEIBUoCNTJGZg.png" width="640"></a></p><p class="medium-feed-snippet">First he took down the King and ended the Miami Heat Dynasty. Then he ended the Golden State Warriors Dynasty in the Bay. We look at the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/what-the-numbers-tell-us-about-a-kawhi-effect-2f48fbdb7a1?source=rss-df7492bc4cd8------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/what-the-numbers-tell-us-about-a-kawhi-effect-2f48fbdb7a1?source=rss-df7492bc4cd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f48fbdb7a1</guid>
            <category><![CDATA[clippers]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Teja Magapu]]></dc:creator>
            <pubDate>Fri, 26 Jul 2019 04:29:01 GMT</pubDate>
            <atom:updated>2021-08-09T14:06:29.913Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Data Driven Analysis of the Kemba-Kyrie “swap”]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/a-data-driven-analysis-of-the-kemba-kyrie-swap-24241f136d29?source=rss-df7492bc4cd8------2"><img src="https://cdn-images-1.medium.com/max/640/1*oTcIQCUzik3hHXYyFefAUA.png" width="640"></a></p><p class="medium-feed-snippet">This NBA off-season was a firework of movements across the league. It seems like ages ago now that Kyrie Irving left town for Brooklyn to&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/a-data-driven-analysis-of-the-kemba-kyrie-swap-24241f136d29?source=rss-df7492bc4cd8------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/a-data-driven-analysis-of-the-kemba-kyrie-swap-24241f136d29?source=rss-df7492bc4cd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/24241f136d29</guid>
            <category><![CDATA[charlotte-hornets]]></category>
            <category><![CDATA[boston-celtics]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Teja Magapu]]></dc:creator>
            <pubDate>Tue, 16 Jul 2019 17:55:46 GMT</pubDate>
            <atom:updated>2021-08-09T14:05:35.670Z</atom:updated>
        </item>
    </channel>
</rss>