<?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 saurabh prakash on Medium]]></title>
        <description><![CDATA[Stories by saurabh prakash on Medium]]></description>
        <link>https://medium.com/@saurabhpresent?source=rss-36cb0283fbf5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by saurabh prakash on Medium</title>
            <link>https://medium.com/@saurabhpresent?source=rss-36cb0283fbf5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 05:46:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saurabhpresent/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[Setting Jenkins for mac]]></title>
            <link>https://medium.com/@saurabhpresent/setting-jenkins-for-mac-f9962b7ac146?source=rss-36cb0283fbf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9962b7ac146</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[saurabh prakash]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 11:42:44 GMT</pubDate>
            <atom:updated>2019-07-23T11:44:17.970Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*2VBB1w8-17XT8q5AVCTv1A.jpeg" /><figcaption>jenkins+mac+setup</figcaption></figure><p>This story will try to provide quick reference for mac installation for Jenkins.</p><ol><li>Download(and run) the mac installer of Jenkins from this link: <a href="https://jenkins.io/download/thank-you-downloading-osx-installer-stable/">https://jenkins.io/download/thank-you-downloading-osx-installer-stable/</a></li><li>Post installation, if you want to change port use following command: “sudo defaults write /Library/Preferences/org.jenkins-ci httpPort &lt;custom-port-number&gt;”</li><li>To view all settings in the file, use following command: “defaults read /Library/Preferences/org.jenkins-ci”</li><li>To get the value of a single setting, use following command: “defaults read /Library/Preferences/org.jenkins-ci SETTING”</li><li>To set the value of a setting, use following command: “sudo defaults write /Library/Preferences/org.jenkins-ci SETTING VALUE”</li><li>To manually start the daemon: “sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist”</li><li>To manually stop the daemon: “sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist”</li><li>If Jenkins gives a blank page, Open this url: <a href="http://localhost:8080/restart">http://localhost:8080/restart</a> (Edit the port number as per your installation)</li><li>For uninstallation, use following command: ‘/Library/Application Support/Jenkins/Uninstall.command’</li></ol><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9962b7ac146" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Springboot war deploy in docker tomcat]]></title>
            <link>https://medium.com/@saurabhpresent/springboot-war-deploy-in-docker-tomcat-3fd09044b19a?source=rss-36cb0283fbf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fd09044b19a</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[spring-boot-2]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[tomcat]]></category>
            <category><![CDATA[war]]></category>
            <dc:creator><![CDATA[saurabh prakash]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 07:45:54 GMT</pubDate>
            <atom:updated>2019-10-26T17:54:37.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*J6GWNBf6ArDsOHdnk_EGqg.png" /><figcaption>Springboot War deployment using docker</figcaption></figure><p>This article provides quick overview to deploy you springboot created war to docker tomcat.</p><p><strong>Step 1</strong>: Create a docker file(Dockerfile) inside module which is used to build war, Following would be contents of docker file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6919ae2a2d8bbe022f03f42e4a5db608/href">https://medium.com/media/6919ae2a2d8bbe022f03f42e4a5db608/href</a></iframe><p><strong>Step 2</strong>: Install docker(if not present already)</p><ol><li>Mac: <a href="https://docs.docker.com/docker-for-mac/install/">https://docs.docker.com/docker-for-mac/install/</a></li><li>Windows: <a href="https://docs.docker.com/docker-for-windows/install/">https://docs.docker.com/docker-for-windows/install/</a></li><li>Ubuntu: <a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/">https://docs.docker.com/install/linux/docker-ce/ubuntu/</a></li><li>Centos: <a href="https://docs.docker.com/install/linux/docker-ce/centos/">https://docs.docker.com/install/linux/docker-ce/centos/</a></li><li>Through binaries: <a href="https://docs.docker.com/install/linux/docker-ce/binaries/">https://docs.docker.com/install/linux/docker-ce/binaries/</a></li></ol><p><strong>Step 3</strong>: Create your docker image: “<strong><em>docker image build -t &lt;image-name&gt; .</em></strong>” (before doing this your war should be present in your /target folder)</p><p><strong>Step 4</strong>: Run docker container: “<strong>docker container run -p &lt;host port where to expose application&gt;:8080 -d</strong> <strong><em>&lt;image-name&gt;</em></strong>”</p><p><strong>Step 5</strong>: Running application would be accessible on: “<strong><em>&lt;host machine url&gt;:&lt;host machine port&gt;/</em>name_of_war<em>/</em></strong><em>”</em></p><p>Additional docker commands which will be useful</p><ol><li>For checking application logs: “<strong><em>docker container logs</em> <em>&lt;container-id or container-name&gt;</em></strong>”</li><li>On update/release of new image, before running new container for stopping existing container use this command: “<strong><em>docker container stop &lt;container-id or container-name&gt;</em></strong><em>”</em></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fd09044b19a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reading contents from servlet request (including files) through Springboot controllers | Generic…]]></title>
            <link>https://medium.com/@saurabhpresent/reading-contents-from-servlet-request-including-files-through-springboot-controllers-generic-7681ec19ffab?source=rss-36cb0283fbf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7681ec19ffab</guid>
            <category><![CDATA[httpservletrequest]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[saurabh prakash]]></dc:creator>
            <pubDate>Fri, 31 May 2019 07:41:40 GMT</pubDate>
            <atom:updated>2019-05-31T07:41:40.245Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reading contents from servlet request (including files) through Springboot controllers | Dynamic content handler for requests</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*rDDUaNlx2uJT_DWCSa_o1Q.png" /><figcaption>Dynamic payload handler in springboot</figcaption></figure><p>Though its not a very big problem statement, I found lack of any structured document around this problem(on google), so though of writing it.</p><p>Why this is important: Springboot by default has validation and type checking for all the request parameter and body, So if you’re in a situation where you want to provide support for generic/variable payloads, reading payload data from HttpServletRequest approach can be used.</p><p>Controller which is taking the request, If you’re handling files we should read request as “MultipartHttpServletRequest” else if files are not present we can use “HttpServletRequest”, Please find running code below which does same using MultipartHttpServletRequest.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/685adbcf0152150fe09022fdd1a54224/href">https://medium.com/media/685adbcf0152150fe09022fdd1a54224/href</a></iframe><p>Thanks for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7681ec19ffab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started on Elasticsearch + Logstash + Kibana + Filebeat (for Nginx logs analysis)]]></title>
            <link>https://medium.com/@saurabhpresent/getting-started-on-elasticsearch-logstash-kibana-filebeat-for-nginx-logs-analysis-d567999d7846?source=rss-36cb0283fbf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d567999d7846</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[elk]]></category>
            <category><![CDATA[kibana]]></category>
            <category><![CDATA[logstash]]></category>
            <dc:creator><![CDATA[saurabh prakash]]></dc:creator>
            <pubDate>Fri, 04 May 2018 07:10:42 GMT</pubDate>
            <atom:updated>2018-05-04T07:10:42.428Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyM0Zht98RhkBQWfvd_h7Q.png" /></figure><p>This stories tries to cover a quick approach for getting started with Nginx logs analysis using ELK stack, Its will provide a developer as starting point of reference for using ELK stack. It doesn&#39;t cover the details of working of these individual components. Also I’ll try to cover certain key aspects which I found missing in the other earlier written getting started docs for same purpose.</p><p>Make sure following components are already running:</p><ul><li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.2/install-elasticsearch.html">Elasticsearch</a> is already setup and working(on port 9200).</li><li><a href="https://www.elastic.co/guide/en/kibana/current/install.html">Kibana</a> is already setup and working(on port 5601).</li></ul><p>Install/Download logstash from following link: <a href="https://www.elastic.co/guide/en/logstash/5.4/installing-logstash.html">https://www.elastic.co/guide/en/logstash/5.4/installing-logstash.html</a> (for me downloaded logstash and extracted and did following below changes)</p><p>Create “logstash.conf” if not present(inside logstash directory) and make following changes</p><pre>input {<br>   beats {<br>      port =&gt; 5044<br>   }<br>}</pre><pre>filter {<br>   grok {<br>      patterns_dir =&gt; &quot;/&lt;path-to-directory&gt;/logstash-6.0.0/patterns&quot;<br>      match =&gt; { &quot;message&quot; =&gt; &quot;%{NGINXACCESS}&quot; }<br>   }<br>}</pre><pre>output {<br>   elasticsearch {<br>       hosts =&gt; &quot;localhost:9200&quot;<br>       manage_template =&gt; false<br>       index =&gt; &quot;%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}&quot;<br>       document_type =&gt; &quot;%{[@metadata][type]}&quot;<br>   }<br>}</pre><p>In above configuration file, variable “patterns_dir” is logstash patterns directory(patterns_dir =&gt; “/&lt;path-to-directory&gt;/logstash-6.0.0/patterns”), find below a sample pattern(for default nginx access logs, similarly it can be extended for other logs) added in file named “nginx” on above location</p><pre>NGUSERNAME [a-zA-Z\.\@\-\+_%]+<br>NGUSER %{NGUSERNAME}<br>NGINXACCESS %{IPORHOST:clientip} (?:-|(%{WORD}.%{WORD})) %{USER:ident} \[%{HTTPDATE:timestamp}\] &quot;(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})&quot; %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent} %{QS:forwarder}</pre><p>We can run logstash server now using following command:</p><pre><strong>./bin/logstash -f logstash.conf</strong></pre><p>Download filebeat from given link: <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation.html">https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation.html</a> and do below changes before running:</p><ul><li>Making following changes in filebeat.yml file</li></ul><pre>#[1st section to be changed] Filebeat prospectors =======</pre><pre>filebeat.prospectors:<br>- type: log<br>    enabled: true<br>    paths:<br>        - &lt;path to nginx logs which filebeat needs to read&gt;</pre><pre>#[2nd section to be changed] Logstash output -----------------#</pre><pre>output.logstash:<br>     # The Logstash hosts<br>     hosts: [&quot;localhost:5044&quot;]</pre><ul><li>Run filebeat using below command:</li></ul><pre><strong>./filebeat -e -c filebeat.yml -d “publish”</strong></pre><p>We’re almost done above command will start pushing data to elasticsearch index with name as mentioned in “logstash.conf”. We can now use kibana to view visualizations related to data being present in elasticsearch. <strong>Please find below certain basics of starting with Kibana dashboard related to above changes</strong>(Kibana dashboard would be accessible on URL: localhost:5601)<strong>:</strong></p><ul><li>Goto “Management” tab in kibana and create the index pattern, this index pattern is the elastic search index name, it takes regex expression so it can be use to fetch data from multiple indexes at once[Please find an image below related to same].</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1ESn9bDQpgQb0v8U." /><figcaption>Kibana “Management” configure index pattern</figcaption></figure><ul><li>From management dashboard goto newly configured index patter and refresh field list options(otherwise these newly added fields wont be present while any analysis), it can be done by clicking find the red mark on below image</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WekB9yOjXoCEVvXH." /></figure><ul><li>We’re set now, click on “Discover” or “Visualize” for exploring data. From top right corner select time range(by default its 15 mins)</li></ul><p>Hope this article helps makes steps clear for basic setup of ELK stack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d567999d7846" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Django channels using Supervisor and Ngnix]]></title>
            <link>https://medium.com/@saurabhpresent/deploying-django-channels-using-supervisor-and-ngnix-2f9a25393eef?source=rss-36cb0283fbf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f9a25393eef</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[supervisor]]></category>
            <dc:creator><![CDATA[saurabh prakash]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 20:35:25 GMT</pubDate>
            <atom:updated>2017-11-13T21:18:22.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2180r4OCxRk0CnZEkY-4Jw.png" /><figcaption>Django Chanels</figcaption></figure><p>In past i’ve done django related deployment(which usually used gunicorn, supervisord and ngnix), but this was my first experience in deploying a django channel application. There is documentation provided by django-channel team on this: <a href="http://channels.readthedocs.io/en/stable/deploying.html">http://channels.readthedocs.io/en/stable/deploying.html</a>, which we can refer for deeper understanding of concepts. Idea of creation of this article is for having a quick reference for deploying django channels using supervisord and ngnix.</p><p>Post django setup(including the <a href="https://channels.readthedocs.io/en/stable/installation.html">channels related settings</a>), create supervisor conf file for your project which would look like:</p><pre>[program:project_name_asgi_daphne]</pre><pre>directory=/&lt;virtual-environment-path&gt;/&lt;project-name&gt;/</pre><pre>command=/&lt;virtual-environment-path&gt;/bin/daphne -u /&lt;virtual- environment-path&gt;/&lt;project-name&gt;/daphne.sock --root-path=&lt;virtual-environment-path&gt;/&lt;project-name&gt; &lt;project-name&gt;.asgi:channel_layer</pre><pre>stdout_logfile = /&lt;virtual-environment-path&gt;/&lt;project-name&gt;/logs/daphne.log</pre><pre>[program:project_name_asgi_workers]</pre><pre>command=/&lt;virtual-environment-path&gt;/bin/python /&lt;virtual-environment-path&gt;/&lt;project-name&gt;/manage.py runworker</pre><pre>stdout_logfile = /&lt;virtual-environment-path&gt;/&lt;project-name&gt;/logs/worker.log</pre><pre>process_name=asgi_worker%(process_num)s</pre><pre>numprocs=number_of_process</pre><pre>environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8                        ; Set UTF-8 as default encoding</pre><pre>autostart=true</pre><pre>autorestart=true</pre><pre>redirect_stderr=True</pre><pre>stopasgroup=true</pre><p>From the above mentioned settings, these values needs to be replaced:</p><ul><li>&lt;virtual-environment-path&gt;: Location of virtual environment in system</li><li>&lt;project-name&gt;: Name of your project</li><li>number_of_process: Number of workers to run</li></ul><p>Post addition above file for supervisor changes to apply we can use following commands:</p><blockquote>sudo supervisorctl reread</blockquote><blockquote>sudo supervisorctl update</blockquote><blockquote>sudo supervisorctl restart all</blockquote><p>Post that we need to make create our project specific ngnix file which should look something like following:</p><pre>server {<br>        listen 80 default_server;<br>        listen [::]:80 default_server ipv6only=on;<br><br>        root /usr/share/nginx/html;<br>        index index.html index.htm;<br><br>        server_name _;<br><br>        location /static/ {<br>                alias /&lt;project-static-files-path&gt;/static/;<br>                expires 1y;<br>        }<br><br>        location / {<br>                proxy_pass http://unix:/&lt;virtual-environment-path&gt;/&lt;project-name&gt;/daphne.sock;<br>                proxy_http_version 1.1;<br>                proxy_set_header Upgrade $http_upgrade;<br>                proxy_set_header Connection &quot;upgrade&quot;;<br><br><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>}</pre><p>For above step(ngnix setup) for more details we can visit: <a href="https://www.nginx.com/blog/websocket-nginx/">https://www.nginx.com/blog/websocket-nginx/</a></p><p>Hope this article helps makes steps clear for basic setup of channels using supervisord and ngnix.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f9a25393eef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pylint integration with Django runserver]]></title>
            <link>https://medium.com/@saurabhpresent/pylint-integration-with-django-runserver-ca9182975f40?source=rss-36cb0283fbf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca9182975f40</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[saurabh prakash]]></dc:creator>
            <pubDate>Sat, 01 Apr 2017 21:05:41 GMT</pubDate>
            <atom:updated>2017-04-01T21:20:08.785Z</atom:updated>
            <content:encoded><![CDATA[<p>There are lot of static analysis tools for django(python) like pylint, pyflakes, flake8 etc. All of them we can integrate in our build process(in tools like jenkins) or as git hooks.</p><p>But it would be great to have something which can tell about your pep-8 mistakes on run time while you are developing on runtime. Benefits of this would be that we don’t need to wait till build process completes or till git commit/push. On python file save(compile) you get notice about missing convention, warning or errors of pep-8 standards.</p><p>For achieving this, I wrote a <a href="https://github.com/saurabhprakash/runserver-with-pylint">snippet</a> which overrides the default Django runserver behaviour and runs Pylint over the integrated codebase.</p><p>Codebase link: <a href="https://github.com/saurabhprakash/runserver-with-pylint">https://github.com/saurabhprakash/runserver-with-pylint</a></p><p>Default configurations for Pylint can be modified in <a href="https://github.com/saurabhprakash/runserver-with-pylint/blob/master/pylintrc"><em>pylintrc</em></a> file. While as per requirement we can tweak the standards using variables like <em>ERROR_COUNT, CONVENTION_COUNT, WARNINGS, CODEBASE, THRESHOLD_LINT_SCORE</em> mentioned in file <a href="https://github.com/saurabhprakash/runserver-with-pylint/blob/master/runserver_with_pylint"><em>runserver_with_pylint</em></a><em>.py</em></p><p>So the way it works is as soon as codebase current standards fall below set scores, runserver will exit and wont start till the standards are met.</p><p>The current code has been checked on Django 1.9 with python 3.5. But yes, the concept can be used across other Django/Python versions.</p><p>More on integration process can be found on the mentioned <a href="https://github.com/saurabhprakash/runserver-with-pylint">Github</a> link.</p><p>Hope it helps in raising better code standards. Would love to hear more suggestions on this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca9182975f40" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>