<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arpan Bhattacharya</title>
    <description>The latest articles on DEV Community by Arpan Bhattacharya (@arpanbhattacharya).</description>
    <link>https://dev.to/arpanbhattacharya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1119088%2Fb8b1e45e-893d-434e-994a-046f81c04174.jpg</url>
      <title>DEV Community: Arpan Bhattacharya</title>
      <link>https://dev.to/arpanbhattacharya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arpanbhattacharya"/>
    <language>en</language>
    <item>
      <title>☁️ Building a Secure On-Prem Private Cloud with Apache CloudStack, NGINX Reverse Proxy, and Cloudflare Tunnel</title>
      <dc:creator>Arpan Bhattacharya</dc:creator>
      <pubDate>Fri, 06 Mar 2026 05:32:40 +0000</pubDate>
      <link>https://dev.to/arpanbhattacharya/building-a-secure-on-prem-private-cloud-with-apache-cloudstack-nginx-reverse-proxy-and-1n53</link>
      <guid>https://dev.to/arpanbhattacharya/building-a-secure-on-prem-private-cloud-with-apache-cloudstack-nginx-reverse-proxy-and-1n53</guid>
      <description>&lt;p&gt;Modern applications are often deployed on public cloud platforms like AWS, Azure, or GCP. However, many organizations still require on-premise infrastructure to maintain greater control over networking, security, and data management.&lt;/p&gt;

&lt;p&gt;In this article, we will walk through the architecture and setup of an on-premise private cloud built using Apache CloudStack, where internal virtual machines run within a private network and external access is securely managed using Cloudflare Tunnel and an NGINX reverse proxy VM.&lt;/p&gt;

&lt;p&gt;This architecture allows services to remain isolated inside a private network while still being accessible from the internet in a secure and controlled manner.&lt;/p&gt;

&lt;p&gt;🏗️ Architecture Overview&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1pvr8m7ihl8b0izfm4v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1pvr8m7ihl8b0izfm4v.png" alt="Architecture" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The infrastructure is designed around a layered architecture where external traffic is carefully routed through controlled entry points before reaching internal services.&lt;/p&gt;

&lt;p&gt;Key characteristics of this architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All internal workloads run within a private network&lt;/li&gt;
&lt;li&gt;No application VM is directly exposed to the internet&lt;/li&gt;
&lt;li&gt;A dedicated reverse proxy VM acts as the entry gateway&lt;/li&gt;
&lt;li&gt;Cloudflare Tunnel securely connects external traffic to the internal network&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This model closely resembles architectures used in enterprise environments with private subnets and controlled ingress gateways.&lt;/p&gt;

&lt;p&gt;🌐 Internal Network Design&lt;br&gt;
The CloudStack environment uses an internal network:&lt;br&gt;
&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This private address space enables communication between virtual machines without exposing them publicly.&lt;/p&gt;

&lt;p&gt;All services communicate through private IP addresses within the internal network.&lt;/p&gt;

&lt;p&gt;Example internal access:&lt;br&gt;
&lt;code&gt;http://10.1.0.20:3000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Since this network is isolated, only the NGINX proxy VM is responsible for routing traffic from external sources.&lt;/p&gt;

&lt;p&gt;🔐 Secure External Access Using Cloudflare Tunnel&lt;/p&gt;

&lt;p&gt;Traditionally, exposing services requires opening firewall ports or assigning public IP addresses. Instead, this architecture uses Cloudflare Tunnel, which allows secure inbound access without exposing internal infrastructure.&lt;/p&gt;

&lt;p&gt;Cloudflare Tunnel works by creating a persistent outbound connection from the server to Cloudflare's network. Incoming traffic from the internet is then routed through that tunnel.&lt;/p&gt;

&lt;p&gt;Advantages of this approach include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No need to open inbound firewall ports&lt;/li&gt;
&lt;li&gt;Protection against common network attacks&lt;/li&gt;
&lt;li&gt;Secure encrypted communication&lt;/li&gt;
&lt;li&gt;Simplified external routing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Traffic flow example:&lt;br&gt;
&lt;code&gt;app.example.com → Cloudflare → Cloudflare Tunnel → NGINX Proxy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This design ensures that the internal infrastructure remains hidden from direct internet exposure.&lt;/p&gt;

&lt;p&gt;⚙️ NGINX Reverse Proxy Layer&lt;/p&gt;

&lt;p&gt;The NGINX VM acts as the central routing component inside the internal network.&lt;/p&gt;

&lt;p&gt;It receives requests forwarded through the Cloudflare Tunnel and then routes them to the appropriate internal service.&lt;/p&gt;

&lt;p&gt;Example CLoudflare configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tunnel: &amp;lt;your-tunnel-id&amp;gt;
credentials-file: /etc/cloudflared/&amp;lt;tunnel-id.json&amp;gt;
protocol: http2
ingress:
- hostname: app1.example.com
  service: http://localhost:80
- hostname: app2.example.com
  service: http://localhost:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This cloudflare tunnel config targets the nginx proxy vm to receive the traffice and forward it.&lt;/p&gt;

&lt;p&gt;Example NGINX configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;app.example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;client_max_body_size&lt;/span&gt; &lt;span class="mi"&gt;2G&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;client_body_timeout&lt;/span&gt; &lt;span class="s"&gt;300s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;proxy_read_timeout&lt;/span&gt; &lt;span class="s"&gt;300s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;proxy_connect_timeout&lt;/span&gt; &lt;span class="s"&gt;300s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;proxy_send_timeout&lt;/span&gt; &lt;span class="s"&gt;300s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;proxy_request_buffering&lt;/span&gt; &lt;span class="no"&gt;off&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;proxy_buffering&lt;/span&gt; &lt;span class="no"&gt;off&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://10.1.12.46:80/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Real-IP&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-For&lt;/span&gt; &lt;span class="nv"&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-Proto&lt;/span&gt; &lt;span class="s"&gt;https&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this configuration:&lt;br&gt;
&lt;code&gt;Incoming Request → NGINX → Internal Service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This allows multiple services to be hosted behind a single entry point.&lt;/p&gt;

&lt;p&gt;NGINX effectively functions as an internal application gateway.&lt;/p&gt;

&lt;p&gt;🔁 End-to-End Request Flow&lt;/p&gt;

&lt;p&gt;When a user accesses an application, the request passes through several controlled layers.&lt;/p&gt;

&lt;p&gt;Step-by-step flow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user visits:
&lt;code&gt;https://app.example.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;DNS resolution occurs via Cloudflare.&lt;/li&gt;
&lt;li&gt;Cloudflare forwards the request through the Cloudflare Tunnel.&lt;/li&gt;
&lt;li&gt;The request reaches the NGINX reverse proxy VM.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NGINX routes the request to the appropriate internal virtual machine.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;code&gt;NGINX → 10.1.0.20:3000&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The application processes the request and returns a response through the same path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This layered routing ensures that external traffic never directly interacts with internal application servers.&lt;/p&gt;

&lt;p&gt;🛡️ Security Advantages&lt;/p&gt;

&lt;p&gt;This architecture provides several security benefits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internal Service Isolation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Application and database servers remain within the private network and are not reachable from the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No Public Exposure of Application Servers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Only the reverse proxy VM communicates with external systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encrypted Tunnel Communication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cloudflare Tunnel ensures that all traffic entering the network is encrypted and authenticated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduced Attack Surface&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since inbound firewall ports are not exposed, the attack surface is significantly minimized.&lt;/p&gt;

&lt;p&gt;📊 Architectural Benefits&lt;/p&gt;

&lt;p&gt;This setup offers several operational advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralized ingress control&lt;/li&gt;
&lt;li&gt;Secure external access without opening ports&lt;/li&gt;
&lt;li&gt;Simplified routing for multiple services&lt;/li&gt;
&lt;li&gt;Scalable infrastructure for additional virtual machines&lt;/li&gt;
&lt;li&gt;Clear separation between external traffic and internal services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The design principles are similar to cloud-native patterns used in modern infrastructures such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Private VPC networks&lt;/li&gt;
&lt;li&gt;Reverse proxy gateways&lt;/li&gt;
&lt;li&gt;Ingress controllers&lt;/li&gt;
&lt;li&gt;Secure edge tunnels&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧠 Key Takeaways&lt;/p&gt;

&lt;p&gt;Designing an on-premise private cloud environment requires careful planning of networking, security, and traffic routing.&lt;/p&gt;

&lt;p&gt;By combining:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apache CloudStack for virtualization&lt;/li&gt;
&lt;li&gt;NGINX as a reverse proxy gateway&lt;/li&gt;
&lt;li&gt;Cloudflare Tunnel for secure external access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;it is possible to build an infrastructure where services remain protected within a private network while still being accessible externally in a controlled way.&lt;/p&gt;

&lt;p&gt;This architecture provides a strong foundation for hosting multiple services, APIs, and applications while maintaining a secure and scalable deployment model.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>cloud</category>
      <category>networking</category>
      <category>security</category>
    </item>
    <item>
      <title>PostgreSQL Locally, the Easy Way: Docker Compose!</title>
      <dc:creator>Arpan Bhattacharya</dc:creator>
      <pubDate>Wed, 18 Jun 2025 10:51:07 +0000</pubDate>
      <link>https://dev.to/arpanbhattacharya/postgresql-locally-the-easy-way-docker-compose-5gf4</link>
      <guid>https://dev.to/arpanbhattacharya/postgresql-locally-the-easy-way-docker-compose-5gf4</guid>
      <description>&lt;p&gt;Tired of database setup headaches during local development? Installing PostgreSQL directly can be a mess of version conflicts and dependency issues. But what if there was a simpler, cleaner solution?&lt;/p&gt;

&lt;p&gt;Enter &lt;strong&gt;Docker and Docker Compose&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;These tools let you run PostgreSQL in an isolated container, making your local setup reproducible, portable, and incredibly easy to manage. No more "it works on my machine" excuses!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Docker Compose?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Isolation: Your database runs in its own clean container, avoiding conflicts with your system.&lt;/li&gt;
&lt;li&gt;Reproducibility: A simple configuration file ensures everyone on your team has the exact same database environment.&lt;/li&gt;
&lt;li&gt;Portability: Move your setup between projects or operating systems with ease.&lt;/li&gt;
&lt;li&gt;Clean-up: Stop and remove containers without leaving a trace on your system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick Setup: Your &lt;code&gt;docker-compose.yml&lt;/code&gt;&lt;br&gt;
Create a file named &lt;code&gt;docker-compose.yml&lt;/code&gt; in your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;services:
  db:
    image: postgres:latest
    restart: always
    container_name: postgres_db
    volumes:
      - ./data/db:/var/lib/postgresql/data
    ports:
      - 5432:5432 # default PostgreSQL port (make sure this port is not in use)

    environment:
      - POSTGRES_USER=your_username
      - POSTGRES_PASSWORD=your_password
      - POSTGRES_DB=your_database_name

  adminer:
    image: adminer:latest
    restart: always
    container_name: adminer
    ports:
      - 8080:8080 # Adminer web interface port
    depends_on:
      - db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What's happening here?&lt;/strong&gt; We're defining a db service using the postgres image. We set environment variables for your database name, user, and password (please change the password!). The ports line maps port 5432 on your machine to the container. Crucially, the volumes line ensures your data persists even if you restart the container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run It!&lt;/strong&gt;&lt;br&gt;
Navigate to your &lt;code&gt;docker-compose.yml&lt;/code&gt; directory in your terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command starts your PostgreSQL database in the background.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect and Develop&lt;/strong&gt;&lt;br&gt;
Now you can connect to your local PostgreSQL instance using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Host: localhost&lt;/li&gt;
&lt;li&gt;Port: 5432&lt;/li&gt;
&lt;li&gt;Database: your_db_name&lt;/li&gt;
&lt;li&gt;User: your_username&lt;/li&gt;
&lt;li&gt;Password: your_password (your chosen password)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To remove containers and networks (but keep your data volume):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Embrace Docker Compose for your local PostgreSQL setup. It's a game-changer for developer sanity and team collaboration! 🌟🌟&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
