<?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 Ranga Maithreepala on Medium]]></title>
        <description><![CDATA[Stories by Ranga Maithreepala on Medium]]></description>
        <link>https://medium.com/@rangamaithreepala?source=rss-7946ceae1779------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Er-RMfBHWWfjgU33</url>
            <title>Stories by Ranga Maithreepala on Medium</title>
            <link>https://medium.com/@rangamaithreepala?source=rss-7946ceae1779------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:33:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rangamaithreepala/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[How to set up a Hadoop cluster using Docker]]></title>
            <link>https://medium.com/@rangamaithreepala/how-to-set-up-a-hadoop-cluster-using-docker-7ccf234bdcbc?source=rss-7946ceae1779------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ccf234bdcbc</guid>
            <dc:creator><![CDATA[Ranga Maithreepala]]></dc:creator>
            <pubDate>Tue, 17 Jun 2025 14:27:52 GMT</pubDate>
            <atom:updated>2025-06-17T14:53:14.175Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8XzY5dCb2RY7JzXqF-LOQ.png" /></figure><h3>What is Hadoop</h3><p>Hadoop is a powerful open-source software framework designed for storing and processing large datasets across clusters of computers. It’s primarily used for big data analytics, enabling organizations to handle massive amounts of structured, semi-structured, and unstructured data that traditional systems can’t manage.</p><h3>Install Docker on PC</h3><p>For the Windows users : <a href="https://docs.docker.com/desktop/setup/install/windows-install/">Click here</a><br>For the Linux users : <a href="https://docs.docker.com/engine/install/ubuntu/">Click here</a><br>You can confirm docker installation by running this command.<br>docker run hello-world</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*GeB48i_UFQMR7NTAhJMzAQ.png" /></figure><h3>Setting up Hadoop cluster using Docker</h3><p>Download this repository : <a href="https://github.com/big-data-europe/docker-hadoop">Big Data Europe repository</a></p><p>Deploy the docker cluster using the command :<br>docker-compose up -d</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZU8U_CpTffNMs_dlXGGOag.png" /></figure><p>Check for running Docker containers :<br>docker ps</p><p>Can also confirm the containers using the Docker Desktop application (optional).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vmbar7x3dPYyN2k0mLnulA.png" /></figure><p>Can also be checked using the web page : <a href="http://localhost:9870/">http://localhost:9870/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eABAQJPrzEZJWNgARYdxdA.png" /></figure><h3>Writing a Java MapReduce Program</h3><p>Inside your local working directory, create three Java files:<br>TopIPMapper.java<br>TopIPReducer.java<br>TopIPDriver.java</p><p>Each file serves a purpose in the Hadoop MapReduce job:<br><em>TopIPMapper.java → Extracts IP address from each log line<br>TopIPReducer.java → Aggregates the counts of each IP address<br>TopIPDriver.java → Configures and runs the job</em></p><p>Download the files : <a href="https://drive.google.com/drive/folders/1f8FD_Ac2S-4_kS8mdwIDNtIHh3se9uy_?usp=sharing">Click here</a></p><h3>Test the Hadoop Cluster with a Custom MapReduce Job (Top IP Count)</h3><p>Once your Hadoop cluster is up and running using Docker, you can test it by running a <strong>custom MapReduce program</strong> that analyzes the <strong>NASA HTTP log dataset</strong> and counts how many times each IP accessed the server.</p><ol><li><strong>Access the Namenode Container</strong><br>Go inside to namenode container.</li></ol><pre>docker exce -it &lt;container-id&gt; bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*_A8IAKv4Fg2xZwGrBADKqg.png" /></figure><p>2. <strong>Copy Your Java Files to the Namenode</strong><br>From your PC, copy the Java files (TopIPMapper.java, TopIPReducer.java, and TopIPDriver.java) into the Namenode container. Go to location of the files in local PC.</p><pre>docker cp TopIPMapper.java &lt;container-id&gt;:/tmp/<br>docker cp TopIPReducer.java &lt;container-id&gt;e:/tmp/<br>docker cp TopIPDriver.java &lt;container-id&gt;:/tmp/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*N0SNPpak8EUAH7aGsCx7ng.png" /></figure><p>3. <strong>Compile and Build the JAR File</strong><br>Go to inside the Namenode container:</p><pre>cd /tmp<br>mkdir -p classes<br><br># Compile all Java files<br>javac -classpath `hadoop classpath` -d classes TopIP*.java<br><br># Create a JAR file<br>jar -cvf TopIPJob.jar -C classes/ .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*IWb53FtF7iG73N20kE8bZw.png" /></figure><p>4. Upload the NASA Log File to HDFS<br>For the project I used this Dataset : <a href="https://ita.ee.lbl.gov/html/contrib/NASA-HTTP.html">Click here</a><br>Download this dataset and upload into namenode container.<br>From the location of dataset available on your PC,</p><pre>docker cp NASA_access_log_Jul95.gz &lt;container-id&gt;:/tmp/</pre><p>Inside the container, create a directory in HDFS and upload the file:</p><pre>hdfs dfs -mkdir -p /input<br>hdfs dfs -put /tmp/NASA_access_log_Jul95.gz /input/</pre><p>5. Run the MapReduce Job<br>Execute the custom MapReduce job using Hadoop:</p><pre>hadoop jar /tmp/TopIPJob.jar TopIPDriver /input /output</pre><p><em>If the </em><em>/output directory already exists in HDFS, delete it first:</em></p><pre>hdfs dfs -rm -r /output</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwcNtSm7P9K_FVGV5FDyEw.png" /></figure><p>6. View the Output</p><pre>hdfs dfs -ls /output<br>hdfs dfs -cat /output/part-r-00000 | head -n 50</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PDN4W2pT49mg8IMOXdA7yQ.png" /></figure><p>This will display the top IP addresses and the number of times each one made a request.</p><p>Shutdown the Hadoop cluster by running on the host</p><pre>docker-compose down</pre><p>Thank you !!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ccf234bdcbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating AWS Tasks and Sending Notifications via Slack Without Lambda]]></title>
            <link>https://medium.com/@rangamaithreepala/automating-aws-tasks-and-sending-notifications-via-slack-without-lambda-f18cb1a5167f?source=rss-7946ceae1779------2</link>
            <guid isPermaLink="false">https://medium.com/p/f18cb1a5167f</guid>
            <dc:creator><![CDATA[Ranga Maithreepala]]></dc:creator>
            <pubDate>Sun, 15 Sep 2024 15:37:23 GMT</pubDate>
            <atom:updated>2024-09-15T15:37:23.827Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O1qxckxCgkCYGtJt0SieXw.png" /></figure><p>In one of my recent tasks, I had to automate a script running on an EC2 instance while passing some parameters. To achieve this, I utilized <strong>AWS Systems Manager Documents</strong> (SSM Documents). These documents allow you to run scripts on your instances, and the code is written in JSON format. The main thing to keep in mind is defining the parameters that need to be passed when executing the document.</p><h3>Creating an SSM Document with Parameters</h3><p>When creating an SSM document, the parameters must be clearly defined in the document itself. For instance, if I need to pass a script to run on an EC2 instance, I mention the parameters (such as instance ID, script path, etc.) within the document like so:</p><pre>{<br>  &quot;parameters&quot;: {<br>    &quot;InstanceId&quot;: {<br>      &quot;type&quot;: &quot;String&quot;,<br>      &quot;description&quot;: &quot;The ID of the instance.&quot;<br>    },<br>    &quot;ScriptPath&quot;: {<br>      &quot;type&quot;: &quot;String&quot;,<br>      &quot;description&quot;: &quot;The path of the script to run.&quot;<br>    }<br>  }<br>}</pre><h3>Assigning an AssumeRole with the Right Permissions</h3><p>The document must be executed with the correct permissions, and for that, I created an <strong>AssumeRole</strong>. This role needs specific permissions, such as access to SSM and the EC2 instance. For my task, the role required ssm:SendCommand and iam:PassRole permissions.</p><p>You should always follow the <strong>least privilege</strong> principle when assigning permissions. In my case, I needed the SSM document to access a particular instance and run the script, so I made sure the role had SSM access to the EC2 instance and the required IAM pass role permissions.</p><h3>Using AWS Secrets Manager for Sensitive Information</h3><p>In my case, the script required a key for execution. To securely store and retrieve this key, I used <strong>AWS Secrets Manager</strong>. Similar to the SSM document, I created another IAM role with least-privileged permissions to access Secrets Manager and retrieve the key when needed.</p><h3>Monitoring the Document Execution</h3><p>SSM documents return two statuses upon execution: Success and Failed. These statuses can be used to trigger other operations. For instance, if the document execution fails, I can handle the failure by sending notifications.</p><h3>Automating Execution with AWS Scheduler</h3><p>Once the document was working fine after multiple tests, the next step was to automate its execution. For this, I used <strong>AWS EventBridge Scheduler</strong>, which allowed me to schedule the document to run at specific times. Here’s how you can configure a scheduler:</p><pre>{<br>  &quot;DocumentName&quot;: &quot;MySSMDocument&quot;,<br>  &quot;DocumentVersion&quot;: &quot;1&quot;,<br>  &quot;Parameters&quot;: {<br>    &quot;InstanceId&quot;: &quot;i-xxxx&quot;,<br>    &quot;ScriptPath&quot;: &quot;/path/to/script.sh&quot;<br>  },<br>  &quot;ScheduleExpression&quot;: &quot;cron(0 10 ? * MON FRI *)&quot;<br>}</pre><p>In my task, I set the document to run every Monday and Friday at 10:00 AM (UTC+05:30). This automation ensures the document runs at specified intervals without manual intervention.</p><h3>Sending Notifications via Slack Using SNS and EventBridge</h3><p>When talking about notifications, it’s possible to directly integrate <strong>SNS</strong> with a Slack channel. However, in my task, SNS was integrated with <strong>AWS Chatbot</strong>, which was connected to Slack. One thing to note is that AWS Chatbot doesn’t accept all message formats; it can only process specific data from AWS services.</p><p>To work around this, I used <strong>AWS EventBridge Rules</strong> instead of direct SNS-to-Slack integration. I created two EventBridge rules:</p><ol><li><strong>Document Status Rule</strong>: This rule monitors the SSM document execution status. If the document fails, the rule sends the failed status to SNS, which then triggers a notification in Slack.</li><li><strong>Parameter Store Update Rule</strong>: I used <strong>AWS Systems Manager Parameter Store</strong> to update a parameter only when the script successfully completes its task. This rule watches the parameter update and, when successful, sends a notification to Slack via SNS.</li></ol><p>In summary, this automation workflow involved running an SSM document on an EC2 instance, securely passing parameters with Secrets Manager, scheduling the document with AWS Scheduler, and using EventBridge Rules and SNS to send notifications to Slack without using Lambda functions.</p><p>The key takeaway is that AWS provides multiple ways to automate tasks and trigger notifications without relying on custom code. By leveraging built-in services like SSM, Secrets Manager, EventBridge, and SNS, you can create a fully automated and secure solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f18cb1a5167f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VPC with servers in private subnets and NAT]]></title>
            <link>https://medium.com/@rangamaithreepala/vpc-with-servers-in-private-subnets-and-nat-ddf012f3d1cd?source=rss-7946ceae1779------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddf012f3d1cd</guid>
            <dc:creator><![CDATA[Ranga Maithreepala]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 08:44:11 GMT</pubDate>
            <atom:updated>2024-07-14T13:21:44.653Z</atom:updated>
            <content:encoded><![CDATA[<p>This example demonstrates how to create a VPC that you can use for servers in a production environment. To improve resiliency, you deploy the servers across multiple Availability Zones using an Auto Scaling group and an Application Load Balancer. For additional security, you place the servers in private subnets.</p><p>Applications are installed on the servers in private subnets using a Bastion host created in a public subnet. The servers receive requests through the load balancer and can connect to the internet using a NAT gateway. To further enhance resiliency, you deploy the NAT gateway in both Availability Zones.</p><h3>Overview</h3><p>This project demonstrates the creation of a Virtual Private Cloud (VPC) with public and private subnets, ensuring high availability and security. The VPC spans two Availability Zones, each containing a NAT gateway and an Application Load Balancer in the public subnets. Servers are deployed in private subnets using Auto Scaling groups, ensuring resiliency and load balancing. A Bastion host in a public subnet provides secure SSH access to the servers in private subnets, which receive traffic through the load balancers and access the internet via the NAT gateways. This setup ensures a robust and secure production environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PsxNwiP4xA9J0Xqu0kSog.png" /></figure><h3>1. Create the VPC</h3><ol><li>Open the Amazon VPC console at <a href="https://console.aws.amazon.com/vpc/">https://console.aws.amazon.com/vpc/</a>.</li></ol><p>2. On the dashboard, choose <strong>Create VPC</strong>.</p><p>3. For <strong>Resources to create</strong>, select <strong>VPC and more</strong>.</p><p>4. Configure the VPC:</p><ul><li>For <strong>Name tag auto-generation</strong>, enter a name for the VPC.</li><li>For <strong>IPv4 CIDR block</strong>, use the default value.</li></ul><p>5. For <strong>Number of Availability Zones</strong>, choose 2.</p><p>6. For <strong>Number of public subnets</strong>, choose 2.</p><p>7. For <strong>Number of private subnets</strong>, choose 2.</p><p>8. For <strong>NAT gateways</strong>, choose 1 per Availability Zone.</p><p>9. For <strong>VPC endpoints</strong>, select None.</p><p>10. Choose <strong>Create VPC</strong>.</p><h3>2. Create launch template</h3><p>Creating a launch template allows us to create a saved instance configuration that can be reused, shared, and launched at a later time.</p><ol><li><strong>Launch Template Name and Description</strong></li></ol><ul><li>Enter the name and description.</li></ul><p><strong>2. Application and OS Images (Amazon Machine Image) — Required</strong></p><ul><li>Click “Quick start”.</li><li>Select Ubuntu.</li><li>I used AMI ID: ami-04a81a99f5ec58529.</li></ul><p><strong>3. Instance Type</strong></p><ul><li>I used t2.micro.</li></ul><p><strong>4. Key Pair</strong></p><ul><li>Select or create a key for the instance. (I used a previously created key named key.pem).</li></ul><p><strong>5. Network Settings</strong></p><ul><li>Subnet: Do not change.</li><li>Firewall (Security Groups): Create a new security group.</li><li><strong>Security Group Name</strong>: ABC</li><li><strong>Description</strong>: ABC-SG</li><li><strong>VPC</strong>: Select the VPC that you created previously.</li><li><strong>Inbound Security Group Rules</strong>: Add rules to allow SSH access and expose the necessary application ports.</li></ul><p><strong>6. Create Launch Template</strong></p><h3>3. Create Auto Scaling Group</h3><ol><li><strong>Choose Launch Template</strong></li></ol><ul><li>Set a name for the Auto Scaling group.</li><li>Select the launch template you created previously.</li><li>Click <strong>Next</strong>.</li></ul><p><strong>2. Choose Instance Launch Options</strong></p><ul><li><strong>Network</strong>: Select the VPC you created previously and choose the Availability Zones and subnets as private subnets.</li><li>Click <strong>Next</strong>.</li></ul><p><strong>3. Configure Advanced Options</strong> (Optional)</p><ul><li><strong>Load Balancing</strong>: Select <strong>No Load Balancer</strong>.</li><li>Click <strong>Next</strong>.</li></ul><p><strong>4. Configure Group Size and Scaling</strong> (Optional)</p><ul><li><strong>Scaling Limits</strong>: Set limits on how much your desired capacity can be increased or decreased.</li><li>Click <strong>Next</strong>.</li></ul><p><strong>5. Review</strong></p><ul><li>Review all settings.</li><li>Click <strong>Create Auto Scaling group</strong>.</li></ul><h3>4. Launch Bastion Host</h3><ol><li><strong>Create EC2 Instance</strong></li></ol><ul><li>Launch an EC2 instance within the VPC you created.</li><li>Select the appropriate AMI and instance type.</li></ul><p><strong>2. Set Security Group</strong></p><ul><li>Create or select a security group for the Bastion host.</li><li>Ensure the security group allows inbound SSH access (typically on port 22) from your IP address.</li></ul><p><strong>3. Set Key Pair</strong></p><ul><li>Select or create a key pair for the instance. (In my case, I used a previously created key named key.pem).</li></ul><p><strong>4. Launch Instance</strong></p><ul><li>Complete the instance configuration and launch the instance.</li></ul><h3>5. Install Application on Private Servers</h3><p>Navigate to the PEM key file location and open terminal from there.</p><ol><li><strong>Login to Bastion Host</strong></li></ol><ul><li>Use the public IP and PEM key to SSH into the Bastion host.</li><li>Command: ssh -i key.pem ubuntu@{PUBLIC_IP_BASTION_HOST}</li></ul><p><strong>2. Push PEM Key to Bastion Host</strong></p><ul><li>Transfer the PEM key to the Bastion host using scp.</li><li>Command: scp -i key.pem key.pem ubuntu@{PUBLIC_IP_BASTION_HOST}:/home/ubuntu</li><li>scp: Secure copy command for transferring files over SSH.</li><li>-i key.pem: Specifies the PEM key to use for authentication.</li><li>key.pem: The PEM key file you are transferring.</li><li>ubuntu@{PUBLIC_IP_BASTION_HOST}: The username and public IP of the Bastion host.</li><li>/home/ubuntu: The destination path on the Bastion host.</li></ul><p><strong>3. Ensure PEM Key Availability</strong></p><ul><li>Make sure the PEM key is available on the Bastion host for SSH access to private servers.</li></ul><p><strong>4. SSH to Private Servers via Bastion Host</strong></p><ul><li>Use the private IPs of the servers to SSH from the Bastion host.</li><li>Command: ssh -i key.pem ubuntu@{PRIVATE_IP_SERVER}</li></ul><p><strong>5. Install Application on Servers</strong></p><ul><li>On each private server, create an HTML file and run a Python server:</li><li>Command: python3 -m http.server 8000</li></ul><p><strong>6. Repeat for All Private Servers</strong></p><ul><li>Install the application on all servers in the private subnets using the same steps.</li></ul><h3>5. Create Target Group</h3><ol><li><strong>Specify Group Details</strong></li></ol><ul><li><strong>Basic Configuration</strong>: Select <strong>Instances</strong>.</li><li><strong>Target Group Name</strong>: Enter Demo.</li><li><strong>Protocol</strong>: HTTP</li><li><strong>Port</strong>: Enter 8000 (or the port your application is exposed on).</li><li><strong>VPC</strong>: Select the VPC you created.</li></ul><p><strong>2. Register Targets</strong></p><ul><li>Select the instances from <strong>Available Instances</strong>.</li><li>Click <strong>Include as pending below</strong>.</li><li><strong>Create Target Group</strong></li><li>Click <strong>Create target group</strong>.</li></ul><h3>6. Create Load Balancer</h3><p><strong>Choose Load Balancer Type</strong></p><ul><li>Select <strong>Application Load Balancer</strong>.</li></ul><p><strong>Basic Configuration</strong></p><ul><li>Enter a name for the load balancer.</li></ul><p><strong>Network Mapping</strong></p><ul><li><strong>VPC</strong>: Select the VPC you created.</li><li><strong>Mappings</strong>: Select all the subnets and ensure they are public subnets.</li></ul><p><strong>Security Groups</strong></p><ul><li>Select the security group you created before (“ABC”).</li></ul><p><strong>Listeners and Routing</strong></p><ul><li>Select the target group you created.</li></ul><p><strong>Create Load Balancer</strong></p><p><strong>Wait for the status to change from Provisioning to Active</strong>. This may take a few minutes.</p><h3>6. Configuring Access to Your Application through the Load Balancer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*HVhrPSfpbOUla1iwGPxIpA.png" /></figure><p>To grant access to port 80 on your AWS Application Load Balancer (ALB), you typically need to configure the security group associated with the ALB. Here’s how you can do it:</p><ol><li><strong>Navigate to EC2 Console:</strong></li></ol><ul><li>Go to the AWS Management Console and navigate to the EC2 service.</li></ul><p><strong>2. Find Load Balancers:</strong></p><ul><li>Select “Load Balancers” from the left-hand menu.</li></ul><p><strong>3. Select Your ALB:</strong></p><ul><li>Click on the name of your Application Load Balancer.</li></ul><p><strong>4. View Security Groups:</strong></p><ul><li>Under the “Description” tab, find the section labeled “Security groups”.</li></ul><p><strong>5. Edit Security Group Rules:</strong></p><ul><li>Click on the security group linked to your ALB (usually named something like “ABC”).</li></ul><p><strong>6. Add Inbound Rule:</strong></p><ul><li>Add a new inbound rule:</li><li><strong>Type:</strong> HTTP</li><li><strong>Protocol:</strong> TCP</li><li><strong>Port Range:</strong> 80</li><li><strong>Source:</strong> 0.0.0.0/0 (This allows access from any IP address; for production, you might want to limit this to specific IPs or ranges.)</li></ul><p><strong>7. Save Rules:</strong></p><ul><li>Save the changes to the security group.</li></ul><p><strong>8. Access Your Application:</strong></p><ul><li>Once the security group rules are updated, you can access your application using the ALB’s DNS name over HTTP, typically like <a href="http://your-load-balancer-dns-name./">http://your-load-balancer-DNS-name.</a></li></ul><p>By following these steps, you ensure that port 80 (HTTP) is open on your Application Load Balancer, allowing incoming traffic to reach your application through the load balancer’s DNS name.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddf012f3d1cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps ඉගෙනගන්න Roadmap එකක්]]></title>
            <link>https://medium.com/@rangamaithreepala/devops-%E0%B6%89%E0%B6%9C%E0%B7%99%E0%B6%B1%E0%B6%9C%E0%B6%B1%E0%B7%8A%E0%B6%B1-roadmap-%E0%B6%91%E0%B6%9A%E0%B6%9A%E0%B7%8A-ace56ec0a75a?source=rss-7946ceae1779------2</link>
            <guid isPermaLink="false">https://medium.com/p/ace56ec0a75a</guid>
            <dc:creator><![CDATA[Ranga Maithreepala]]></dc:creator>
            <pubDate>Wed, 12 Jun 2024 04:03:11 GMT</pubDate>
            <atom:updated>2024-07-01T06:48:23.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*AwzpIkkT4puAedm-eY_JGw.png" /></figure><h4>What is DevOps</h4><p>DevOps is a culture that improves an organization’s ability to deliver applications.</p><p>හරි අපි බලමු මොකක්ද මේ DevOps culture කියන්නේ කියලා. ඔයාලා දන්නවා ඇති සොෆ්ට් එකක් developers අතින් develop කරයින් පස්සේ end user ල ගාවට යන process එකට සෑහෙන ලොකු කාලයක් ගන්නවා. Testing, code quality, deploy on testing / production servers වගේ දේවල් වෙන වෙනම engineers ල විසින් කරන නිසා මෙම කාර්යයට සැලකිය යුතු කාල වේලාවක් ගන්නව. හැබැයි අපිට පුළුවන් DevOps Engineer කෙනෙක් විසින් මෙම කාලය අඩු කරගෙන, හැබැයි නියමිත ප්‍රමිතියෙන් යුතු product එකක් user ලට දෙන්න.</p><h4>Main Operations of a DevOps Engineer</h4><p>- Improving delivery process<br>- Automating everything<br>- Quality<br>- Monitoring<br>- Testing</p><h4>ඇයි DevOps engineerකෙනෙක් ඕනේ</h4><p>අපි software කම්පනයක් සලකදී ඒවා විවිධ පරිමාණ මත පැවතිය හැක. Small scale software companies වලදී software delivery process එක කරන්නේ ද Software engineer විසින්මයි. නමුත් larger scale companies වල application ගොඩක් ගැන වගකීම තිබෙන නිසා software delivery process එක සහ ඒවාගේ monitoring කටයුතු පිළිබඳව DevOps engineer කටයුතු කරයි. DevOps engineer ගේ ප්‍රධාන කාර්යය තමා පුද්ගලයන් රැසක් එකතු වී manual කරන කාර්යයන් හැකි උපරිම පමණින් automate කිරීම. එලෙස automate කිරීම නිසා තමා software delivery process එකේ efficiency එක වැඩි වෙන්නේ සහ organization එකට හැකි ඉක්මනින් ම application එකේ user ට ලබා දීමට හැකිවෙන්නේ.</p><h4>Improve SDLC with DevOps</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*KW0ZVbbDuKarRW2B_77rIA.png" /></figure><p>මේ විදිහට අපිට software development lifecycle එක ගත්තම, DevOps engineer කෙනෙක්ට engage පුළුවන් ස්ටේජස් තුන විදිහට building, testing, deployment නම් කරන්න පුළුවන්. අපි බලන්න ඕනි DevOps engineer කෙනෙක් විදියට කොහොමද මේ stages තුන automate කරන්නේ කියලා.</p><h4>The Tools That We Need to Know as DevOps Engineers / Why and When</h4><h4>VM — Virtual Machine</h4><p>VM එකක් කියලා කියන්නේ ෆිසිකල් මැෂින් එකේ operating system එක උඩ Run වෙන තවත් මැෂින් එකක්. අපිට තියෙන්නෙ ෆිසිකල් මැෂින් එකයි, ඒ physical මැෂින් එකේ resources භාවිතා කරලා රන් වෙන OS ( operating system ) එක උඩ, එම resources වලින්ම කොටසක් පමණක් භාවිතා කරලා අපිට VM හදාගන්න පුළුවන්. ඒ විදිහට අපිට තියෙන resources ප්‍රමාණය මත පදනම්ව කැමති ප්‍රමාණයක් VM හදාගන්න පුළුවන්. හරි, අපි දැන් බලමු කොහොමද real applications, run වෙන්න VM හදාගන්න කොහොමද කියලා.<br>අද වන විට organization සෑහෙන ප්‍රමාණයක් On premises data centers වලට සමුදීල cloud providers ලා විසින් ලබාදෙන සේවාවන් භාවිතා කරනවා. ඒ කියන්නේ අපි අපේ VM සාදන්නේ වෙනත් කොහේ හරි තියෙන server එක්ක. ඒ විදිහට එම සේවාවන් ලබාදෙන companies ගොඩක් තියෙනවා. AWS, Microsoft Azure, GCP, Alibaba, IBM, Digital ocean, Oracle වගේ ගොඩක් තියෙනවා . නමුත් අපිට විවිධ හේතුන් මත පදනම්ව මේවායින් එකක් හෝ කිහිපයක්, විවිධ සේවාවන් සඳහා භාවිතා කිරීමට හැක. උදාහරණයක් විදිහට අපි AWS cloud provider සලකමු. මෙහිදී අපට සරලවම කරන්න තියෙන්නේ පට අවශ්‍ය VM හි අවශ්‍යතා අනුව ඉල්ලීමක් කිරීම පමණි. එවිට එම ආයතනය විසින් අපට අවශ්‍ය VM එකක් ඔවුන්ගේ server එක මත සාදා එම VM එකට ලොග් වීම සඳහා අවශ්‍ය කරන ip addresses සහ ෆයිල් (.pem) ලබා දෙයි.</p><h4>Create VM on AWS</h4><p>සාමාන්‍යයෙන් developer කෙනෙක් මේක කරන්නේ AWS console එකෙන් VM ( EC2 instance ) එකක් හදන එක එයාලගේ requirements අනුව. නමුත් අපි හිතමු ලොකු කොම්පැණිය එක්ක ඒ විදිහට instances ගොඩක් හදන්ඩ උවමනාවක් ආව කියල. ඒ වගේ අවස්ථාවකදී කලින් කිව්ව විදිහ ගොඩක් කාලය යන වැඩක්. ඒකට විසඳුමක් ලෙස Devops engineer ට script code ලියන්න පුළුවන් ( Python ). මේවා run කරලා ලේසියෙන්ම අපිට අවශ්‍ය EC2 instances හදාගන්න පුළුවන්. කලින් කිවනේ devops engineer කරන්නේ ම efficiency එක වැඩි කරන එක කියලා software develop, deployment process එකේ. අන්න ඒ වගේ එක අවස්ථාවක් තම මේක. මේකෙන් කරන්නේ automate කරන එක, අපි AWS එකට ගිහිල්ලා එකින් එක කරන්න ඕනි වැඩේ. මේ වැඩේ කරන්න අපිට tools කීපයක් භාවිතා කරන්න පුළුවන්. AWS CLI, AWS API, AWS CFT, AWS CDK. AWS එකෙන් හදලා තියෙන මේ tools වලින් අපිට ඒ දේවල් කරන්න පුළුවන්. ඒත් අපි හිතමු අපි පාවිච්චි කරන්නේ එයාලගේ සේවාවන් විතරක් නෙවෙයි කියලා. එහෙම වුණහම ඒ ඒ cloud providers ලාට අදාල tools කොහොමද කියලා ආයි ඉගෙන ගන්න වෙනවා. නමුත් අපිට ලේසියි නේද මේ හැම එකක්ම වෙනුවෙන් පාවිච්චි කරන්න පුළුවන් තනි tool එකක් තිබුණා නම්. අන්න ඒ වෙනුවෙන් හදපු ටූල් එකක් තමයි Terraform කියලා කියන්නේ. එක මගින් අපිට ඕනි කරන ඕනිම cloud provider කෙනෙක් එක්කන් ගනුදෙනු කරන්න පුළුවන්. මේ විදිහට අපිට ඕනි කරන ඔනිකරන සේවාවන්වල ( EC2 , s3 🪣 ) infrastructure එක code එක්කින් define කරන tools වලට පොදුවේ කියනවා infrastructure as a Code ( IaC ) ටූල්ස් කියලා.</p><h4>Linux &amp; Shell scripting</h4><p>Servers වල run වෙන OS එක තමා Linux. Why linux? එක free, opensource, high security ඒ වගේම fast වැඩ කරන්නත් පුළුවන්. ඒ වගේ හේතූන් නිසා අපි servers වල හදන VM වලත් බොහෝ දුරට ලිනක්ස් පාවිච්චි කරනවා. ඒවාගේම විවිධ අවශ්‍යතාවයන්නට වෙනත් OS භාවිතා කරනවා වෙන්න පුළුවන්. මෙන්න මේ විදියට හදාගත්ත VM එකත් එක්ක ගනුදෙනු කරන්න පුළුවන් විදිහ තමා shell scripts කියන්නේ. Shell is the way that we call our operating system. හරි අපි දැන් බලමු ඒකෙන් මොනවද අපිට කරන්න පුළුවන් කියලා. කලින් කතා කරා වගේ AWS cloud provider දෙන services පොඩ්ඩක් බලමු. EC2 , s3 🪣, Lambda, IAM වගේ එයාලා ගොඩක් සේවාවන් ලබාදෙනවා. අපි devops engineer කෙනෙක් විදියට මේවා maintain කරන්න ඕනේ. AWS එකේ resources usage එක අපි monitor කරන්නොනි. අන්න ඒ වගේ දේවල් වලට අපිට පුළුවන් shell script භාවිතා කරන්න.</p><p>තව තියෙනව …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ace56ec0a75a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy React project on Github Pages]]></title>
            <link>https://medium.com/@rangamaithreepala/deploy-react-project-on-github-pages-f971b210638a?source=rss-7946ceae1779------2</link>
            <guid isPermaLink="false">https://medium.com/p/f971b210638a</guid>
            <dc:creator><![CDATA[Ranga Maithreepala]]></dc:creator>
            <pubDate>Sun, 26 May 2024 05:40:03 GMT</pubDate>
            <atom:updated>2024-05-26T05:40:03.204Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Roadmap" src="https://cdn-images-1.medium.com/max/700/1*nF8RGdiA3b7GLPAMlfnOqQ.png" /></figure><p>GitHub Pages is a service provided by GitHub that allows us to host websites from our GitHub repository. By using it, we can host static websites, such as personal blogs, project documentation, or portfolio sites. You can deploy your site live by referring to this article within a few minutes.</p><p><em>Prerequisites : “ You should push your source code to the repository.”</em></p><p>Now, open your project from VS code and open terminal.</p><pre>npm install gh-pages --save-dev</pre><blockquote>Then move to the <em>package.json</em> file and do these changes.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*3A5ynMFga2DsErmdRAp2hQ.png" /></figure><blockquote>Change the following piece of code according to your Github username and your Repository name.</blockquote><pre>&quot;homepage&quot;: &quot;https://(github username).github.io/(repo name)&quot;</pre><p>Now, change the scripts in the same package.json file as follows.</p><pre>&quot;predeploy&quot;: &quot;npm run build&quot;<br>&quot;deploy&quot;: &quot;gh-pages -d build&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*Bt_WG8NVzH7_z9c4TwgVxw.png" /></figure><p>Do you want to see your last commit live? Run this command.</p><pre>npm run deploy</pre><p>After a few minutes, you can visit your website by following these steps:</p><ol><li>Open your source code repository</li><li>Move to Settings tab</li><li>Click Pages on Code and automation section</li><li>Visit your website</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WQz4D6oxn853C1i-U99pgg.png" /></figure><p>Thank you! 🎉 If you have any more questions or need further assistance, feel free to ask!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f971b210638a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>