<?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 Simone Capitani on Medium]]></title>
        <description><![CDATA[Stories by Simone Capitani on Medium]]></description>
        <link>https://medium.com/@tharos70?source=rss-334a9ea4beeb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5_sVDZ7CjlZyg2lk.jpg</url>
            <title>Stories by Simone Capitani on Medium</title>
            <link>https://medium.com/@tharos70?source=rss-334a9ea4beeb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:19:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tharos70/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[Streamlit and Apache: A Guide to Reverse Proxy Configuration]]></title>
            <link>https://medium.com/@tharos70/streamlit-and-apache-a-guide-to-reverse-proxy-configuration-78af7a3c4467?source=rss-334a9ea4beeb------2</link>
            <guid isPermaLink="false">https://medium.com/p/78af7a3c4467</guid>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Simone Capitani]]></dc:creator>
            <pubDate>Thu, 03 Oct 2024 08:33:02 GMT</pubDate>
            <atom:updated>2024-10-03T08:33:02.096Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*XTUpix4fuexYc9kW.jpg" /></figure><h3><strong>Introduction</strong></h3><p><a href="https://streamlit.io/">Streamlit</a> is a fantastic way to easy setup and publish data driven dashboards. It also has a built-in solution for deplying, manage, and share your apps with the anyone <a href="https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app">directly from itself</a> and its completely free.</p><p>But what if you want to publish your data on premise, on your personal server, with your own domain name or virtual host?</p><h3><strong>The Architecture we are setting up</strong></h3><p>First of all let’s describe the architecture we want to obtain. When you’re developing a Streamlit application, the <a href="https://docs.streamlit.io/develop/api-reference/cli">cli</a> gives you out of the box a personal server to deploy your app to. For example:</p><blockquote>streamlit run app.py</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*Oz55fxVnWnCQDOdwcGvZgg.png" /><figcaption>Command line prompt launching a Streamlit application</figcaption></figure><p>So your personal server points to the default virtual host <em>localhost.</em></p><p>What we want to achieve is to be able to expose our app via a specific domain name (or virtual host) of our own choice, like in the following architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*szBngBXQGXpF2mqnIXRtyQ.png" /></figure><p>In order to obtain a working configuration we have two object to setup the correct way: the <em>Apache</em> and the <em>Streamlit application</em>.</p><h3><strong>The Apache configuration</strong></h3><p>Assuming that you already have an <a href="https://httpd.apache.org/">Apache</a> exposing the sample <a href="https://httpd.apache.org/docs/2.4/vhosts/examples.html">virtual host</a> <em>www.mydomain.com</em> correctly configured on your DNS, let’s see how we can setup the traffic from the Apache to the Streamlit application.</p><blockquote>RewriteEngine On</blockquote><blockquote>RewriteCond %{HTTP:Upgrade} websocket</blockquote><blockquote>RewriteRule /streamlit-app(.*) ws://&lt;streamlit-app-host&gt;:&lt;streamlit-app-port&gt;/streamlit-app$1 [P,L]</blockquote><blockquote>RewriteCond %{HTTP:Upgrade} !websocket</blockquote><blockquote>RewriteRule /streamlit-app(.*) http://&lt;streamlit-app-host&gt;:&lt;streamlit-app-port&gt;/streamlit-app$1 [P,L]</blockquote><p>So, what we basically do is create a simple set of rewrite rules that will proxy all the traffic coming from the browser to the Streamlit application. All we have to change is the <em>&lt;streamlit-app-host&gt;</em> and the <em>&lt;streamlit-app-port&gt;</em> variable according to our architecture.</p><h3><strong>The Streamlit application startup</strong></h3><p>Then we have to act on the way we start the streamlit application:</p><blockquote>streamlit run app.py — server.port 8501 — server.baseUrlPath=/streamlit-app — server.headless=false — browser.serverAddress=www.mydomain.com</blockquote><p>In the previous sample startup command we specify that the Streamlit application:</p><ul><li>will be available through port <em>8501</em></li><li>will be served by the domain relative path <em>/streamlit-app</em> (just like we configured on the Apache rewrite rules)</li><li>the exposing domain will be <em>www.mydomain.com</em>.</li></ul><p>That said, we expect a generic internet user to be able to call our streamlit application by calling <a href="https://www.mydomain.com/streamlit-app">https://www.mydomain.com/streamlit-app</a></p><p>One further note. If the traffic from the Apache to the streamlit application must be secured we may need to change the <em>*ws://*</em> directive (websocket protocol) to <em>*wss://*</em> (websocket secure protocol). Of course in this case our architecture will have to manage a certificate both on the Apache and the Streamlit application.</p><h3><strong>Conclusions</strong></h3><p>Streamlit is a fantastic and easy way to expose dashboards and data driven application in general, but when it comes to deploy a production ready architecture it may be tricky to find exhaustive documentation. I hope this brief article will be useful for your needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78af7a3c4467" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing GIS Viewers]]></title>
            <link>https://medium.com/@tharos70/managing-gis-viewers-b65ee536054c?source=rss-334a9ea4beeb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b65ee536054c</guid>
            <category><![CDATA[foss4g]]></category>
            <category><![CDATA[foss]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[gis]]></category>
            <dc:creator><![CDATA[Simone Capitani]]></dc:creator>
            <pubDate>Thu, 27 Feb 2020 18:10:05 GMT</pubDate>
            <atom:updated>2020-02-27T18:10:05.425Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3uLnP2831luIWfzfmn5TMQ.jpeg" /></figure><p><em>Long story short…</em></p><p>After talking at 2020 foss4g Italy event, I was asked to publish my slides, but, since they’re in italian language I decided to write a little summary of what I talked about.</p><p><em>FOSS GIS viewers</em></p><p>GIS web viewer share often a similar architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*zcYRiSa4ZGs1LMdDsQ4A5Q.png" /><figcaption>A simple web gis viewer architecture</figcaption></figure><p>As you can see from the image above a GIS (Web) Client is a bunch of html and js files which can handle access to some Web services standardized by the <a href="https://www.opengeospatial.org/">Open Geospatial Consortium</a>. There are many FOSS projects out there providing common functionalities of a web viewer. Lower level ones like <a href="https://openlayers.org/">Openlayers </a>or <a href="https://leafletjs.com/">Leaflet</a>, and some more engineered solutions like <a href="https://github.com/geosolutions-it/MapStore2">Mapstore2</a>, <a href="https://github.com/geoadmin/mf-geoadmin3">Geoadmin </a>or <a href="https://geomapfish.org/">Geomapfish</a>. What happens anytime a technology upgrade occurs on the client side?</p><p><em>Development lifecycle</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*9c-dN9CoBNS4y_L4Lr84wg.png" /><figcaption>Classic development lifecycle</figcaption></figure><p>The image above, describes the classic development lifecycle. What happens when we happen to be in the green phase (Evolution) and the evolution includes an important technology upgrade (for example like when you decide to rewrite your software in a completely different programming language)? Typically you may be able to reuse Requirement Analysis, maybe some design, but all the next steps will need a complete rewrite. What can we do when such an event occurs in the development of a GIS Web Viewer?</p><p><em>The approach</em></p><p>Well in my company we have setup a software solution in order to keep as much developed software as possible. The concept is quite simple. We have a three step process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*ClFJ56kRKG2YUhdGmQKWWQ.png" /><figcaption>The 3 steps GIS viewer setup process</figcaption></figure><p>At configuration time, in a [QGis](<a href="http://qgis.org/">http://qgis.org/</a>) project we handle the organization of the TOC and all the OGC services we want to use in our specific context. Then via a QGis plugin, we wil enrich the configuration model by adding informations about tools we may want to enable in that specific application (like features searching, graphics specifications, feature fusion, cutting, etc.). Then all this configuration data is stored in a DBMS via a REST API. The specific configuration is identified by a UUID that will remain the same throughout the technology upgrades.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*GrCepGGJHy86-4OWzx_pEg.png" /><figcaption>Simplified architectural model</figcaption></figure><p>As you can see from the image above, at configuration time we have set up our viewer context and stored it in the DBMS. When a viewer needs to access the desired configuration, it has to present itself by the corresponding UUID to its specific API. So what happens behind the scenes is a Model To Model conversion: from the ER model of the DBMS to the domain specific one of the requesting viewer. Furthermore, there’s a Tools api which needs some more explanation. Tools are components with a specific configuration and an optional specific API. These objects are transversal to the frontend technology, so as the supported frameworks increase in number the available tools needs the only presentation logic to be reimplemented, while the backend API remains untouched.</p><p><em>Pros and Cons</em></p><p>So, what do we gain by approaching GIS viewers development in such a way? First of all the choice of using a Model driven development makes the whole ecosystem of configurations highly reusable (for example you may want to publish different viewers displaying the same configuration). Another interesting feature is that the modular architecture enables us to increase tools and features that can be added also to older configurations as long as they’re made available to the ecosystem. And now some cons too. What we are doing here is some heavy integrating duties, that said it’s obvious that choosing to support someone else work (a.k.a. FOSS framework and libraries) we have to compromise to some UX/UI choices that may not be suitable to every needs. But hey, there’s plenty of them to choose from so that can be an opportunity to integrate one more community! And then the worst con IMHO: this approach leads to a highly configurable system. Which means that if you don’t plan a heavy integration test plan you may occur in some serious problems (like setting up a viewer for production pointing to an internal API. Real sad story…)</p><p><em>What’s next</em></p><p>We are planning to publish all this ecosystem under FOSS licenses in the next months in an incremental way. I’ll let you know when all the documentation and the code will be available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b65ee536054c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>