<?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 Nuwan Wijewardane on Medium]]></title>
        <description><![CDATA[Stories by Nuwan Wijewardane on Medium]]></description>
        <link>https://medium.com/@nuwanwi?source=rss-689d25ff3dc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bf3MfKiVuN8csm6s4XzX4A.jpeg</url>
            <title>Stories by Nuwan Wijewardane on Medium</title>
            <link>https://medium.com/@nuwanwi?source=rss-689d25ff3dc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:39:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nuwanwi/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[IoT enabled Hydroponics for Smart Farm]]></title>
            <link>https://medium.com/@nuwanwi/iot-enabled-hydroponics-for-smart-farm-a1623b28a7da?source=rss-689d25ff3dc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1623b28a7da</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[farming-technology]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[hydroponics]]></category>
            <category><![CDATA[smart-farming]]></category>
            <dc:creator><![CDATA[Nuwan Wijewardane]]></dc:creator>
            <pubDate>Mon, 31 Aug 2020 04:00:02 GMT</pubDate>
            <atom:updated>2020-08-31T04:00:02.179Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0O1xTCx-Xbolmx8f76yFKQ.jpeg" /></figure><p>February 2020 I was on a vacation in Sri Lanka as I got a one month holiday during my job transition. It was a long awaited holiday with my family where we decided to visit the parents in my hometown. They lived in a city called Nuwara eliya surrounded by breathtaking mountains and waterfalls known for its lush green environment and splendid beauty . Which also attracts lots of tourists from all over the world for its fascinating weather conditions, More importantly popular among locals for growing specialised vegetables and fruits ideally suites the weather conditions.</p><p>But I never thought things will change so fast in last few weeks of my holiday due to covid-19 outbreak and travel restrictions.It was an amazing timing to get stuck in a such a disconnected and beautiful place.</p><p>I had plenty of time to be with my entire family and ample time to catch up with my dad where I enjoyed spending lots of time in his farm.I found it very interesting to visit the farm and it was a good opportunity for me to learn something really important and i thought it may be a demanding subject area after the outbreak. My dad’s farm inspired me to think something towards agricultural point of view. As a software professional i wanted to invest more time towards this specific area and learn something new, Problems they face and probably provide some answers which can be benefited to the whole farming community.</p><p>After few visits I have listed down some of the common problems that my dad and his friends are is facing and in general this list might applicable for most of the local farmers in the community as well.</p><ol><li>Fertiliser usage is not scientific where farmers do the calculations according to their own choice.</li><li>In most cases farmers are disconnected, Where there is very less communication with other farmers.</li><li>They use conventional farming techniques where an uninterrupted water supply is required.</li><li>Farmers heavily rely on monsoon weather, Which is highly unpredictable due to the climate change.</li><li>Crop selection was based on farmers past experience and in harvesting time there isn’t a good market demand as majority of farmers shares same thinking pattern and end up growing same crops.</li><li>Current techniques requires considerable involvement of labor where the labour prices has gone up rapidly over the time.</li></ol><p>I wanted to provide some solutions to the problems that my father and other farmers in the community are facing.Where I did a small research and observed some interesting things and modern farming technologies which can be used to overcome lots of problems. I thought of designing a hybrid technology combination with the help of some emerging concepts. A technology like a hydroponic system would easily solve lots of problems. But would hydroponic system itself can solve all of these problems , Using basic hydroponic systems will reduce the water requirement by almost 90%. Solution should be a combination of different modern techniques which will help lots of local farmers.</p><p>I started on designing a solution which is an intelligent hydroponic farming solution which automatically detect the farm temperature, humidity, EC, pH, light intensity, watering and fertilising. For Eg : Water has tendency to change the temperatures due to various environmental constraints which will hamper the rooting or plants altogether. Water temperature sensors can be deployed over the hydroponics farm and farmers can be alerted accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dztOCRP1R5WVpxwiqgcfAw.png" /><figcaption>Combination of farming technologies and IoT sensors</figcaption></figure><p>Similarly PH sensor can alert the PH level and the farmers can change in the nutrition levels and can be pump minerals in suitable amounts. An assortment of sensors and controllers like ESP-8266, Arduino and Raspberry Pi etc. can be used to instrument and automate a hydroponics farm.These smart farming IoT solutions allow farmers to use sensors, gateways, and monitoring systems to collect and analyse data and make informed decisions.</p><p>Phase 1 — Hydroponics system , IoT device installation and node-red dashboard for temperature and humidity sensors.</p><p>Phase 2 — IoT devices installation for greenhouse and complete dashboard.</p><p>Phase 3 — IoT device installation for normal farm with mobile app and portal.</p><p>In this article i am going to focus on the hydroponics part (Phase 1) , I have designed the initial structure by considering the factors such as mobility, space utilisation , cost effectiveness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1GeeeFuMOd30h-54fiicrQ.jpeg" /><figcaption>Basic structure of the smart hydroponic system</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zlKQDvsEenDW7TCEbwR_9A.jpeg" /><figcaption>3.5 ‘ PVC pipes layered to layered to utilize the space effectively</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YElmtqoLnKyJEsldXG8tcg.jpeg" /><figcaption>Pvc pipe layout</figcaption></figure><p>Once the pipes are placed properly they should interconnected using reducers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3Fb-Pp4fP8PtvsgxM7hVg.jpeg" /><figcaption>Continuous water supply from submersible pump</figcaption></figure><p>Submersible water pump installed inside the bucket which controls the flow of water.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cmTWE7diSzEBilwWgcA14g.jpeg" /><figcaption>Strawberries</figcaption></figure><p>Plants started to grow as normal with very less amount of water and especially without soil.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HWPi00d25YAWSXHUNu_6Aw.jpeg" /></figure><p>Sensors used in the hydroponics system</p><ol><li>Ultrasonic sensor to determine the water level.</li><li>PH sensor.</li><li>Room temperature and humidity sensor.</li><li>Water temperature sensor.</li><li>Soil moisture sensor.</li><li>Light intensity sensor.</li><li>Rain sensor.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n4kzKxN3Ew0MqcMckmSDSw.jpeg" /><figcaption>Sensors required for hydroponic system</figcaption></figure><p>In the first phase i am going to connect room temperature sensor (DHT11 sensor) with Raspberry PI 4 Model B, Which will push current temperature and humidity to the dashboard and accordingly room temperature can be adjusted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6zFFtY2FlEJFygBnHN5hTg.png" /><figcaption>Hydroponics farm — Node-Red flow</figcaption></figure><p>Following is the Dashboard with the desired action buttons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xS-w5qzhG7bzONjrsWc-_g.png" /><figcaption>Smart farm Dashboard</figcaption></figure><p>Accordingly all other sensors can be connected to Raspberry PI and the Node-Red flow should be adjusted accordingly as per the architecture diagram.</p><p>By introducing IoT based hydroponics system, Lots of issues or problems can be addressed,</p><ol><li>Fertiliser usage can be controlled by analyzing the PH level from the dashboard.</li><li>Farmers in the community can be connected through a portal.</li><li>Water supply problem can be addressed through the hydroponics system as it uses very little amount of water and the water level sensor allows to detect the water leakage or low water levels.</li><li>With the help of hydroponics system farmers has the liberty to choose the crop regardless of the season.</li><li>IoT enabled system allows to reduce lots of manual work.</li></ol><p>This approach will help the farmers at least minimize some of the burning issues that they were facing for long time. I will be covering Phase 2 and Phase 3 in future articles which will eventually enables farmers to produce good harvest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1623b28a7da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking the Monolith using Docker, .net Core, Nginx, Amazon ECS and AWS Fargate]]></title>
            <link>https://medium.com/@nuwanwi/breaking-the-monolith-using-docker-net-core-nginx-amazon-ecs-and-aws-fargate-1fd20ebb8276?source=rss-689d25ff3dc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fd20ebb8276</guid>
            <category><![CDATA[aws-fargate]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws-ecs]]></category>
            <dc:creator><![CDATA[Nuwan Wijewardane]]></dc:creator>
            <pubDate>Fri, 14 Jun 2019 04:51:04 GMT</pubDate>
            <atom:updated>2019-06-14T04:51:04.889Z</atom:updated>
            <content:encoded><![CDATA[<h3>Breaking the Monolith using Docker, .net Core, Nginx, Amazon ECS and AWS Fargate</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1gkFx4Op7AuDTpLYjb3Lw.png" /></figure><p>Transforming monolithic software applications to Microservices based architecture is a very demanding nowadays. Many organisations already started this epic journey as they are gradually moving applications.Monolithic applications becoming too large to deal with in some point of time everybody needs to rethink about this journey even though there are some noticeable challenges involved.</p><p>In this article i will be exploring and sharing the steps how to host a .net Core microservices application with Nginx reverse proxy with docker to AWS ECS with Amazon Fargate. There are some steps involved but nothing complicated and found very easy to deal with detailed AWS documentations.</p><p><strong>What we need.</strong></p><p>01. Visual Studio Code <br>02. Docker installation <br>03. AWS CLI</p><p><strong>Step 1- Create .net core web API using command line app and publish it</strong></p><p>mkdir customer<br>cd customer<br>dotnet new webapi <br>dotnet restore<br>dotnet build <br>dotnet publish -C “Release”</p><p><strong>Step 2 — Add docker support to the customer api</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*vyewYcqjP9ebvHD8U-tBDw.png" /><figcaption>Add docker file under the customer</figcaption></figure><p>Add bellow in your DockerFile , Refer docker docs for more info</p><p>FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim AS base<br>WORKDIR /customer<br>COPY bin/Release/netcoreapp2.1/publish . <br>ENV ASPNETCORE_URLS <a href="http://+:5000/">http://+:5000</a><br>EXPOSE 5000 <br>ENTRYPOINT [“dotnet”, “customer.dll”]</p><p><strong>Step 3 — Create a reverse proxy using nginx and add docker support</strong></p><p>A reverse proxy is a server that sits between internal applications and external clients, forwarding client requests to the appropriate server. While many common applications are able to function as servers on their own, NGINX has a number of advanced load balancing, security, and acceleration etc..</p><p>cd ..<br>mkdir reverseproxy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/176/1*NBL95OIu-SY9OGq3D9NINA.png" /></figure><p>To enable docker to the reverse proxy add bellow in your DockerFile</p><p>FROM nginx<br>COPY nginx.conf /etc/nginx/nginx.conf</p><p>Configure the reverse proxy properly it will listen to the port 70 and rout the traffic to the internal port 5000</p><p>worker_processes 4; <br>events { worker_connections 1024; } <br>http {<br> sendfile on; <br> upstream app_servers {<br> server customer:5000;<br> } <br> server {<br> listen 70; <br> location / {<br> proxy_pass <a href="http://app_servers/">http://app_servers</a>;<br> proxy_redirect off;<br> proxy_set_header Host $host;<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> proxy_set_header X-Forwarded-Host $server_name;<br> }<br> }<br>}</p><p><strong>Step — 4 Create a Docker-Compose file</strong></p><p>Docker compose is a tool for defining and running multi container apps. Since we are using a multi container app (customer container and reverseproxy container ) we should use docker compose which will enable us to start all the services by one command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/181/1*xnU7KCtOx_lQH7vuiWB7cg.png" /></figure><p>version: ‘2’<br>services:<br> customer:<br> build:<br> context: ./customer<br> dockerfile: Dockerfile<br> expose:<br> — “5000”<br> reverseproxy:<br> build:<br> context: ./reverseproxy<br> dockerfile: Dockerfile<br> ports:<br> — “70:70”<br> links :<br> — customer</p><p><strong>Step 5— Build the images and run it locally</strong></p><p>docker-compose build<br>docker-compose up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*IXBETEddkovJXDaeH5mhYA.png" /></figure><p>Now all set :) , Application can be access through the reverse proxy <a href="http://localhost:70/api/values">http://localhost:70/api/values</a></p><p><strong>Step 6 — Push the containers to Amazon ECR</strong></p><p>Amazon Elastic Container Registry (ECR) is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. Amazon ECR is integrated with Amazon Elastic Container Service (ECS)</p><p>Use bellow commands makes sure you already installed aws cli , first use aws configure to log in to the aws using your app id</p><p>aws configure <br>aws ecr get-login — no-include-email — region us-east-2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*VD1nGatO2wvdClH6Py2biQ.png" /></figure><p>Once you receive the <strong>docker login text</strong>, Paste it in the console to log in to the docker.</p><p>Once the docker login is successful, All set to push the images , Now Tag and Push (X****X == your aws account number)</p><p>You can check all the images by — <strong>docker images</strong> before tagging.</p><p><strong>Step 7 — Create relevant repositories in the ECS</strong></p><p>Amazon Elastic Container Service (Amazon ECS) is a highly scalable, high-performance container orchestration service that supports Docker containers and allows you to easily run and scale containerized applications on AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2xNm_X-qcniFxFGjSJo8A.png" /></figure><p><strong>Step 8 — Tag and Push</strong></p><p><strong>a) Tag the customer image using bellow command</strong></p><p>docker tag servicehub_customer:latest X****X.dkr.us-east-2.amazonaws.com/customer:latest</p><p><strong>b) Push the customer image </strong><br>docker push X****X.dkr.us-east-2.amazonaws.com/customer:latest</p><p><strong>c) Tag the reverseproxy image using bellow command</strong></p><p>docker tag servicehub_reverseproxy:latest X****X.dkr.us-east-2.amazonaws.com/reverseproxy:latest</p><p><strong>d) Push the reverseproxy image</strong></p><p>docker push X****X.dkr.us-east-2.amazonaws.com/reverseproxy:latest</p><p>Well, Now most of the<strong> hard work is done</strong>, Next will log in to aws and make sure our containers are grouped, Load Balanced, linked properly.</p><p><strong>Step 9 — Create amazon ECS Cluster and select networking only</strong></p><p>An Amazon ECS cluster is a regional grouping of one or more container instances on which you can run task requests. Each account receives a default cluster the first time you use the Amazon ECS service. Clusters may contain more than one Amazon EC2 instance type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*55WUV9iEbt-8BGbFhWqHLg.png" /></figure><p>Once the creating the cluster gets successful, It will create a cloud formation stack also</p><p>A stack is a collection of AWS resources that you can manage as a single unit. In other words, you can create, update, or delete a collection of resources by creating, updating, or deleting stacks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*uHyoP6HAhR-TkZ3NlgHm4w.png" /></figure><p><strong>Step 9 — Choose an Application Load Balancer</strong></p><p>Application Load Balancers provide advanced routing and visibility features targeted at application architectures, including microservices and containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HYLmqJwITB3HKeA437zcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*fi-r4KZS6R-8YcmZ7yINnw.png" /></figure><p><strong>Step 10 — Create new task definition</strong></p><p>Task definitions specify the container information for your application, such as how many containers are part of your task, what resources they will use, how they are linked together, and which host ports they will use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*ZAtW515Kg8Zetx9Ms42XGA.png" /></figure><p>Make sure not to use any special characters for the container names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*D8QLkBpsYfi0C4U893nKUQ.png" /></figure><p><strong>Amazon ECS Task Definitions</strong>. A <strong>task definition</strong> is required to run Docker containers in <strong>Amazon ECS</strong>. Some of the parameters you can specify in a <strong>task definition</strong> include following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*3BEjtKAuAQsrS5JnzqOc-g.png" /></figure><p>— The Docker image to use with each container in your task<br> — How much CPU and memory to use<br> — The launch type to use<br> — The Docker networking mode<br> — The logging configuration to use for your tasks<br> — Whether the task should continue to run if the container finishes or fails<br> — The command the container should run when it is started<br> — Any data volumes that should be used with the containers in the task<br> — The IAM role that your tasks should use</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*gS6UoRHXxKZuPdtkGjl68g.png" /></figure><p>Amazon ECS allows you to run and maintain a specified number of instances of a task definition simultaneously in an Amazon ECS cluster. This is called a service. If any of your tasks should fail or stop for any reason, the Amazon ECS service scheduler launches another instance of your task definition to replace it and maintain the desired count of tasks in the service depending on the scheduling strategy used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*WoL_7NQDFy7_WBlrHSdlNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*dtFzoODsBgUD-Dyqht0RfQ.png" /></figure><p>Yes , We did it !!!!!!!!!!!!!!!!!!!!</p><p>Containers are up and running with the reverse proxy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*MdZxuqBQ6DGNOiRT_B5TFw.png" /></figure><p>you can configure cloud watch now.</p><p>Amazon CloudWatch is a monitoring and management service built for developers, system operators, site reliability engineers (SRE), and IT managers.</p><p>References</p><ul><li><a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html">What is Amazon Elastic Container Service?</a></li><li><a href="https://docs.docker.com/"></a></li><li><a href="https://aws.amazon.com/blogs/compute/hosting-asp-net-core-applications-in-amazon-ecs-using-aws-fargate/">Hosting ASP.NET Core applications in Amazon ECS using AWS Fargate | Amazon Web Services</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fd20ebb8276" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>