<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[shashipy]]></title><description><![CDATA[Software development, embedded systems, DIY tech projects, self-hosting]]></description><link>https://shashipy.in/</link><image><url>https://shashipy.in/favicon.png</url><title>shashipy</title><link>https://shashipy.in/</link></image><generator>Ghost 5.74</generator><lastBuildDate>Fri, 03 Apr 2026 20:08:09 GMT</lastBuildDate><atom:link href="https://shashipy.in/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Hosting Your First Website on a Raspberry Pi: A Journey from Basement to the World(Part 2)]]></title><description><![CDATA[<p></p><h2 id="configuring-network-settings-for-external-access">Configuring Network Settings for External Access</h2><p>Before we start, ensure you have completed the first part of this series and have a sample app running and accessible on your Raspberry Pi&apos;s localhost.</p><h3 id="introduction">Introduction</h3><p>In the previous part, we set up a sample Flask application inside a Docker container</p>]]></description><link>https://shashipy.in/hosting-your-first-website-on-a-raspberry-pi-a-journey-from-basement-to-the-world-part-2/</link><guid isPermaLink="false">6684b4fb2c7497000119b0e2</guid><dc:creator><![CDATA[Shashi Ranjan]]></dc:creator><pubDate>Fri, 05 Jul 2024 19:47:40 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1420641637488-df930ea6ec80?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDU2fHxqb3VybmV5fGVufDB8fHx8MTcyMDIwOTE1OHww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1420641637488-df930ea6ec80?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDU2fHxqb3VybmV5fGVufDB8fHx8MTcyMDIwOTE1OHww&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Hosting Your First Website on a Raspberry Pi: A Journey from Basement to the World(Part 2)"><p></p><h2 id="configuring-network-settings-for-external-access">Configuring Network Settings for External Access</h2><p>Before we start, ensure you have completed the first part of this series and have a sample app running and accessible on your Raspberry Pi&apos;s localhost.</p><h3 id="introduction">Introduction</h3><p>In the previous part, we set up a sample Flask application inside a Docker container and made it accessible on your local network. In this part, we&#x2019;ll focus on configuring your network settings to allow external access to your Raspberry Pi. </p><p>This involves mapping your domain to your router&apos;s public IP, configuring your router to forward requests to your Raspberry Pi, and setting up dynamic DNS to handle changes in your public IP address.</p><h3 id="step-1-configuring-a-static-ip-for-your-raspberry-pi">Step 1: Configuring a Static IP for Your Raspberry Pi</h3><p>Ensure your Raspberry Pi has a static IP address on your local network. This was covered in Part 1, but it&apos;s crucial for the upcoming steps.</p><h3 id="step-2-mapping-your-domain-to-your-routers-public-ip">Step 2: Mapping Your Domain to Your Router&apos;s Public IP</h3><p>To make your website accessible via your domain name, you need to update your DNS settings to point your domain to your router&apos;s public IP address.</p><h4 id="creating-an-a-record">Creating an A Record</h4><ol><li>Log in to your DNS provider&#x2019;s dashboard (e.g., Cloudflare).</li><li>Select your domain and navigate to the DNS settings.</li><li>Create a new A record:<ul><li><strong>Type</strong>: A</li><li><strong>Name</strong>: @ (or yourdomain.com)</li><li><strong>Value</strong>: Your router&apos;s public IP address</li><li><strong>TTL</strong>: Automatic or 1 hour</li></ul></li></ol><h3 id="step-3-allowing-inbound-requests-on-your-router">Step 3: Allowing Inbound Requests on Your Router</h3><p>Many routers have inbound HTTP/S requests disabled by default for security reasons. You need to enable this setting to allow external access to your website.</p><h4 id="enabling-https-on-your-router">Enabling HTTP/S on Your Router</h4><ol><li>Log in to your router&#x2019;s admin interface.</li><li>Navigate to the settings related to security or firewall.</li><li>Find the option to allow inbound HTTP/S requests on the WAN (public) IP address.</li><li>Enable the setting for HTTPS, and optionally HTTP (though HTTPS is recommended for security).</li></ol><h3 id="step-4-configuring-port-forwarding">Step 4: Configuring Port Forwarding</h3><p>Next, configure your router to forward requests on specific ports to your Raspberry Pi.</p><h4 id="setting-up-port-forwarding">Setting Up Port Forwarding</h4><ol><li>Log in to your router&#x2019;s admin interface.</li><li>Navigate to the port forwarding section.</li><li>Add a new port forwarding rule:<ul><li><strong>Service Name</strong>: HTTP</li><li><strong>External Port</strong>: 80</li><li><strong>Internal IP Address</strong>: Your Raspberry Pi&#x2019;s static IP</li><li><strong>Internal Port</strong>: 80</li><li><strong>Protocol</strong>: TCP</li></ul></li><li>Add another rule for HTTPS:<ul><li><strong>Service Name</strong>: HTTPS</li><li><strong>External Port</strong>: 443</li><li><strong>Internal IP Address</strong>: Your Raspberry Pi&#x2019;s static IP</li><li><strong>Internal Port</strong>: 443</li><li><strong>Protocol</strong>: TCP</li></ul></li></ol><h3 id="step-5-setting-up-dynamic-dns">Step 5: Setting Up Dynamic DNS</h3><p>Since your router&apos;s public IP address can change periodically, it&#x2019;s essential to keep your DNS records updated. We can automate this process using a dynamic DNS script.</p><h4 id="setting-up-a-dynamic-dns-script">Setting Up a Dynamic DNS Script</h4><p>Use a script like in this <a href="https://github.com/K0p1-Git/cloudflare-ddns-updater?ref=shashipy.in" rel="noreferrer">repository</a>  to dynamically update your ip address in the dns.</p><h3 id="conclusion">Conclusion</h3><p>In this part, we&apos;ve configured your network settings to allow external access to your Raspberry Pi. We&apos;ve mapped your domain to your router&apos;s public IP, enabled inbound requests on your router, set up port forwarding, and configured dynamic DNS to handle IP changes.</p><p>In the next part, we&apos;ll set up Nginx as a reverse proxy to forward requests from your domain to your Flask app.</p><p>If you have any questions or run into any issues, feel free to comment below, and I&apos;ll be happy to help.</p><p>Happy hosting!</p>]]></content:encoded></item><item><title><![CDATA[Hosting Your First Website on a Raspberry Pi: A Journey from Basement to the World (Part 1)]]></title><description><![CDATA[<p></p><h2 id="introduction">Introduction</h2><p>Hosting a website from your basement on a Raspberry Pi (Rpi) and making it accessible to the world is an exciting and rewarding project. Whether you&apos;re a beginner or a seasoned developer, running your website on a Raspberry Pi introduces you to various aspects of web hosting,</p>]]></description><link>https://shashipy.in/hosting-your-first-website-on-a-raspberry-pi-a-journey-from-basement-to-the-world-part-1/</link><guid isPermaLink="false">6682ecc12c7497000119b090</guid><dc:creator><![CDATA[Shashi Ranjan]]></dc:creator><pubDate>Mon, 01 Jul 2024 18:14:18 GMT</pubDate><media:content url="https://images.unsplash.com/photo-1489641024260-20e5cb3ee4aa?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fGpvdXJuZXl8ZW58MHx8fHwxNzE5ODA1NDk2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" medium="image"/><content:encoded><![CDATA[<img src="https://images.unsplash.com/photo-1489641024260-20e5cb3ee4aa?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=M3wxMTc3M3wwfDF8c2VhcmNofDF8fGpvdXJuZXl8ZW58MHx8fHwxNzE5ODA1NDk2fDA&amp;ixlib=rb-4.0.3&amp;q=80&amp;w=2000" alt="Hosting Your First Website on a Raspberry Pi: A Journey from Basement to the World (Part 1)"><p></p><h2 id="introduction">Introduction</h2><p>Hosting a website from your basement on a Raspberry Pi (Rpi) and making it accessible to the world is an exciting and rewarding project. Whether you&apos;re a beginner or a seasoned developer, running your website on a Raspberry Pi introduces you to various aspects of web hosting, including containerization, networking, and security.</p><p>In this series, we&apos;ll walk you through setting up a sample website on your Raspberry Pi and making it accessible over the internet. We&apos;ll focus on using containerized services to ensure consistency across different environments and machines. By the end of this guide, you&apos;ll have a fully functional website running on your Raspberry Pi, accessible to the world.</p><h3 id="what-well-cover">What We&apos;ll Cover</h3><ol><li><strong>Setting Up a Sample Flask App Inside a Container</strong>: We&apos;ll create a simple Flask web application, containerize it using Docker, and expose it on the Raspberry Pi.</li><li><strong>Configuring Network Settings for External Access</strong>: We&apos;ll configure your router for port forwarding. We&apos;ll also set up dynamic DNS to handle changes in your public IP address.</li><li><strong>Setup Nginx for Reverse Proxy: </strong>We&apos;ll set up Nginx to forward requests from your domain to your Flask app.</li></ol><h2 id="prerequisites">Prerequisites</h2><p>Before we start, ensure you have the following:</p><ul><li>A Raspberry Pi with Raspbian OS installed.</li><li>Docker and Docker Compose installed on your Raspberry Pi.</li><li>Python installed on your Raspberry Pi.</li><li>Basic knowledge of Docker and Flask.</li><li>A registered domain and access to a DNS provider like Cloudflare.</li></ul><p>If you haven&apos;t installed Docker or Python on your Raspberry Pi, there are numerous guides available online to help you get started. We recommend doing some research to complete these installations.</p><h2 id="setting-up-a-sample-flask-app-inside-a-container">Setting Up a Sample Flask App Inside a Container</h2><p></p><h3 id="step-1-creating-a-sample-flask-application">Step 1: Creating a Sample Flask Application</h3><p>Let&apos;s start by creating a simple Flask application. Create a directory for your project:</p><pre><code class="language-sh">mkdir my_flask_app
cd my_flask_app</code></pre><p>Inside this directory, create the following files:</p><ul><li><code>app.py</code>:</li></ul><pre><code class="language-python">from flask import Flask

app = Flask(__name__)

@app.route(&apos;/&apos;)
def hello_world():
    return &apos;Hello, World!&apos;

if __name__ == &apos;__main__&apos;:
    app.run(host=&apos;0.0.0.0&apos;, port=5000)</code></pre><ul><li><code>requirements.txt</code>:</li></ul><pre><code class="language-makefile">codeFlask==2.0.1</code></pre><ul><li><code>Dockerfile</code>:</li></ul><pre><code class="language-dockerfile">FROM python:3.8-slim

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY . .

CMD [&quot;python&quot;, &quot;app.py&quot;]
</code></pre><ul><li><code>docker-compose.yml</code>:</li></ul><pre><code class="language-yaml">version: &apos;3.8&apos;

services:
  web:
    build: .
    ports:
      - &quot;5000:5000&quot;

</code></pre><h3 id="step-2-building-and-running-the-container">Step 2: Building and Running the Container</h3><p>Navigate to your project directory and build and run your container using Docker Compose:</p><pre><code class="language-sh">docker-compose up --build -d</code></pre><p>This command builds the Docker image and starts the container in detached mode. Your Flask app should now be running and accessible at <code>http://localhost:5000</code>.</p><h3 id="step-3-accessing-the-flask-app">Step 3: Accessing the Flask App</h3><p>You can verify that your Flask app is running by accessing it from your Raspberry Pi&apos;s web browser or by making a curl request:</p><pre><code class="language-sh">curl http://localhost:5000</code></pre><p>Since the Flask app is exposed on all interfaces (<code>0.0.0.0</code>), it will also be accessible on your Raspberry Pi&apos;s private IP address. To find your Raspberry Pi&apos;s IP address, run:</p><pre><code class="language-sh">hostname -I</code></pre><p>You can then access your Flask app from any device on your local network by navigating to <code>http://&lt;RPI_PRIVATE_IP&gt;:5000</code>.</p><h3 id="step-4-configuring-a-static-ip-for-your-raspberry-pi">Step 4: Configuring a Static IP for Your Raspberry Pi</h3><p>To ensure your Raspberry Pi always has the same IP address on your local network, you need to configure a static IP. This can be done through your router&apos;s admin interface. The steps to set a static IP vary depending on your router model, but generally, you will:</p><ol><li>Log in to your router&apos;s admin interface.</li><li>Find the DHCP settings or IP reservation settings.</li><li>Add a new reservation for your Raspberry Pi using its MAC address and the desired IP address.</li></ol><p>This ensures that your Raspberry Pi will always receive the same IP address from your router, making it easier to manage and access your services.</p><h2 id="conclusion">Conclusion</h2><p>In this part, we&apos;ve set up a simple Flask application inside a Docker container and made it accessible on your local network. We&apos;ve also configured your Raspberry Pi to have a static IP address. In the next part, we&apos;ll set up Nginx as a reverse proxy to forward requests from your domain to your Flask app.</p><p>Stay tuned for the next part!</p><p>If you have any questions or run into any issues, feel free to comment below, and I&apos;ll be happy to help.</p><p>Happy hosting!</p>]]></content:encoded></item><item><title><![CDATA[Simplifying Self-Hosting: Enabling DNS Resolution for Containerized Services with Pi-hole]]></title><description><![CDATA[<p></p><h2 id="introduction">Introduction</h2><p>In a self-hosted environment, managing DNS resolution is crucial for seamless communication between services. If you&apos;re running multiple containerized services on the same machine, such as Nextcloud, a mail server, and Pi-hole as your internal DNS. This guide focuses on how to configure your containerized services to</p>]]></description><link>https://shashipy.in/simplifying-self-hosting-enabling-dns-resolution-for-containerised-services-with-pi-hole/</link><guid isPermaLink="false">66818ca42c7497000119b01a</guid><dc:creator><![CDATA[Shashi Ranjan]]></dc:creator><pubDate>Sun, 30 Jun 2024 17:08:08 GMT</pubDate><content:encoded><![CDATA[<p></p><h2 id="introduction">Introduction</h2><p>In a self-hosted environment, managing DNS resolution is crucial for seamless communication between services. If you&apos;re running multiple containerized services on the same machine, such as Nextcloud, a mail server, and Pi-hole as your internal DNS. This guide focuses on how to configure your containerized services to utilize Pi-hole for DNS resolution, enabling services like Nextcloud to connect to your mail server.</p><h2 id="prerequisites">Prerequisites</h2><p>This guide assumes you have the following already set up:</p><ul><li>Pi-hole running as your DNS server.</li><li>Multiple containerized services (e.g., Nextcloud, Ghost, Mail Server) on the same machine.</li><li>Cloudflare or another DNS service for external DNS resolution.</li></ul><h2 id="step-by-step-guide">Step-by-Step Guide</h2><h3 id="configuring-local-dns-entries-in-pi-hole">Configuring Local DNS Entries in Pi-hole</h3><p>To ensure your services can communicate using domain names rather than IP addresses, you need to add local DNS records in Pi-hole.</p><h4 id="add-local-dns-records">Add Local DNS Records</h4><ol><li>Access the Pi-hole admin interface by navigating to <code>http://pi.hole/admin</code> in your browser.</li><li>Go to <strong>Local DNS &gt; DNS Records</strong>.</li><li>Add a DNS entry for your mail server. For example:<ul><li>Mail Server: <code>mail.example.com</code> -&gt; <code>[local IP of the Mail Server container]</code></li></ul></li></ol><p>This setup ensures that when a service within your network queries <code>mail.example.com</code>, Pi-hole resolves it to the local IP of your mail server.</p><h3 id="setting-up-a-bridge-network-for-containers">Setting Up a Bridge Network for Containers</h3><p>To manage your container network effectively, you&apos;ll create a bridge network with a specific IP range and assign static IP addresses to your containers.</p><h4 id="creating-the-bridge-network">Creating the Bridge Network</h4><p>Define an external bridge network in your Docker Compose file:</p><pre><code class="language-yaml">networks:
  my_bridge_network:
    external: true</code></pre><p>Create the network with a defined subnet:</p><pre><code class="language-sh">docker network create --subnet=172.19.0.0/24 my_bridge_network</code></pre><h3 id="configuring-pi-hole-with-a-static-ip">Configuring Pi-hole with a Static IP</h3><p>In your <code>docker-compose.yml</code> for Pi-hole, assign a static IP within the created subnet:</p><pre><code class="language-yaml">services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    networks:
      my_bridge_network:
        ipv4_address: 172.19.0.3
    # other configurations

networks:
  my_bridge_network:
    external: true
</code></pre><h3 id="configuring-other-services-to-use-pi-hole">Configuring Other Services to Use Pi-hole</h3><p>Now, configure your other services (e.g., Nextcloud, Ghost) to use Pi-hole for DNS resolution by specifying the DNS server and assigning static IPs.</p><p><em>Sample Configuration for Nextcloud:</em></p><pre><code class="language-yaml">services:
  nextcloud:
    image: nextcloud
    container_name: nextcloud
    dns:
      - 172.19.0.3
      - 1.1.1.1
    networks:
      my_bridge_network:
        ipv4_address: 172.19.0.4
    # other configurations

networks:
  my_bridge_network:
    external: true</code></pre><p><em>Sample Configuration for Ghost:</em></p><pre><code class="language-yaml">services:
  ghost:
    image: ghost
    container_name: ghost
    dns:
      - 172.19.0.3
      - 1.1.1.1
    networks:
      my_bridge_network:
        ipv4_address: 172.19.0.5
    # other configurations

networks:
  my_bridge_network:
    external: true
</code></pre><h3 id="restarting-the-containers">Restarting the Containers</h3><p>After updating the <code>docker-compose.yml</code> files, restart your containers to apply the changes:</p><pre><code class="language-sh">docker-compose down
docker-compose up -d
</code></pre><h3 id="verifying-dns-resolution">Verifying DNS Resolution</h3><p>Once your containers are configured to use Pi-hole, you can test the DNS resolution by trying to access the services within your application. Since <code>nslookup</code> or <code>dig</code> might not be available in your containers, ensure the service configurations are correct and try accessing the service domains from within the applications. If your service has nslookup, you can do:</p><pre><code class="language-sh">docker exec -it nextcloud /bin/bash
nslookup mail.example.com
</code></pre><p>You should see the local IP address of your mail server returned. This confirms that Nextcloud can resolve the mail server&apos;s address using Pi-hole.</p><h3 id="configuring-services-to-use-the-mail-server">Configuring Services to Use the Mail Server</h3><p>With DNS resolution set up, configure your services to use your mail server for sending emails. For instance, in Nextcloud, you would set the SMTP server to <code>mail.example.com</code>. Other services might require setting environment variables or specifying SMTP details in the application settings.</p><h3 id="troubleshooting-common-issues">Troubleshooting Common Issues</h3><h4 id="dns-resolution-failures">DNS Resolution Failures</h4><ul><li>Ensure the DNS entries in Pi-hole are correct.</li><li>Verify that the containers are configured to use Pi-hole as their DNS server.</li></ul><h4 id="service-connectivity-problems">Service Connectivity Problems</h4><ul><li>Check that the services are running and accessible using their local IP addresses.</li><li>Ensure there are no network or firewall rules blocking communication between the containers.</li></ul><h2 id="conclusion">Conclusion</h2><p>Using Pi-hole for internal DNS resolution in a self-hosted environment simplifies service interactions. By configuring your containerised services to use Pi-hole, you ensure reliable and efficient communication within your local network. This setup allows services like Nextcloud to easily connect to your mail server, enhancing the overall functionality and reliability of your self-hosted ecosystem.</p><p>Happy self-hosting! If you have any questions, feel free to comment below, and I&apos;ll be happy to help.</p><p>Don&apos;t forget to subscribe, it&apos;s free (and new for me)!</p><h2 id></h2>]]></content:encoded></item></channel></rss>