<?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 Tushar Rajpoot on Medium]]></title>
        <description><![CDATA[Stories by Tushar Rajpoot on Medium]]></description>
        <link>https://medium.com/@tush-tr?source=rss-58248ce70cbd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DDGfhMBwRimmZSH-uCSVjQ.jpeg</url>
            <title>Stories by Tushar Rajpoot on Medium</title>
            <link>https://medium.com/@tush-tr?source=rss-58248ce70cbd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:25:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tush-tr/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[New Post]]></title>
            <link>https://tush-tr.medium.com/new-post-12caaf1f7bd2?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/12caaf1f7bd2</guid>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[hashnode]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 16:05:00 GMT</pubDate>
            <atom:updated>2025-02-24T16:05:00.606Z</atom:updated>
            <content:encoded><![CDATA[<p>Test content</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12caaf1f7bd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with ArgoCD]]></title>
            <link>https://tush-tr.medium.com/getting-started-with-argocd-89f76155fe6c?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/89f76155fe6c</guid>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Sat, 01 Jul 2023 11:16:10 GMT</pubDate>
            <atom:updated>2023-07-01T11:16:10.061Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Is Argo CD?</h3><ul><li>Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes.</li><li>It follows gitOps principles to deploy your application.</li><li>It works like an agent installed on your Kubernetes cluster.</li><li>It works on the pull deployment model.</li></ul><h3>Push Deployment vs Pull Deployment</h3><ul><li>Push deployment is what you do in your CI/CD pipelines that you define using Jenkins/Github Actions/Gitlab CICD/Circle CI.</li><li>When you define your CICD pipeline using push deployment what you do is, you add steps to build, test your application and deploy it to Kubernetes.</li><li>You add your CD steps also in your CICD pipeline and you need to configure secrets and credentials for your k8s cluster, aws/GCP in your pipeline.</li><li>But if you use pull deployment, you don’t need to add your CD steps in your pipeline instead you can use ArgoCD.</li><li>You just need to install argocd on your kubernetes cluster and create an application using argocd and map it to your github repository(Where you have your kubernetes configuration files).</li><li>ArgoCD works like an agent installed on your k8s cluster that works on pull deployment, checks your configuration files from your git repo and always match your desired state with actual state.</li><li>If it finds any difference, it makes changes required to match your desired state with actual state.</li><li>It provides an amazing UI where you can create, monitor your k8s deployments and configurations.</li></ul><h3>Why ArgoCD?</h3><p>Application definitions, configurations, and environments should be declarative and version controlled. Application deployment and lifecycle management should be automated, auditable, and easy to understand.</p><h3>Steps to get started with ArgoCD</h3><h3>1. Install argocd on your kubernetes cluster.</h3><ul><li>For cluster, you can use minikube cluster for getting started.</li><li>kubectl create namespace argocd kubectl apply -n argocd -f <a href="https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml">https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml</a></li><li>Now if you check services in argocd namespace, you will see a service (ClusterIP) named argocd-server.</li><li>To access argocd-server you port-forward your clusterIP service to 8080 port</li><li>kubectl port-forward svc/argocd-server -n argocd 8080:443</li><li>Now you access your argocd server on localhost:8080</li><li>To login into your argocd server you can use credentials from your kubernetes namespace.</li></ul><h3>2. Create application on argocd and map to Git repo</h3><h3>3. Check application deployment</h3><p><em>Originally published at </em><a href="https://tusharrajpoot.hashnode.dev/getting-started-with-argocd"><em>https://tusharrajpoot.hashnode.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89f76155fe6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is hashicorp vault?]]></title>
            <link>https://tush-tr.medium.com/what-is-hashicorp-vault-a1a4f3f08d86?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1a4f3f08d86</guid>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Sun, 26 Feb 2023 06:02:25 GMT</pubDate>
            <atom:updated>2023-02-26T06:02:25.150Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s a cloud-agnostic secrets management system.</p><p>API-driven</p><p>It allows you to safely store and manage sensitive data in hybrid cloud environments</p><p>Used to generate dynamic short-lived credentials, or encrypt application data on the fly.</p><p>What is a secret?</p><p>Usernames and passwords</p><p>Certificates</p><p>SSH Keys</p><p>API keys</p><p>Encryption keys</p><p>What problems does vault solve?</p><p>Secrets sprawl</p><p>Below are some common places where secrets get stored:</p><p>On a developer’s computer in excel or notepad files</p><p>Hard-coded into the source code.</p><p>On a sticky note under an engineer’s keyboard</p><p>In a version control system such as GitHub and sometimes exposed publicly.</p><p>Vault use cases</p><p>Secrets management</p><p>Centrally store, access, and distribute secrets.</p><p>Encrypting application data</p><p>Keep application data secure with centralized key management</p><p>Identity-based Access</p><p>Authenticate and access different clouds, systems, and endpoints using trusted identities.</p><p>Secret management</p><p>KV Secrets Engine</p><p>The idea is to share between the client and the vault. (A client could be a person, user, or application)</p><p>The client makes a call to the vault with a specific path(In the vault everything is path based)</p><p>Vault checks its policy for authorizing the client to share the secrets.</p><p>Encrypting Application Data</p><p>Vault provides an EAAS(Encryption as a service), also called a transit secrets engine inside the vault.</p><p>So after encrypting the application data using a vault, now the web server can use or store that data in a database for the next use cases.</p><p>Vault will not store data, only pass it back to requesting client.</p><p>Basic Vault CLI commands</p><p>Vault by itself will give you a list of many Vault CLI commands.(starts with common ones)</p><p>$ vault</p><p>$ vault version # tells the version of vault</p><p>$ vault read # used to read secrets from vault</p><p>$ vault write #used to write secrets to vault</p><p>$ vault write -h # -h, -help and – help flags can be added to get help for any vault CLI command.</p><p>Vault Server Modes</p><p>Vault servers can be run in two different modes:</p><p>Dev mode that is only intended for development.</p><p>It’s not secure</p><p>It stores everything in memory</p><p>The vault is automatically unsealed</p><p>The root token can be specified before launching</p><p>$ vault server -dev -h # for help on this command</p><p>$ vault server -dev -dev-root-token-id=root</p><p># checking the status of our vault server</p><p>$ vault status</p><p>Never store actual secrets on a server run in “Dev” mode.</p><p>Prod mode that can be used in QA and production</p><p>Interacting with vault</p><p>$ vault kv -h</p><p>Adding secrets:</p><p>$ vault kv put secret/foo bar=baz</p><p>updating the secret</p><p>$ vault kv put secret/foo bar=baz hello=world</p><p># now you will see version=2</p><p>Reading the secret</p><p>$ vault kv get secret/foo</p><p># we will get the latest version</p><p>Deleting a secret</p><p>$ vault kv delete secret/foo</p><p># secret latest version will be deleted for specific version deletion use this flag</p><p>$ vault kv delete -versions=2 secret/foo</p><p># for storing back our secret use this command</p><p>$ vault kv undelete -versions=2 secret/foo</p><p>Destroying the secret permanently</p><p>$ vault kv destroy -versions=2 secret/foo</p><p>Seal and unseal concept</p><p>Vault starts up in a sealed state.</p><p>Vault can access the physical storage, but can’t decrypt it.</p><p>No operations are possible with the vault except to unseal the vault and check its status of the vault.</p><p>Vault data is encrypted using the encryption key in the keyring; the keyring is encrypted by the master key; and the master key is encrypted by the unsealed key.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1a4f3f08d86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intro to TypeScript]]></title>
            <link>https://tush-tr.medium.com/intro-to-typescript-61652095c55?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/61652095c55</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Sat, 24 Sep 2022 02:43:17 GMT</pubDate>
            <atom:updated>2022-09-24T02:43:17.215Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1aeMusarJbaErWEAe5YWWg.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FM5-eshJQE1g%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DM5-eshJQE1g&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FM5-eshJQE1g%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/03701fca1ad22422c246874328abd9e7/href">https://medium.com/media/03701fca1ad22422c246874328abd9e7/href</a></iframe><h3>What is TypeScript?</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FM5-eshJQE1g%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DM5-eshJQE1g&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FM5-eshJQE1g%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/03701fca1ad22422c246874328abd9e7/href">https://medium.com/media/03701fca1ad22422c246874328abd9e7/href</a></iframe><ul><li>A JavaScript SuperSet.</li><li>A language building upon JavaScript.</li><li>Adds new features and advantages to JavaScript.</li><li>Disadvantage: TypeScript can’t be executed in JS runtimes like Browsers, nodejs.</li><li>TypeScript is a programming language, but it’s a tool, it’s a compiler that compiles our TypeScript code to JavaScript code. We only write TypeScript code, that will be compiled into JavaScript code.</li><li>TS Compiles features to JS “workaround”, possible errors are thrown.</li><li>TypeScript adds types to JavaScript.</li></ul><pre>function add(num1,num2){<br>    return num1+num2;<br>}<br>console.log(add(&#39;2&#39;,&#39;3&#39;))</pre><ul><li>The above code will have unwanted behavior at runtime</li><li>Mitigation Strategies: Add if check to add function validate &amp; sanitize user input.</li></ul><h3>Installing TypeScript</h3><pre>npm i -g typescript</pre><h3>TypeScript Advantages</h3><p>TypeScript adds:</p><ul><li>Types</li><li>Next-gen JavaScript Features(compiled down for older browsers)</li><li>Non-JS features like interfaces or generics</li><li>Meta-Programming Features like Decorators</li><li>Rich configuration options</li><li>Modern tooling that helps even in non-typescript projects</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61652095c55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Networking Visualized]]></title>
            <link>https://tush-tr.medium.com/kubernetes-networking-visualized-6256bd80120e?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/6256bd80120e</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Fri, 16 Sep 2022 16:53:16 GMT</pubDate>
            <atom:updated>2022-09-16T16:53:16.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQQSViWiDkh1X81r3n99Qw.png" /></figure><h3>Kubernetes Networking addresses four concerns:</h3><ol><li>Containers within a pod use networking to communicate via loopback.</li><li>Cluster Networking provides communication between different pods.</li><li>The service resources let you expose an application running in pods to be reachable from outside of your cluster.</li><li>You can also use services to publish services only for consumption inside your cluster.</li></ol><h3>Container to Container communication on the same pod</h3><ul><li>happens through localhost within the containers.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyGYl93pM4b2rJ49DHgJlg.png" /></figure><h4>Try <strong>Yourself</strong>?</h4><ul><li>Create a manifest file for creating a pod with 2 containers.</li></ul><pre>kind: Pod<br>apiVersion: v1<br>metadata:<br>  name: testpod<br>spec:<br>  containers:<br>    - name: c00<br>      image: ubuntu<br>      command: [&quot;/bin/bash&quot;, &quot;-c&quot;, &quot;while true; do echo Hello; sleep 5; done&quot;]<br>    - name: c01<br>      image: httpd<br>      ports:<br>        - containerPort: 80</pre><ul><li>Apply manifest file and create a pod with 2 containers.</li></ul><pre>kubectl apply -f pod.yml</pre><ul><li>Exec inside one container c00</li></ul><pre>kubectl get pods<br>kubectl exec testpod -it -c c00 -- /bin/bash</pre><ul><li>Curl localhost:80 for communicating to container 2 from container 1</li></ul><pre>apt update<br>apt install curl<br>curl localhost:80</pre><h3>Communication between two different Pods within the same machine(Node)</h3><ul><li>Pod to Pod communication on same worker node through Pod IP.</li><li>By Default Pod’s IP will not be accessible outside the node.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9yFiujQtPJL1tczRDeavg.png" /></figure><h4>Try Yourself?</h4><ul><li>Create 2 Pods on same node.</li></ul><pre>kind: Pod<br>apiVersion: v1<br>metadata:<br>  name: testpod1<br>spec:<br>  containers:<br>    - name: c00<br>      image: nginx<br>      ports:<br>        - containerPort: 80</pre><ul><li>manifest 2</li></ul><pre>kind: Pod<br>apiVersion: v1<br>metadata:<br>  name: testpod2<br>spec:<br>  containers:<br>    - name: c03<br>      image: httpd<br>      ports:<br>        - containerPort: 80</pre><ul><li>Apply manifest files</li></ul><pre>kubectl apply -f pod2.yml<br>kubectl apply -f pod3.yml</pre><ul><li>Inside node, run commands to get requests on pods IP addresses</li></ul><pre>curl &lt;POD_ID&gt;:80</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6256bd80120e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Introduction]]></title>
            <link>https://faun.pub/kubernetes-introduction-d3931a5cd48?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3931a5cd48</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 01:58:51 GMT</pubDate>
            <atom:updated>2022-09-19T10:45:06.437Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*6OAdYenDfWgPiizB2O3qQw.png" /></figure><ul><li>Kubernetes is an open-source container management tool that automates container deployment, container scaling, and load balancing.</li><li>It schedules, runs and manages isolated containers that are running on virtual/physical/cloud machines.</li><li>All top cloud providers support Kubernetes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YxVs_H5qXiG0B7LuO8hh9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGga9yoSpYaO8Esz2RqNYw.png" /></figure><h3>Features of Kubernetes</h3><ul><li>Orchestration (Clustering of any no. of containers running on different networks)</li><li>Autoscaling(Vertical and horizontal scaling)</li><li>Auto-Healing</li><li>Load Balancing</li><li>Platform independent(cloud/virtual/physical)</li><li>Fault-tolerance(Node/POD failure)</li><li>Rollback(going back to the previous version)</li><li>Health monitoring of containers</li><li>Batch execution (one time, sequential, parallel)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KQMrSewukSql63HwbEG2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6V-WwSl4lhGop3NykRP4EA.png" /></figure><h3>Cluster</h3><p>A cluster is all of the above components put together as a single unit.</p><h4>We’ve two main components in Kubernetes architecture-</h4><ul><li>Master</li><li>Worker(Nodes)</li></ul><h3>Working with Kubernetes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrZ7gHk8pZ90P5cvowetEQ.png" /></figure><h3>Control Plane(Master)</h3><ul><li>The Kubernetes control plane is the main entry point for administrators and users to manage the various nodes. Operations are issued to it either through HTTP calls or connecting to the machine and running command-line scripts. As the name implies, it controls how Kubernetes interacts with your applications.</li><li>Kubernetes cluster contains containers running or bare metal/vm instances/cloud instances/ all mix.</li><li>Kubernetes designates one or more of these as master and all other workers.</li><li>The master is now going to run a set of k8s processes. These processes will ensure the smooth functioning of the cluster. These processes are called the Control plane.</li><li>Can be Multimaster for high availability.</li><li>Master runs Control Plane to run cluster smoothly.</li></ul><h3>Components of the Control Plane</h3><ol><li>Kube API Server</li></ol><ul><li>This API server interacts directly with the user(i.e we apply yml or json manifest to Kube-apiserver)</li><li>This kube-api server is meant to scale automatically as per load.</li><li>Kube api-server is front-end of control plane.</li></ul><ol><li>etcd</li></ol><ul><li>Stores metadata and states of cluster.</li><li>etcd is consistent and high availability store(key-value store)</li><li>Source of touch for cluster state(info about state of cluster)</li><li>etcd has following features:</li><li>Fully replicated: The entire state is available on every node in the cluster</li><li>Secure: Implements automate TLS with optional client-certificate authentication</li><li>Fast: benchmarkes at 10000 writes per second.</li></ul><p>3. Scheduler</p><ul><li>When users make requests for the creation &amp; management of pods, kube-scheduler is going to take action on these requests.</li><li>Handles POD creation and management.</li><li>Match/assign any node to create and run pods.</li><li>A scheduler watches for newly created Pods that have no node assigned. For every pod that the scheduler discovers, the scheduler becomes responsible for finding the best node for that pod to run on.</li><li>Scheduler gets the information for hardware configuration from configuration files and schedules the Pods on node accordingly.</li></ul><p>4. Controller manager</p><ul><li>make sure actual state of cluster matches to desired state.</li><li>Two possible choices for control manager.</li></ul><p>If k8s on the cloud, then it will be cloud controller manager.</p><p>If k8s on non-cloud then it will be kube-controller-manager.</p><ul><li>Node-controller: For checking the cloud provider to determine if a node has been detected in the cloud after it steps responding.</li><li>Rout-controller: Responsible for setting up network, routes on your cloud.</li><li>Service-controller: Responsible for load balancer on your cloud against services of type load balancer.</li><li>Volume controller: For creating, attaching and monitoring volumes and interacting with the cloud provider to orchestrate volume.</li></ul><h3>Nodes</h3><p>A Kubernetes node manages and runs pods; it’s the machine (whether virtualized or physical) that performs the given work. Just as pods collect individual containers that operate together, a node collects entire pods that function together. When you’re operating at scale, you want to be able to hand work over to a node whose pods are free to take it.</p><h3>Services</h3><p>A service is an abstraction over the pods, and essentially, the only interface the various applicationsWorker node components consumers interact with. As pods are replaced, their internal names and IPs might change. A service exposes a single machine name or IP address mapped to pods whose underlying names and numbers are unreliable. A service ensures that, to the outside network, everything appears to be unchanged.</p><h4>1. Kubelet</h4><ul><li>Agent running on the node.</li><li>Listens to kubernetes master.(communicates controller, pod create request)</li><li>Use Port- 10255</li><li>send success/fail report to master.</li></ul><h4>2. Container Engine</h4><ul><li>Works with kubelet</li><li>Pulling images</li><li>Start/stop containers</li><li>Exposing containers on ports specified in mainfest.</li></ul><h4>3. Kube proxy</h4><ul><li>assign IP to each pod.</li><li>It is required to assign IP addresses to PODs(dynamic)</li><li>Kube-proxy runs on each node &amp; will get its own unique IP address.</li></ul><h3>Pods</h3><p>A Kubernetes pod is a group of containers, and is the smallest unit that Kubernetes administers. Pods have a single IP address that is applied to every container within the pod. Containers in a pod share the same resources such as memory and storage. This allows the individual Linux containers inside a pod to be treated collectively as a single application, as if all the containerized processes were running together on the same host in more traditional workloads. It’s quite common to have a pod with only a single container, when the application or service is a single process that needs to run. But when things get more complicated, and multiple processes need to work together using the same shared data volumes for correct operation, multi-container pods ease deployment configuration compared to setting up shared resources between containers on your own.</p><ul><li>Smallest unit in kubernetes.</li><li>POD is a group of one or mroe containers that one deployed together on the same host.</li><li>A cluster is a group of nodes.</li><li>A cluster has atleast one worker node and master node.</li><li>In kubernetes, the control unit is the POD, not containers.</li><li>Consist of one or mroe tightly coupled containers.</li><li>POD runs on node, which is controlled by master.</li><li>Kubernetes only knows about PODS.(does not know aboout individual containers)</li><li>Can’t start containers without a POD.</li><li>One POD usually contains one container.</li></ul><h3>Multi-Container PODS</h3><ul><li>Share access to memory space.</li><li>connect to each other using localhost.</li><li>Share access to the same volume.</li><li>Containers within the pod are deployed in an all-or-nothing manner.</li><li>The entire pod is hosted on the same node(Scheduler will decide about which node )</li></ul><h3>Limitations of POD</h3><ul><li>No auto-healing or scaling.</li><li>POD crashes.</li></ul><h3>Higher level kubernetes Objects</h3><ul><li>Replication Set:<br>Scaling and healing</li><li>Deployment:<br>Versioning and Rollback</li><li>Service:<br>Static(non-ephemeral) IP and networking</li><li>Volume:<br>Non ephemeral storage.</li></ul><h3>Important Commands</h3><ul><li>kubectl<br>For single cloud</li><li>kubeadn<br>On-premise</li><li>kubefed<br>Hybrid clouds</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FqmT4fc4qdwk2If7.png" /></figure><p><strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇</strong></p><h4>🚀<a href="http://from.faun.to/r/8zxxd">Read similar stories by joining FAUN</a>.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3931a5cd48" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/kubernetes-introduction-d3931a5cd48">Kubernetes Introduction</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web3 decentralized App(DApp) Development with the internet computer]]></title>
            <link>https://tush-tr.medium.com/web3-decentralized-app-dapp-development-with-the-internet-computer-d155037441d4?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d155037441d4</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[etherium]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Thu, 01 Sep 2022 23:34:37 GMT</pubDate>
            <atom:updated>2022-09-01T23:34:37.943Z</atom:updated>
            <content:encoded><![CDATA[<h3>Web3 Decentralized App(DApp) Development with the internet computer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*49XWrwylqJzQ77WU.png" /></figure><h3>What is web3?</h3><p>Web3.0 describes the third generation of the web.</p><p>Web1:</p><ul><li>Read-only web</li></ul><p>web2:</p><ul><li>Became interactive</li><li>Facebook, Instagram</li><li>products that users interact with them, we create content on websites.</li></ul><p>web3:</p><ul><li>Websites and applications on the blockchain</li><li>cryptocurrencies: Bitcoin, Etherium</li></ul><h3>Helium 5G Project:</h3><p>based on the blockchain web3 project</p><h3>What is blockchain and how does it work?</h3><ul><li>Blockchain is just a ledger.</li></ul><p>If we want to make this ledger secure then we need to make the history of these transactions immutable.</p><ul><li>Encryption</li><li>it is the process of converting human-readable plaintext to incomprehensible text, also known as ciphertext.</li><li>The key thing about encryption is, we can go forward and backwards, we can decrypt and get the message back.</li><li>This makes encryption less secure.</li><li>If our ledger is encryption, then it will be less secure, there’s always a way to decrypt it.</li></ul><h3>Hashing</h3><ul><li>Instead of using encryption, blockchain uses Hashing.</li><li>Hashing is basically a mathematical formula that allows us to turn a message into a hash code, by passing the message through the hash function.</li><li>We can turn a input into a hash.</li><li>Example: Factors and numbers.</li><li>Our problem was with the ledger, so none can change our history of transactions.</li></ul><p><a href="https://guggero.github.io/blockchain-demo/#!/block">https://guggero.github.io/blockchain-demo/#!/block</a></p><ul><li>In order to add data to a block, we have to generate a hash.</li><li>and the hash becomes the identifier of this block.</li><li>Every block will be having different hashes.</li><li>In order for a block to be added to blockchain, it has to satisfy some pre determined requirements. And this requirement could be for example: hash should start from 000 (3 zeros)</li><li>For that we need to keep modifying our data to generate the hash with pre requirements, also we can add modify instead of data the another thing that is nonce.</li></ul><h3>nonce:</h3><ul><li>What is nonce?</li><li>Nonce is basically a number, we can start from one.</li><li>Nonce is being combined with the data to produce the hash.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iyFfaUa5UzZEwng3" /></figure><ul><li>We add our data into a block by hashing our data along with a nonce.</li><li>Every block has a previous hash, it’s the has of the previous block, The hash of the first block is zero.</li></ul><h3>What if we want to alter any previous transaction?</h3><ul><li>If we alter a block’s data, Every block after that block(every connected block) will be affected.</li><li>This means we can’t change any historical data, or a past block’s data in the blockchain without people knowing about it. Because every block will be changed by changing just one block, then anyone can know that something has been changed.</li><li>We can’t change anything that goes into the blockchain. Otherwise it’s gonna invalidate all our hashes.</li><li>To generate a new hash, every block in the blockchain need the previous block’s hash and if previous block’s hash is changed then it will change it’s hash too.</li><li>Blockchain is a ledger in which if we change anything in a previous block, it’s going to invalidate every single block.</li><li>In reality, the real world blockchains like Bitcoin, Etherium have more power, we can’t go into every single each block.</li></ul><h3>Distributed Blockchain</h3><ul><li>We can have more than one peers.</li><li>Everytime a new miner joins a blockchain, they’re going to get the full copy of the blockchain.</li><li>This means that more than one people can have same blockchain.</li><li>So let’s say one person wants to change some block of his blockchain, then every block of other people’s blockchains will be invalidated.</li><li>This is the power of blockchain, Now we have a distributed trustless ledger.</li><li>We don’t have to trust anybody, we don’t have to believe that paypal is storing our money.</li><li>Because of it’s distributed nature, we don’t care who has the copy of the blockchain, we can trust the technology.</li><li>This technology allows us to have cryptocurrencies like bitcoin.</li></ul><h3>Smart contracts and Ethereum comes in</h3><ul><li>The real breakthrough here is that when Ethereum was conceptualized,</li><li>we can’t only store data in blocks.</li><li>We can create smart contracts by storing code in the blocks.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*ujJ6NtZullZnoAE8" /></figure><h3>What are DApps (Decentralised Apps) and How do we develop them?</h3><ul><li>DApps are the backbone of web3.</li></ul><h3>Old way:</h3><ul><li>build a startup, build a technology.</li><li>raise VC funding, hopefully, they like your idea.</li><li>IPO</li></ul><h3>New Web3 way:</h3><ul><li>Build startup, build technology.</li><li>Then you can start releasing tokens to public and start selling tokens, that enable people to use and interact with your technology.</li><li>You’re able to raise money for your DApp from day 1.</li><li>The way you run your company is also transformed by the blockchain because you can form a decentralized autonomous organization (DAO) that would replace the Board of directors as well the all organizational chart of the company.</li><li>Token holders will decide how the company should run.</li></ul><h3>Meaningful use as an individual entrepreneur(Example: Dropbox)</h3><ul><li>Dropbox, you raise funding for dropbox(assume $60000)</li><li>Dropbox basically offers us storage on the cloud.</li><li>FileCoin(Dropbox’s web3 competitor)</li><li>Filecoin allows us to store files in a decentralized way in the cloud.</li><li>But instead of being hosted by a single company, It’s hosted on millions of computers across the world.</li></ul><p><a href="https://filecoin.io/">https://filecoin.io/</a></p><ul><li>The future of decentralized applications is really exciting.</li><li>For example: Instead of having uber drivers ripped off by uber, we could have a user-and-driver-owned version of Uber, Where everybody who is driving for the company or using the company to get around is able to get access to the tokens, to govern, to determine, how the company should be run and also effectively own shares in that company once it gets more successful.</li></ul><h3>Pseudonymity</h3><ul><li>Pseudonymity is probably the best feature of web3 technology.</li><li>People can protect their personal privacy, and still be accountable for their actions.</li><li>The pseudonymous trend has been amplified by a world that judges people on birth names and skin color.’</li><li>It’s a great equalizer.</li></ul><h4>Where do we start?</h4><ul><li>We have to pick a chain to build DApps on.</li><li>Currently, the largest no. of DApps is built on Ethereum.</li><li>Ethereum has a lots of fundamental problems:</li><li>The biggest problem is scaling.</li><li>you can’t store data in Ethereum,</li><li>NFTs built on Ethereum are not even stored in Ethereum.</li><li>It’s very costly to do computation on Ethereum, and costly to store anything on this.</li><li>That’s why most etherium-based applications are built using patch work of different services.</li><li>Ex: Normal websites are hosted on AWS.</li><li>Internet Computer.</li><li>Idea is to create a scalable cloud computer that runs on blockchain.</li><li>Store data directly on the blockchain.</li></ul><h3>What is the Internet Computer? How we build DApps using internet computer.</h3><ul><li>The goal of Internet Computer is to reach blockchain singularity.</li><li>Idea is to have a powerful and secure blockchain, that’s capable of running the entire base layer of the web, everything hosting, deployment all the things.</li><li>Build almost anything, DAPPS without cloud.</li><li>Most of today’s DApps are partially decentralized, they have a very small amount of data stored in blockchain, all other hosted on large web2 companies.</li></ul><h3>Why we’re relying on legacy infrastructure?</h3><ul><li>The reason is, It’s extremely difficult with the current blockchains</li><li>Forex: Etherium: To be able to store a large amount of data or hold large amounts of transactions. Because it’s not built for that purpose.</li><li>Ethereum was built primarily to act as a ledger.</li><li>Each new post in a decentralized social media app is a transaction. That means the limits of blockchain storing data depends on how many posts all users can make.</li></ul><p><a href="https://dfinity.org/pdf-viewer/pdfs/viewer?file=../library/dfinity-consensus.pdf">https://dfinity.org/pdf-viewer/pdfs/viewer?file=../library/dfinity-consensus.pdf</a></p><p><a href="https://etherscan.io/tx/0x674779579a8e456fc1f6c8fdf41ef942eb93001d6b8f5ad6c6c59cbc76bef161">https://etherscan.io/tx/0x674779579a8e456fc1f6c8fdf41ef942eb93001d6b8f5ad6c6c59cbc76bef161</a></p><h3>What are Internet Computers(ICP)?</h3><ul><li>The problem statement was: How do you make blockchain smart contracts scale? More performer, capable of processing thousands of computations per second.</li><li>Internet computer aggregates the compute capacity of a large number of independent data centers. And it takes all the data centers around the world and combines them using the Internet Computer Protocol into a large single decentralized world computer.</li><li>This Decentralized computer is organized into individuals what they call, Canisters.</li><li>Canisters can basically run processes, execute code and run programs,</li><li>As a user, we can interact with a canister directly by making a HTTPS request.</li><li>But as a developer, what we need to realize is</li><li>Internet Computer is basically the whole bunch of canisters.</li><li>Each canister can hold programs and programs state through a web assembly module and a flat memory model called a memory page.</li></ul><h3>Canisters</h3><ul><li>We as a developer can write code that compiles into a performant way to run web applications on user hardware using web assembly.</li><li>We can do that using many languages. Like Rust etc.</li><li>Each of these canisters acts like a process or like a code sandbox.</li><li>It’s kind of similar to containers, if you’re familiar to Docker so you can understand it easily.</li><li>Essentially the program state gets preserved, canister acts as it runs for forever.</li><li>Assume, you run a program on code sandbox, and that program never gets killed.</li><li>So our memory is occupied by our variables, data structures will never get wiped.</li><li>We don’t have to think about state persistence or putting things into databases, or taking out from the databases.</li><li>Your program behaves like it never gets killed.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d155037441d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Docker]]></title>
            <link>https://tush-tr.medium.com/getting-started-with-docker-328ebe625d5f?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/328ebe625d5f</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Fri, 26 Aug 2022 00:20:07 GMT</pubDate>
            <atom:updated>2022-08-26T00:20:07.454Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31TDNaVzzW1oTmkS-FV2lA.jpeg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F2rvpWc88Wkw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D2rvpWc88Wkw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F2rvpWc88Wkw%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/8e1d739834dc874529d10baddb53c9bb/href">https://medium.com/media/8e1d739834dc874529d10baddb53c9bb/href</a></iframe><h3>What is Hypervisor?</h3><p>A hypervisor is computer software, firmware or hardware that creates and runs virtual machines. A computer on which a hypervisor runs one or more virtual machines is called a host machine, and each virtual machine is called a guest machine.</p><h3>What is a virtual machine?</h3><p>A Virtual Machine (VM) is a compute resource that uses software instead of a physical computer to run programs and deploy apps. … Each virtual machine runs its own operating system and functions separately from the other VMs, even when they are all running on the same host.</p><h3>What is docker?</h3><p>Docker is an advanced version of virtualization.</p><p>The main work of docker is containerization.</p><p>keywords of docker are:</p><p>develop, ship, and run anywhere.</p><p>We can run multiple containers on one host, Container does not have any operating system</p><h3>Theory about docker</h3><ul><li>Docker was first released in march 2013, developed by Solomon hykes and Sebastian Pahl.</li><li>Docker is an open source centralized platform designed to create, deploy and run applications</li><li>Docker uses a container on the host OS and runs the application. It allows applications to use the same Linux kernel</li><li>as a system on the host computer, rather than creating a whole virtual OS</li><li>We can install docker-engine on any OS, but the docker engine only runs natively on Linux distributions</li><li>Docker is written in the Go language</li><li>Docker is a tool that performs OS-level virtualization also called containerization</li><li>Before docker, many users faced problems that a particular code is running in the developer’s system but not in the user’s system</li><li>Docker is a set of platforms as a service that uses OS-level virtualization whereas VMWARE uses hardware-level virtualization.</li><li>Docker provides a type of platform for our application to be executed.</li></ul><h3>Advantages of Docker</h3><ul><li>No pre-allocation of RAM.</li><li>CI efficiency:<br>Docker enables you to build a container image and use that same image across every stage of the deployment process.</li><li>Less Cost</li><li>It is light in weight.</li><li>It can run on physical hardware/virtual hardware/ or on the cloud.</li><li>You can re-use the image.</li><li>It took very less time to create a container.</li><li>IMAGE — — -RUN — — → Container Container — — -Make/share — — -&gt; IMAGE</li><li>The container is a running state of the image. We can make changes in containers not in images.</li></ul><h3>Disadvantages of Docker</h3><ul><li>Docker is not a good solution for applications that required rich GUI</li><li>Difficult to manage a large amount of containers</li><li>Docker doesn’t provide cross-platform compatibility means if an application is designed to run in a docker container on windows, then it can’t run on Linux or vice-versa.</li><li>Docker is suitable when the development OS and testing OS are the same if the OS is different, we should use VM.</li><li>No solution for data recovery and backup.</li></ul><h3>Docker Ecosystem</h3><ul><li>Docker client</li><li>Docker Hub</li><li>Docker Daemon or Docker Server or Docker engine</li><li>Docker images</li><li>Docker compose</li></ul><h3>Docker Daemon</h3><ul><li>Docker daemon runs on the Host OS.</li><li>It is responsible for running containers to manage docker services.</li><li>Docker daemon can communicate with other daemons.</li></ul><h3>Docker Client</h3><ul><li>Docker users can interact with docker daemon through a client.</li><li>Docker client uses commands and Rest APIs to communicate with the docker daemon.</li><li>When a client runs any server command on the docker client terminal, the client terminal sends these commands to the docker daemon.</li><li>It is possible for docker client to communicate with more than one daemon.</li></ul><h3>Docker host(not a part of ecosystem)</h3><ul><li>Docker host is used to provide an environment to execute and run applications. It contains the docker daemon, images, containers, networks and storages.</li></ul><h3>Docker hub/registry</h3><ul><li>Docker registry manages and stores the docker images.</li><li>Two types of registry in docker</li><li>Public Registry: Public registry is also called as docker hub.</li><li>Private registry: It is used to share images within the enterprise.</li></ul><h3>Docker images</h3><ul><li>Docker images are the read only binary templates used to create docker containers.OR single file with all dependencies and configuration required to run a program.</li><li>Ways to create an Image:</li><li>Take image from docker hub</li><li>Create image from Dockerfile</li><li>Create image from existing docker containers</li></ul><h3>Docker Container</h3><ul><li>Container hold the entire packages that needed to run the application.OR in other words<br>we can say that, the image is a template and the container is a copy of that template.</li><li>Container is like a virtual machine.</li><li>Images becomes container when they run on docker engine.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=328ebe625d5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy to AWS EC2 using Terraform and Github Actions CI/CD]]></title>
            <link>https://faun.pub/deploy-to-aws-ec2-using-terraform-and-github-actions-ci-cd-bfcb60b3cc1e?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfcb60b3cc1e</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Fri, 26 Aug 2022 00:01:29 GMT</pubDate>
            <atom:updated>2022-10-03T23:17:02.125Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rRSJzWYFlo3EjKRsNsl4rg.jpeg" /></figure><h3>Technologies:</h3><ul><li>Terraform</li><li>Github Actions</li><li>Docker</li><li>Node.js</li><li>AWS EC2</li><li>AWS S3</li><li>AWS ECR</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5sZAx2ylsOo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5sZAx2ylsOo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5sZAx2ylsOo%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/e67beed36090a57a3b4f198a00ee21a3/href">https://medium.com/media/e67beed36090a57a3b4f198a00ee21a3/href</a></iframe><h3>Tasks:</h3><ul><li>Get access id, secret id from AWS</li><li>Develop a simple nodejs app</li></ul><pre>const express = require(&quot;express&quot;)<br>const app = express()</pre><pre>app.get(&quot;/&quot;,(req,res)=&gt;{<br>    res.send(&quot;Service is up and running&quot;)<br>})</pre><pre>app.listen(8080,()=&gt;{<br>    console.log(&quot;Server is up&quot;)<br>})</pre><ul><li>Write Dockerfile for Simple Application</li></ul><pre>FROM node:14<br>WORKDIR /user/app<br>COPY package.json ./<br>RUN npm install<br>COPY . .<br>EXPOSE 8080<br>CMD [&quot;npm&quot;,&quot;start&quot;]</pre><ul><li>Generate SSH keys for connecting to the EC2 instance</li><li>Create an S3 bucket for storing Terraform State file</li></ul><h3>Write Terraform Scripts for provisioning EC2 instance</h3><pre>terraform {<br>  required_providers {<br>    aws = {<br>      source  = &quot;hashicorp/aws&quot;<br>      version = &quot;~&gt;4.0&quot;<br>    }<br>  }<br>  backend &quot;s3&quot; {<br>    key = &quot;aws/ec2-deploy/terraform.tfstate&quot;<br>  }<br>}</pre><pre>provider &quot;aws&quot; {<br>  region = var.region<br>}<br>resource &quot;aws_instance&quot; &quot;servernode&quot; {<br>  ami                    = &quot;ami-052efd3df9dad4825&quot;<br>  instance_type          = &quot;t2.micro&quot;<br>  key_name               = aws_key_pair.deployer.key_name<br>  vpc_security_group_ids = [aws_security_group.maingroup.id]<br>  iam_instance_profile   = aws_iam_instance_profile.ec2-profile.name<br>  connection {<br>    type        = &quot;ssh&quot;<br>    host        = self.public_ip<br>    user        = &quot;ubuntu&quot;<br>    private_key = var.private_key<br>    timeout     = &quot;4m&quot;<br>  }<br>  tags = {<br>    &quot;name&quot; = &quot;DeployVM&quot;<br>  }<br>}<br>resource &quot;aws_iam_instance_profile&quot; &quot;ec2-profile&quot; {<br>  name = &quot;ec2-profile&quot;<br>  role = &quot;ECR-LOGIN-AUTO&quot;<br>}<br>resource &quot;aws_security_group&quot; &quot;maingroup&quot; {<br>  egress = [<br>    {<br>      cidr_blocks      = [&quot;0.0.0.0/0&quot;]<br>      description      = &quot;&quot;<br>      from_port        = 0<br>      ipv6_cidr_blocks = []<br>      prefix_list_ids  = []<br>      protocol         = &quot;-1&quot;<br>      security_groups  = []<br>      self             = false<br>      to_port          = 0<br>    }<br>  ]<br>  ingress = [<br>    {<br>      cidr_blocks      = [&quot;0.0.0.0/0&quot;, ]<br>      description      = &quot;&quot;<br>      from_port        = 22<br>      ipv6_cidr_blocks = []<br>      prefix_list_ids  = []<br>      protocol         = &quot;tcp&quot;<br>      security_groups  = []<br>      self             = false<br>      to_port          = 22<br>    },<br>    {<br>      cidr_blocks      = [&quot;0.0.0.0/0&quot;, ]<br>      description      = &quot;&quot;<br>      from_port        = 80<br>      ipv6_cidr_blocks = []<br>      prefix_list_ids  = []<br>      protocol         = &quot;tcp&quot;<br>      security_groups  = []<br>      self             = false<br>      to_port          = 80<br>    }<br>  ]</pre><pre>}</pre><pre>resource &quot;aws_key_pair&quot; &quot;deployer&quot; {<br>  key_name   = var.key_name<br>  public_key = var.public_key<br>}</pre><pre>output &quot;instance_public_ip&quot; {<br>  value     = aws_instance.servernode.public_ip<br>  sensitive = true<br>}</pre><ul><li>variables.tf file</li></ul><pre>variable &quot;region&quot; {<br>    default = &quot;us-east-1&quot;<br>}<br>variable &quot;public_key&quot; {<br>  <br>}<br>variable &quot;private_key&quot; {<br>  <br>}<br>variable &quot;key_name&quot; {<br>  <br>}</pre><h3>Write CI/CD pipeline</h3><ul><li>Write Github Actions workflow: Set environment variables</li></ul><pre>env:<br>  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}<br>  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>  TF_STATE_BUCKET_NAME: ${{ secrets.AWS_TF_STATE_BUCKET_NAME }}<br>  PRIVATE_SSH_KEY: ${{ secrets.AWS_SSH_KEY_PRIVATE }}<br>  PUBLIC_SSH_KEY: ${{ secrets.AWS_SSH_KEY_PUBLIC }}<br>  AWS_REGION: us-east-1</pre><ul><li>Setup backend for S3 bucket with terraform init</li></ul><pre>- name: checkout repo<br>      uses: actions/checkout@v2<br>    - name: setup terraform<br>      uses: hashicorp/setup-terraform@v1<br>      with:<br>        terraform_wrapper: false<br>    - name: Terraform Init<br>      id: init<br>      run: terraform init -backend-config=&quot;bucket=$TF_STATE_BUCKET_NAME&quot; -backend-config=&quot;region=us-east-1&quot;<br>      working-directory: ./terraform</pre><ul><li>Pass tf variables with Terraform plan</li></ul><pre>- name: Terraform Plan<br>  id: plan<br>  run: |-<br>    terraform plan \<br>    -var=&quot;region=us-east-1&quot; \<br>    -var=&quot;bucket=$TF_STATE_BUCKET_NAME&quot; \<br>    -var=&quot;public_key=$PUBLIC_SSH_KEY&quot; \<br>    -var=&quot;private_key=$PRIVATE_SSH_KEY&quot; \<br>    -var=&quot;key_name=deployer-key&quot; \<br>    -out=PLAN<br>  working-directory: ./terraform</pre><ul><li>Run terraform apply</li></ul><pre>- name: Terraform Apply<br>    id: apply<br>    run: |-<br>      terraform apply PLAN<br>    working-directory: ./terraform</pre><ul><li>Set EC2 instance public ip as job output</li></ul><pre>- name: Set output<br>    id: set-dns<br>    run: |-<br>        echo &quot;::set-output name=instance_public_dns::$(terraform output instance_public_ip)&quot;<br>    working-directory: ./terraform</pre><ul><li>Authenticate ECR</li></ul><pre>- name: Login to AWS ECR<br>  id: login-ecr<br>  uses: aws-actions/amazon-ecr-login@v1</pre><ul><li>Set ec2 public ip as environment variable for later use</li></ul><pre>- run: echo SERVER_PUBLIC_IP=${{ needs.deploy-infra.outputs.SERVER_PUBLIC_DNS }} &gt;&gt; $GITHUB_ENV</pre><ul><li>Build, tag and push docker image to Amazon ECR</li></ul><pre>- name: Build, tag, and push docker image to Amazon ECR<br>    env:<br>      REGISTRY: ${{ steps.login-ecr.outputs.registry }}<br>      REPOSITORY: example-node-app<br>      IMAGE_TAG: ${{ github.sha }}<br>    run: |<br>      docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .<br>      docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG<br>    working-directory: ./nodeapp</pre><ul><li>Connect to EC2 using ssh and deploy docker container</li></ul><pre>- name: Deploy Docker Image to EC2<br>  env:<br>    REGISTRY: ${{ steps.login-ecr.outputs.registry }}<br>    REPOSITORY: example-node-app<br>    IMAGE_TAG: ${{ github.sha }}<br>    AWS_DEFAULT_REGION: us-east-1<br>  uses: appleboy/ssh-action@master<br>  with:<br>    host: ${{ env.SERVER_PUBLIC_IP }}<br>    username: ubuntu<br>    key: ${{ env.PRIVATE_SSH_KEY }}<br>    envs: PRIVATE_SSH_KEY,REGISTRY,REPOSITORY,IMAGE_TAG,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION<br>    script: |-<br>      sudo apt update<br>      sudo apt install docker.io -y<br>      sudo apt install awscli -y<br>      sudo $(aws ecr get-login --no-include-email --region us-east-1);<br>      sudo docker stop myappcontainer || true<br>      sudo docker rm myappcontainer || true<br>      sudo docker pull $REGISTRY/$REPOSITORY:$IMAGE_TAG<br>      sudo docker run -d --name myappcontainer -p 80:8080 $REGISTRY/$REPOSITORY:$IMAGE_TAG</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VUK1-iKIQ90xUlTO.png" /></figure><p><strong>If you find this helpful, please click the clap 👏 button below a few times to show your support for the author 👇</strong></p><h4>🚀<a href="http://from.faun.to/r/8zxxd">Join FAUN &amp; get similar stories in your inbox each week</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfcb60b3cc1e" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/deploy-to-aws-ec2-using-terraform-and-github-actions-ci-cd-bfcb60b3cc1e">Deploy to AWS EC2 using Terraform and Github Actions CI/CD</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Github Actions]]></title>
            <link>https://tush-tr.medium.com/getting-started-with-github-actions-81382548bade?source=rss-58248ce70cbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/81382548bade</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[devops-tool]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Tushar Rajpoot]]></dc:creator>
            <pubDate>Fri, 12 Nov 2021 05:43:36 GMT</pubDate>
            <atom:updated>2022-08-26T00:07:26.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ac4lfvXElRSZDwlsbiibxg.jpeg" /></figure><h3>What are GitHub actions?</h3><p>A tool that lets you automate your software development workflows.<br>We can write individual tasks, called actions, and combine them to create a custom workflow.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMNtIdC4AEQo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMNtIdC4AEQo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMNtIdC4AEQo%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/1a10ecd47d8dfabd7311d4e131685b87/href">https://medium.com/media/1a10ecd47d8dfabd7311d4e131685b87/href</a></iframe><h3>What are workflows?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4Ex1uUhL93a3bHyC-TgPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4Ex1uUhL93a3bHyC-TgPg.png" /></figure><p>Workflows are custom automated processes that we can set up in your repository to build, test, package, release, or deploy any code project on Github.</p><h3>Events</h3><p>Let say we have a Github repository and on this repository, things can happen, things like someone pushed something or a pull request was opened or an issue was created or closed, and so on.</p><p>these things are referred to as events.</p><p>So a workflow for example can be testing and deploying your code when someone pushes to master or run some tests when someone opens a pull request or maybe send a Slack message when an issue is created and so on.</p><p>We might also need a workflow to run on a regular schedule like for instance every 6 p.m. every day. Or they can even happen when an external event happens.</p><h4>Github Repository</h4><ul><li>Push</li><li>Pull request(opened, merged)</li><li>Issue(created, closed)</li><li>Schedule(every 6 pm)</li><li>External Event</li></ul><p>So something that happens outside of GitHub can trigger a workflow to run on GitHub.</p><h3>Where do these workflows run when some event happens?</h3><p>They run on a virtual machine on some GitHub server. A workflow can contain one or more jobs and each job runs on its own virtual machine.</p><p>assume an event happened on our repository and that we have configured some workflow to run when that event happens. A virtual machine will be booted up for each job that we have in our workflow and this virtual machine can be a Windows virtual machine or a Linux or a Mac OS and we can even run Docker containers.</p><p>For each job we define a bunch of steps and each step should either perform an action.(an action can be something like deploy the code to some servers like Heroku for instance.)</p><ul><li>we can have a step that performs some action.</li><li>another step that performs another action.</li><li>we can also have steps that will just run some shell commands. like:</li></ul><pre>npm install<br>echo string</pre><p>a workflow can have more than one job and each one will run on its own virtual machine. And they can run in parallel or they can depend on each other. And this can be very useful especially if you need to perform actions that require different operating systems and that can be run in parallel.</p><h3>Runner</h3><ul><li>Any machine with the github actions runner application installed</li><li>A runner is responsible for running you jobs whenever an event happens and displays back the results.</li><li>A runner can be hosted by github or we can host our own runner.</li></ul><p><strong>Github Hosted Runner</strong></p><ul><li>Linux, windows or MacOS virtual environments commonly-used pre-installed software.</li><li>Maintained by github</li><li>We can’t customize the hardware configuration. Self Hosted Runner</li><li>A machine we manage and maintain with the runner application installed.</li><li>We have more control of hardwaer, OS, and software tools than Github-hosted runners provide.</li><li>Idea if we need to control hardwaer. Ex. Add more memory for larger jobs or choose an OS not offered by github-hosted runners.</li></ul><p><strong>Pre-installed softwares in github-hosted runners</strong></p><ul><li>tools like curl, git, npm, yarn, pip</li><li>Languages like python, ruby, Node js</li><li>Android SDK, Xcode</li></ul><h3>Introduction to the YAML format</h3><p>GitHub workflows are written in the YAML format and the YAML format is just a data serialization language that is very similar to JSON.</p><pre>name: Tushar<br>age: 21<br>address: &quot;dqhui: iowdiw&quot;<br>active: true<br>key:<br>  key: value<br>  key2: 35<br>  key3:<br>    key: value<br>    key2: value<br>jsonObject: { key: value, key2: 33, key3: { key: value, key2: value } }<br>array:<br>  - item1<br>  - item2<br>  - { key: value }<br>jsonArray: [item1, item2, { key: value }]<br>objectsArray:<br>  - key: value<br>    key1: value1<br>  - key: value<br>    key2: value2<br>    # if we add &gt; there will be no new line in actual<br>longText: &gt;<br>  loremTextd ovenornoeg orenorine eor o<br>  bernobirevb<br># if we add | there will be new line-<br>longtext-: |<br>  loremTextd ovenornoeg orenorine eor o<br>  bernobirevb</pre><h3>creating our first workflow</h3><p>we are going to create a yml file inside our repo inside .github/workflow directory</p><pre>.gitHub/workflow/simple.yml</pre><p>we can start writing our workflow. the first key that our workflow can have is a “name”. So this is the name of our entire workflow.</p><p>So in this first workflow that we will create, we will just use shell commands in our steps. then we can define the events that will trigger this workflow.</p><pre>name: Shell Commands</pre><p>we can define events here using the key “on”. So “on:” and then it can be just one event</p><pre>on: push</pre><p>or it could be an array of events.</p><pre>on: [push]</pre><p>for each workflow, we can have one or more jobs. We can define our jobs using the jobs key. And this will be an object and the key for each object will be the name of the job.</p><p>We have our steps, this will be an array of objects and each object represents a step.</p><pre>jobs: <br>  run-shell-command:<br>    runs-on: ubuntu-latest<br>    steps: <br>      - name: echo a string<br>        run: echo &quot;Hello Actions&quot;<br>      - name: multiline script<br>        run: |<br>          node -v<br>          npm -v</pre><p>When we push this repo to GitHub, we’ll see the magic happens.</p><p>when a job is done you can choose to get a notification when the job is successful or if the job has failed.</p><blockquote>Github Account settings &gt; notifications tab &gt; Github actions</blockquote><h3>Using different shells for each step</h3><p>you can change what shell are you using.</p><p>check this <a href="https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell">https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell</a></p><p>let’s now try to use another shell in our Ubuntu job here. So I’m going to use the python.</p><pre>name: Shell Commands<br>on: [push]<br>jobs:<br>  run-shell-command:<br>    runs-on: ubuntu-latest<br>    steps: <br>      - name: echo a string<br>        run: echo &quot;Hello Actions&quot;<br>      - name: multiline script<br>        run: |<br>          node -v<br>          npm -v<br>      - name: python Command<br>        run: |<br>          import platform<br>          print(platform.processor())<br>        shell: python</pre><p>Another example, we’re going to use bash on windows machine. So we create this in a new job because we need to use a different OS. As we know each job will run in parallel on it’s own virtual machine.</p><pre>name: Shell Commands<br>on: [push]<br>jobs:<br>  run-shell-command:<br>    runs-on: ubuntu-latest<br>    steps: <br>      - name: echo a string<br>        run: echo &quot;Hello Actions&quot;<br>      - name: multiline script<br>        run: |<br>          node -v<br>          npm -v<br>      - name: python Command<br>        run: |<br>          import platform<br>          print(platform.processor())<br>        shell: python<br>  run-windows-command:<br>    runs-on: windows-latest<br>    steps:<br>      - name: Directory PowerShell<br>        run: Get-Location<br>      - name: Directory Bash<br>        run: pwd<br>        shell: bash</pre><blockquote><em>Powershell is default in windows OS</em></blockquote><h3>How to run these jobs in serial or one after another.</h3><p>let’s say this run-windows-commands job depends on run-shell-command job. So it needs this job to finish first before running and not run in parallel.</p><p>So what we can do is in this job here, we have a “needs” key and needs can be an array of jobs that this job depends on.</p><p>So it will only run when the jobs in this array finishes successfully. And this will be the id of the job or the name which is the key here.</p><pre>name: Shell Commands<br>on: [push]<br>jobs:<br>  run-shell-command:<br>    runs-on: ubuntu-latest<br>    steps: <br>      - name: echo a string<br>        run: echo &quot;Hello Actions&quot;<br>      - name: multiline script<br>        run: |<br>          node -v<br>          npm -v<br>      - name: python Command<br>        run: |<br>          import platform<br>          print(platform.processor())<br>        shell: python<br>  run-windows-command:<br>    runs-on: windows-latest<br>    needs: [&quot;run-shell-command&quot;]<br>    steps:<br>      - name: Directory PowerShell<br>        run: Get-Location<br>      - name: Directory Bash<br>        run: pwd<br>        shell: bash</pre><blockquote><em>a step can perform an action or you can run a command.</em></blockquote><h3>Using a simple action</h3><p>we’ve only seen how to run some shell command in a step which could be very useful,</p><p>however using actions which is another thing we can do in our step can do a lot more stuff.</p><p>Now we’re creating a new workflow.We can have more than one workflow in our repository. <a href="https://github.com/actions/hello-world-javascript-action">Example JavaScript Hello World Action</a></p><p>Let’s give our first step a name. Let’s call it “Simple JS Action”. And instead of run, we can use “uses” and uses will take a reference to an action.</p><p>we can write actions in the same repository, somewhere here, in a subfolder or something. And then we can reference this action by typing the path to our file, action file. Or we can use an action that is published on a public GitHub repository. Here we are usng this repo <a href="https://github.com/actions/hello-world-javascript-action">https://github.com/actions/hello-world-javascript-action</a></p><p>we will have to type the user name which is “actions” in this case and the repository name and then a reference to a branch or a version.</p><pre>uses: actions/hello-world-javascript-action@master</pre><p>we can use version also</p><pre>uses: actions/hello-world-javascript-action@v1.3</pre><p>Also we can reference a specific commit. Copy the commit id and use it as</p><pre>uses: actions/hello-world-javascript-action@v03ecc1e8877e9be69e1a70a6145bac1ba4b06586</pre><h3>how do we provide an input to an action?</h3><pre>name: Actions Workflow<br>on: [push]<br>jobs:<br>  run-github-acions:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Simple JS Action<br>        id: greet<br>        uses: actions/hello-world-javascript-action@v1<br>        with:<br>          who-to-greet: Tushar<br>      - name: log Greeting Time<br>        run: echo &quot;${{ steps.greet.outputs.time }}&quot;</pre><h3>Where these commands (echo) are running?</h3><p>They’re running on a virtual machine. to check the location directory of where the commands are running we can add a step to check the directory.</p><pre>steps:<br>      - name: Show dir and files<br>        run: |<br>          pwd<br>          ls</pre><p>After running it we can see</p><pre>/home/runner/work/github-actions-test/github-actions-test</pre><p>it will give us the directory location. So this is a folder that is set up on your virtual machine when you’re running a workflow. And this is where you can work with your files.</p><p>when we ran ls here, we will not get any files. So by default GitHub will not clone your repository into your working directory. And this is because not all workflows will have to use the files in the repository, so it may be unnecessary to clone it and then not use any of the files.</p><p>So in order to clone your repository into your virtual machine in this directory, we can use an action to do that. So this is an official action which means it was created by GitHub. That action is <a href="https://github.com/actions/checkout">https://github.com/actions/checkout</a></p><p>in another step we will use this action.</p><pre>- name: Checkout<br>        uses: actions/checkout@v1</pre><h3>what this will do?</h3><p>It will just authenticate with your repository and then fetch the code and checkout into the commit that triggered this workflow to run.</p><p>So when we push something into our repository, the commit that we will push will trigger the workflow to run. And this commit will have a certain id. And we need to checkout into this specific commit that triggered the workflow and pull our code from there.</p><p>we could have done this ourselves. We could have ran “git-clone” or git-fetch” also, since you already have git installed on our virtual machine.</p><pre>name: Show dir and files<br>        run: |<br>          pwd<br>          ls<br>          git clone repo</pre><p>But this action makes it easier for us. we just have to type one line</p><pre>- name: Checkout<br>        uses: actions/checkout@v1</pre><p>So when we list our files after adding checkout action to our workflow then it will show the files inside our repository.</p><pre>ame: Actions Workflow<br>on: [push]<br>jobs:<br>  run-github-acions:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Show dir and files<br>        run: |<br>          pwd<br>          ls<br>      - name: Checkout<br>        uses: actions/checkout@v1<br>      - name: list files after checkout<br>        run: |<br>          pwd<br>          ls -a<br>      - name: Simple JS Action<br>        id: greet<br>        uses: actions/hello-world-javascript-action@v1<br>        with:<br>          who-to-greet: Tushar<br>      - name: log Greeting Time<br>        run: echo &quot;${{ steps.greet.outputs.time }}&quot;</pre><p>Output of list files after checkout step will be:</p><pre>/home/runner/work/github-actions-test/github-actions-test<br>.<br>..<br>.git<br>.github</pre><p><a href="https://github.com/marketplace?type=actions">Actions marketplace</a></p><h3>environment variables that are set automatically when you run your workflow.</h3><pre>- name: Env Variables<br>        run: |<br>          pwd<br>          ls<br>          echo $GITUB_SHA<br>        #   $GITHUB_SHA is commit id of the specific commit that triggered this workflow to run.<br>          echo $GITHUB_REPOSITORY<br>        #   $GITHUB_REPOSITORY is username/repositoryname<br>          echo $GITHUB_WORKSPACE<br>        #   $GITHUB_WORKSPACE is the workspace directory that we got using pwd</pre><pre>        # we have an object called &quot;github&quot; that we can use.<br>          echo &quot;${{ github.token }}&quot;<br>        #   this is a token that you can use to authenticate with your GitHub repository.<br>          git clone git@githuub:$GITUHB_REPOSITORY<br>          git checkout $GITHUB_SHA</pre><p>he checkout action can also take some inputs as well. You can for instance change the commit that you are checking-out to, override the authentication token with another one, choose the fetch depth and more.</p><p>You can check the rest of the options here: <a href="https://github.com/actions/checkout#usage">https://github.com/actions/checkout#usage</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81382548bade" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>