<?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 Marian Schmotzer on Medium]]></title>
        <description><![CDATA[Stories by Marian Schmotzer on Medium]]></description>
        <link>https://medium.com/@smoco?source=rss-1659183bb747------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*sB-_Rq77Eg_3ET8S.jpg</url>
            <title>Stories by Marian Schmotzer on Medium</title>
            <link>https://medium.com/@smoco?source=rss-1659183bb747------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 04:41:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@smoco/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[Fighting trailing slash problem]]></title>
            <link>https://medium.com/@smoco/fighting-trailing-slash-problem-c0416023d20e?source=rss-1659183bb747------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0416023d20e</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[traefik]]></category>
            <dc:creator><![CDATA[Marian Schmotzer]]></dc:creator>
            <pubDate>Fri, 31 Aug 2018 14:45:41 GMT</pubDate>
            <atom:updated>2018-08-31T14:45:41.617Z</atom:updated>
            <content:encoded><![CDATA[<p>During last few months i was part of team migrating “standard three tier” infrastructure to new docker and kubernetees infrastructure. We changed or added many crucial parts of our infrastructure including loadbalancers. In fact we added ingress controller/loadbalancer called <a href="https://traefik.io/">traefik</a>. Soon after deployment we realised we have small, but really annoying (especially for our customers) problem.</p><p>First i will try to explain how our https connection pipeline looks like in this picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JDeFxQI10NroNKsvS3DNGQ.png" /></figure><p>As you can see client’s browser requests url <a href="https://server/app">https://server:443/app</a>, but our nodejs app serves app as a / (root) without suffix. So we need to configure traefik to do 2 things <br>- route to correct container based on app suffix<br>- strip suffix when forwarding request to nodejs app container<br>First thing somehow comes out of box with correctly configured ingress in container definition. <br>For second we used ingress traefik annotation in our nodejs app pod:</p><pre>ingress:<br>  enabled: true<br>  annotations:<br>   &quot;kubernetes.io/ingress.class&quot;: &quot;traefik&quot;<br><strong>   &quot;traefik.frontend.rule.type&quot;: &quot;PathPrefixStrip&quot;<br></strong>  path: /app<br></pre><p>This annotation removes /app (or any other suffix path defined in ingress path section). This annotation works, but with one small problem, it removes suffix when request is coming from traefik to nodejs pod, but doesn’t add it to response coming from nodejs pod. <br>So if app returns something like url for styles.css, it will be delivered to client browser like url to download <a href="https://server/styles">https://server:443/styles</a>.css NOT (as it should be) like <a href="https://server/styles">https://server:443/app/styles</a>.css<br>After few experiments I figured out that if you use in ingress something like (note i just added / to path)</p><pre>ingress:<br>  enabled: true<br>  annotations:<br>   &quot;kubernetes.io/ingress.class&quot;: &quot;traefik&quot;<br>   &quot;traefik.frontend.rule.type&quot;: &quot;PathPrefixStrip&quot;<br><strong>  path: /app/</strong></pre><p>everything works like expected. Response for browser is correct <a href="https://server/styles">https://server:443/app/styles</a>.css . <br>So problem seems solved, but new obstacle will rise. If your client will type into browser <a href="https://server/styles">https://server:443/app</a> , will get ugly 404 error. This is because path /app is not defined in ingress paths (there is /app/) .</p><p>Our first solution was to add some configuration to haproxy which lies between client browser and our traefik.</p><p>Approximately 2 weeks ago we decided to remove haproxy (better say to replace by AWS ALB) and to solve trailing slash problem within kuberneets or in traefik. <br>After few tries to convince traefik to work with my regular expresions to add / to end of url which is missing / (obvoiusly i don’t want to end with something like <a href="https://server/styles">https://server:443/app</a>/styles.css/ so regexp had to be a bit more complex). <br>Unfortunately it wasn’t way to go as trailing slash wasn’t added correctly. So I’ve started think about different solution.</p><p>Whole problem is that we need to add slash to end of specific url. We can do it with any webserver (like nginx) and send back redirect back to client. Client then will connect to correct url ending with slash. <br>We just need now to get all requests which ends with 404 (because ingress path of our app is ending with / and but browser url isn’t) to some pod with nginx configured to do redirect. Of course we need to keep in mind we cannot do it for ingress paths used by other pods. <br>For this we will use nginx pod with following annotation in ingress</p><pre>ingress:<br>  enabled: true<br>   annotations:<br>     &quot;kubernetes.io/ingress.class&quot;: &quot;traefik&quot;<br>     &quot;traefik.frontend.rule.type&quot;: &quot;PathPrefix&quot;<br>     &quot;traefik.frontend.redirect.entryPoint&quot;: &quot;https&quot;<br><strong>     &quot;traefik.ingress.kubernetes.io/priority&quot;: &quot;1&quot;<br></strong>   path: /</pre><p>This will add to ingress controller (traefik) following rule: With lowest priority match path / for any servername. <br>It acts like: match this if nothing else can be matched (this ensures bold line with priority setting). <br>Now we just need pod with some nginx and redirect configuration. Something like this.</p><pre>server {<br>       listen 8080 default_server;<br>       server_name _;<br>       server_tokens off;<br>       location / {<br><strong>           rewrite ^/([^/.]+)$ https://$host/$1/ redirect;<br></strong>       }<br>}</pre><p>This will redirect only if / is not already presented in path. Reason for this is that this catch all pod can be used for more purposes. You can for example redirect /whatever (of course if is not url of app) to valid app url (what we really do).</p><pre>server {<br>       listen 8080 default_server;<br>       server_name _;<br>       server_tokens off;<br>       location / {<br>           rewrite ^/([^/.]+)$ https://$host/$1/ redirect;<br><strong>           return 301 https://$host/my-default-app;       <br></strong>        }<br>}</pre><p>How it works ? <br>1. <a href="https://server/whatever">https://server:443/whatever</a> is redirected to <a href="https://server/whatever">https://server:443/whatever</a>/<br>2. <a href="https://server/whatever">https://server:443/whatever</a>/ doesn’t match redirection rule in nginx (as it has / at the end) and bold line rule is applied to it.</p><p>My sample helm chart for this root-proxy pod can be found <a href="https://github.com/marianschmotzer/root-proxy">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0416023d20e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How and why we started with moving to docker]]></title>
            <link>https://medium.com/devops-transformation-coresystems/how-and-why-we-started-with-moving-to-docker-cb358768febe?source=rss-1659183bb747------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb358768febe</guid>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Marian Schmotzer]]></dc:creator>
            <pubDate>Thu, 02 Nov 2017 11:52:09 GMT</pubDate>
            <atom:updated>2017-11-02T11:52:09.999Z</atom:updated>
            <content:encoded><![CDATA[<p>Our company as many fast growing companies started to face several challenges. With growing number of developers, projects, teams and mainly various new application, complexity of our architecture grows significantly. Our current three tier infrastructure architecture (loadbalancer- app server- database ) have been serving us well. Uptime was high. Any component could fail without significant impact on our applications or whole solution. But …. (there is always some but…) with growing numbers of applications (and micro-services they are build on top of) it shows its weaknesses. In past we had one monolithic core with few services around, so we could have set of servers to run each service. Now(and in not so distant future) to have set of servers for each service would be more than luxury. So we started with multiple services as a processes in same set of servers (of course grouped by technology and so). This is not working quite well — partially because of influence which each service could have to others, partially because of work needed to add new service, partially because of deployments (we everything this automated via puppet and custom scripts, but is like inventing wheel again) and finally because new feature requests (like autoscaling, self healing, multiple versions of same service and others). All these things are pushing us towards significant change of our infrastructure. After some research we figured out that if we bundle our services into docker many issues we can address. If we use some orchestration framework to run our docker build containers — we will address all issues we have with current infrastructure.</p><p>After some research (with help of external guys skilled in docker world — thanks Adam :-) ) we decided to set our course to docker and kubernetes. We were warned that we will need to change things in our services to be able to run. Beside many others we need to get rid of sticky sessions, local logging and change ways of debugging.</p><p>I feel we are heading good direction as we were able to create development kubernetes cluster and port our first application there. We are able to build this first container in bamboo, push it to our private docker registry and deploy it on our development kubernetes cluster. In next weeks we will move forward with other services, more robust docker registry and other things necessary to address.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb358768febe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devops-transformation-coresystems/how-and-why-we-started-with-moving-to-docker-cb358768febe">How and why we started with moving to docker</a> was originally published in <a href="https://medium.com/devops-transformation-coresystems">DevOps Transformation @Coresystems</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>