<?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 Shotor on Medium]]></title>
        <description><![CDATA[Stories by Shotor on Medium]]></description>
        <link>https://medium.com/@shotor?source=rss-5eff81f2340f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_hFKhHnBW8ItKaF6ozGJiw.jpeg</url>
            <title>Stories by Shotor on Medium</title>
            <link>https://medium.com/@shotor?source=rss-5eff81f2340f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 18:21:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shotor/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[Build a Hugo static site in your browser using GitHub Codespaces]]></title>
            <link>https://shotor.medium.com/build-a-hugo-static-site-in-your-browser-using-github-codespaces-2d804c54c103?source=rss-5eff81f2340f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d804c54c103</guid>
            <category><![CDATA[hugo]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[visual-studio-codespaces]]></category>
            <category><![CDATA[static-site-generator]]></category>
            <category><![CDATA[codespace]]></category>
            <dc:creator><![CDATA[Shotor]]></dc:creator>
            <pubDate>Sun, 24 Jan 2021 23:58:41 GMT</pubDate>
            <atom:updated>2021-01-25T18:20:44.136Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently built a static website for a friend using <a href="https://gohugo.io/">Hugo</a>. We installed everything he needed to add content to his website on his laptop. And by all I mean just Hugo and Visual Studio Code. Then he reset his laptop and that set me thinking if we can do with even less, preferably installing nothing at all on his computer.</p><p><a href="https://github.com/features/codespaces">GitHub Codespaces</a> came to mind. With GitHub Codespaces (currently in early access) we get a full VSCode powered development environment in the browser. Best of all it runs in an Ubuntu container giving terminal access, includes tools like Hugo out of the box and handles port forwarding for us.</p><p>There’s something to be aware of with the automatic port forwarding and static assets such as images. So in this post I’ll show how you can build and debug a static site built with <a href="https://gohugo.io/">Hugo</a> in GitHub Codespaces.</p><h3>Getting started</h3><p>We’ll first create an empty repository in GitHub. Make sure to add an empty README file, so we can easily open it with codespaces later on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*rOvakEKiwqd1sMFmBZGCWQ.png" /></figure><p>Open GitHub Codespaces in the navigation bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*ioAqhKrVmUq9s6XikGhkBg.png" /></figure><p>Then create a new Codespace by selecting our repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*fPEuSdqCJSkkmt6pPHpgeA.png" /></figure><p>After a minute your VSCode environment should be ready to go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5lUgZXMzOJYmghwQ_Z08Q.png" /></figure><h3>Hugo</h3><p>Let’s start with <a href="https://gohugo.io/">Hugo</a>. We’ll run the commands of the <a href="https://gohugo.io/getting-started/quick-start/">Hugo quick start</a> with one modification. If you prefer to just look at the code, check out the <a href="https://github.com/shotor/hugo-codespaces-example">repository</a>.</p><pre># create a new site in the root folder, force it because it&#39;s not empty<br>hugo new site . --force</pre><pre># add ananke theme<br>git submodule add <a href="https://github.com/budparr/gohugo-theme-ananke.git">https://github.com/budparr/gohugo-theme-ananke.git</a> themes/ananke</pre><pre>#set theme<br>echo &gt;&gt; config.toml</pre><pre># create new post hugo new posts/my-first-post.md<br>hugo new posts/my-first-post.md</pre><p>We’ll add some content to our my-first-post.md file and also an image that we&#39;ll place in the /static folder (just drag it into the sidebar of your Codespace).</p><pre>---<br>title: &#39;My First Post&#39;<br>date: 2021-01-24T12:00:00Z<br>---</pre><pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus in fringilla libero.</pre><pre>![Placeholder image](/image.png)</pre><p>Now we’ll forward the port in the remote explorer tab. We know Hugo will run on 1313, so that’s the port we will forward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*C7Z9a0zFLwlGOk-LgT8MZA.png" /></figure><p>Now if we just run Hugo (hugo server -D) our homepage will work fine. But any internal link or image will fail with a 404 error because it refers to localhost and not our GitHub url. And also there’s a port included in all the links.</p><p>To fix this we run a modified start command where we set the `baseUrl` to the url provided by GitHub. We can get this url by right clicking on our forwarded port, and copying the url. We also need to disable the port section (in this case :1313). Our command becomes:</p><pre>hugo server -D --baseUrl=&quot;https://your-github-url&quot; --appendPort=false</pre><p>Now when we click on our first post, we’ll see the blog post as well as the image we uploaded.</p><p>That’s it, we now have a full development workflow completely in our browser. We can access it from anywhere to add content or make changes to the layout.</p><p>In this case we used Hugo, a static site generator. But this idea can be adapted to any type of webserver, for instance NodeJS or Django. As long as you bind the server to localhost and then forward the port. Making sure any internal links or images use the forwarded url as its base url.</p><h3>Deployments using Netlify</h3><p>To finish it off we’ll add deployments using <a href="https://netlify.com/">Netlify</a>. We’ll follow <a href="https://gohugo.io/hosting-and-deployment/hosting-on-netlify/">the Hugo tutorial</a> and create a netlify.toml file in the root directory.</p><pre>[build]<br>publish = &quot;public&quot;<br>command = &quot;hugo --gc --minify&quot;</pre><pre>[context.production.environment]<br>HUGO_VERSION = &quot;0.80.0&quot;<br>HUGO_ENV = &quot;production&quot;<br>HUGO_ENABLEGITINFO = &quot;true&quot;</pre><pre>[context.split1]<br>command = &quot;hugo --gc --minify --enableGitInfo&quot;</pre><pre>[context.split1.environment]<br>HUGO_VERSION = &quot;0.80.0&quot;<br>HUGO_ENV = &quot;production&quot;</pre><pre>[context.deploy-preview]<br>command = &quot;hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL&quot;</pre><pre>[context.deploy-preview.environment]<br>HUGO_VERSION = &quot;0.80.0&quot;</pre><pre>[context.branch-deploy]<br>command = &quot;hugo --gc --minify -b $DEPLOY_PRIME_URL&quot;</pre><pre>[context.branch-deploy.environment]<br>HUGO_VERSION = &quot;0.80.0&quot;</pre><pre>[context.next.environment]<br>HUGO_ENABLEGITINFO = &quot;true&quot;</pre><p>Make sure we set the base url in config.toml to our Netlify url:</p><pre>baseURL = &quot;https://pensive-sammet-17c943.netlify.app/&quot;<br>languageCode = &quot;en-us&quot;<br>title = &quot;Hugo Codespaces Example&quot;<br>theme = &quot;ananke&quot;</pre><p>We can now commit and push all our changes. Which will trigger a build and deploy our static site. We can also create Pull Requests and have Netlify create preview environments for us, so we can test changes before merging them.</p><p>Our site is now live at <a href="https://pensive-sammet-17c943.netlify.app/">https://pensive-sammet-17c943.netlify.app/</a></p><p>All that’s left to do is <a href="https://docs.netlify.com/domains-https/custom-domains/">add a custom domain</a>.</p><h3>Final words</h3><p>Codespaces makes it really easy to work on projects hosted on GitHub.</p><p>There are limitations, the Ubuntu container doesn’t allow you to run just any command you want, which makes sense.</p><p>For instance I tried to run a <a href="https://getzola.org/">Zola</a> project, but Zola requires <a href="https://snapcraft.io/">snapcraft</a>. Which is not included and cannot be installed in Codespaces. To get Zola working I had to upload the Zola binary file myself. No big deal, but on a local or a self-hosted remote vscode environment this is a non-issue.</p><p>Right now I’m only using it for small projects. I’m very interested to see how it holds up with bigger projects. In terms of size, as well things required from the operating system.</p><p><em>Originally published at </em><a href="https://shotor.com/blog/build-a-hugo-static-site-in-your-browser-using-github-codespaces/">https://shotor.com/blog/build-a-hugo-static-site-in-your-browser-using-github-codespaces/</a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d804c54c103" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Run your own mesh VPN and DNS with Tailscale and PiHole]]></title>
            <link>https://shotor.medium.com/run-your-own-mesh-vpn-and-dns-with-tailscale-and-pihole-56d6bdb5dcb3?source=rss-5eff81f2340f------2</link>
            <guid isPermaLink="false">https://medium.com/p/56d6bdb5dcb3</guid>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[pihole]]></category>
            <category><![CDATA[tailscale]]></category>
            <category><![CDATA[home-automation]]></category>
            <category><![CDATA[wireguard]]></category>
            <dc:creator><![CDATA[Shotor]]></dc:creator>
            <pubDate>Thu, 29 Oct 2020 10:29:52 GMT</pubDate>
            <atom:updated>2020-10-29T11:09:06.408Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been using Tailscale for a while to connect all my devices together in a mesh VPN. I use it to access web applications running on one of my servers (home or remote), from any of my devices (phone, laptop, tablet). Tailscale makes this really easy. <a href="https://tailscale.com/download">Install it</a> on your devices and it will connect your devices together and assign them unique ip addresses. Tailscale is built on top of <a href="https://www.wireguard.com/">WireGuard</a>. To see how it works, check out <a href="https://tailscale.com/blog/how-tailscale-works/">their blog post </a>that goes in depth.</p><p>Recently I wanted to add <a href="https://pi-hole.net/">PiHole</a> private DNS to my setup in order to increase security and privacy while browsing. And also to assign readable hostnames to each device. This way I don’t have to memorize ip addresses or mess with local host files anymore.</p><p>A simplified view of the setup:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1BZGW177Depjtdnc.png" /></figure><p>We’re going to run PiHole in a Docker container on it’s own subnet. We’ll expose this subnet on the network by turning the server into a Tailscale subnet relay node. Finally, we’ll set the DNS to be used by all devices on the network through the Tailscale admin console.</p><p>If you don’t want to run your own DNS, but just want readable names for your devices. You can skip this guide and use <a href="https://tailscale.com/kb/1081/magic-dns">Tailscale Magic DNS</a> instead. It automatically assigns fixed hostnames to all your devices. While it’s a really cool feature, with PiHole you get more flexibility, as well as privacy and security features.</p><h3>Setting up PiHole</h3><p>There are a few ways to setup PiHole. In this case I’m running it with Docker on a remote server. But this guide also works if you’re hosting PiHole directly. The important part is to have PiHole accessible on the Tailscale mesh network. To do this you can install Tailscale on the server running PiHole, or setup a subnet relay node (see next section).</p><p>First I’m going to create a new Docker bridge network, because I don’t want bind ports from the Docker container to my host machine. This way I can host PiHole completely isolated on a separate internal IP, and use the default port for DNS (53).</p><pre>docker network create \<br>  --driver=bridge \<br>  --subnet=172.21.0.0/16 \<br>  --gateway=172.21.0.1 \<br>  -o &quot;com.docker.network.bridge.name&quot;=&quot;docker-apps&quot; \<br>  -o &quot;com.docker.network.bridge.enable_ip_masquerade&quot;=&quot;true&quot; \<br>  -o &quot;com.docker.network.bridge.enable_icc&quot;=&quot;true&quot; \<br>  -o &quot;com.docker.network.driver.mtu&quot;=&quot;1500&quot; \<br>  apps</pre><p>In my case I also had to allow this network to access the internet by modifying iptables.</p><pre>sudo iptables -t nat -A POSTROUTING -s 172.21.0.0/16 -j MASQUERADE</pre><p>Now we can run a new PiHole docker container on this network. I’m also going to assign it a static IP address. That way we only have to configure it once as the DNS, and not every time the server restarts and the ip changes.</p><pre>docker run -d \<br>  --name pihole \<br>  --network=apps \<br>  --ip=172.21.0.2 \<br>  -e TZ=&quot;Europe/Amsterdam&quot; \<br>  -v &quot;~/pihole/etc-pihole/:/etc/pihole/&quot; \<br>  -v &quot;~/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/&quot; \<br>  --dns=127.0.0.1 \<br>  --dns=1.1.1.1 \<br>  --restart=unless-stopped \<br>  --hostname pi.hole \ <br>  -e VIRTUAL_HOST=&quot;pi.hole&quot; \<br>  -e PROXY_LOCATION=&quot;pi.hole&quot; \<br>  -e ServerIP=&quot;127.0.0.1&quot; \<br>pihole/pihole:latest</pre><p>Now we have a working instance of PiHole running on our server. The only problem is we can only access it on this particular machine, because it uses an internal IP address. Any other device on our mesh network can’t access this IP, yet.</p><h3>Subnet Relay Node</h3><p>With Tailscale we can expose internal ip addresses of a machine by turning the device into a <a href="https://tailscale.com/kb/1019/subnets">relay node</a>.</p><p>We restart Tailscale and instruct it to advertise the subnet we want to expose on the network.</p><pre>sudo tailscale up --advertise-routes=172.21.0.0/16</pre><p>If you get errors, make sure IP forwarding is enabled.</p><pre>echo &#39;net.ipv4.ip_forward = 1&#39; | sudo tee -a /etc/sysctl.conf sudo sysctl -p /etc/sysctl.conf</pre><p>Then for our host machine we disable key expiry and enable subnet routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*EKdIOevsLyXV8HfV.png" /></figure><p>If everything went well you should see the subnet in the admin panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/0*wkKbmqCNb4ufEirq.png" /></figure><p>We can now access the subnet on any connected device. On Linux devices you’ll have to enable this feature first:</p><pre>sudo tailscale up --accept-routes</pre><p>Now go to <a href="http://172.21.0.2/">http://172.21.0.2</a> on any of your devices to see PiHole running. Pretty cool, right?</p><h3>Setting the DNS for all our devices</h3><p>Exposing subnet routes is a really powerful feature. You can host applications on internal IP addresses on any of your servers, and access them directly from your devices — no port bindings or reverse proxying required.</p><p>But we can take it a step further by using PiHole as the default DNS for all connected devices. Simply put: Turn Tailscale on, and you instantly have access to all your self-hosted apps using readable names, and your browsing expires becomes more secure.</p><p>This part is very easy.</p><p>In the Tailscale admin console, we’re going to click on the DNS tab. And add our PiHole IP address as the DNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*m4iIMXCacBe-zP_W.png" /></figure><p>That’s it. All the devices on network are now configured to use PiHole as the DNS. You can see this by opening a website on a device and checking the logs in the PiHole UI. Or by checking the contents of the /etc/resolv.conf file.</p><p>On Mac/Linux:</p><pre>cat /etc/resolv.conf # resolv.conf(5) file generated by tailscale # DO NOT EDIT THIS FILE BY HAND -- CHANGES WILL BE OVERWRITTEN nameserver 172.21.0.2</pre><p>Note: We only configured 1 DNS. That brings the risk that if it goes down, you can’t connect directly to any domain. The next step would be to run another PiHole instance on a different server within the network. This makes the DNS redundant and will avoid connection problems in case one of the nodes goes down. Another option is to log in to the Tailscale admin console and turn off the DNS feature.</p><h3>Next Steps</h3><p>Some things to consider doing next:</p><ul><li>Setup readable names for your apps. Click on <strong>Local DNS Records</strong> in the PiHole UI and start mapping your ip addresses. How about pi.hole to access the PiHole UI?</li><li>Add new block lists to block more ads, trackers and malware, <a href="https://hosts.oisd.nl/">this one</a> is quite popular.</li><li>Run a second instance of PiHole, in case one malfunctions, and add it as the secondary DNS. <a href="https://github.com/vmstan/gravity-sync">Gravity-sync</a> can help with synchronization of the PiHole instances.</li><li>Add your home router to the mesh network, so any device connected to your router automatically uses PiHole. Note: you’ll probably want a second instance of PiHole instance on a different server.</li><li>Run some more apps. <a href="https://hub.docker.com/r/linuxserver/calibre">Here</a>, <a href="https://hub.docker.com/r/gitea/gitea">are</a>, <a href="https://hub.docker.com/r/linuxserver/syncthing">some</a>, <a href="https://hub.docker.com/r/linuxserver/code-server">cool</a>, <a href="https://github.com/awesome-selfhosted/awesome-selfhosted">ones</a>.</li><li>Wait a couple of days and see how much traffic PiHole has managed to block. I’ve been running PiHole for a couple of days and it blocks around 20% of all the DNS requests made.</li></ul><p><em>Originally published at </em><a href="https://shotor.com/blog/run-your-own-mesh-vpn-and-dns-with-tailscale-and-pihole/"><em>https://shotor.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56d6bdb5dcb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>