How to Self-Host Your Podcast

How to Self-Host Your Podcast

So you want to start a podcast, but you're tech savvy and want to host it yourself? Here's a little guide to help you get it going.

Podcast Hosting Providers

First let's understand what a podcast hosting provider does. Sites like Libsyn, Anchor, Blubrry, Megaphone, etc will allow you to upload your audio file for your podcast, they'll create an rss feed for the podcast, and then serve the files for your listeners. See, a podcast is simply an rss file which contains a map to where the audio files are, and the audio files. So at a minimum we need an rss file, image, and audio files to be public somewhere on the internet, so listeners can find the show and listen.

Many of these hosting providers charge between $5 and $1000 a month to host the podcast. Some are free such as Anchor. It's perfectly fine to use a podcast host, I do. And mine charges hundreds a month to host with them. But my requirements are probably different than yours. I need dynamic ad insertion which is a premium type of service. But this guide doesn't cover DAI. If you need that look into places like Blubrry, Megaphone, and Art19, and don't try to make it yourself.

Skill Level

Hosting a podcast yourself is on par with building and hosting a website yourself. If you've never done this, then self-hosting your podcast might be a little tricky.

Three Options

Let's consider 3 quick options:

Github Pages AWS Private Server
Cost free $-$$$$ $
Maintenance little little moderate
Options static html only static or dyanmic websites static or dynamic websites
Skills required static website generator/git webpage building/AWS full stack development
Usage limits yes scales dependent on your equipment

The breakdown.

Github Pages will let you host static websites free. That is, there's no database, no PHP/Ruby/Python either. If you have just a flat html page, then you can upload it and it'll be a website in minutes. Free. There are static website generators that help you make cool websites. This blog uses Ghost, but I also really like Jekyll. Github Pages is free but has soft usage limits. So if your podcast is popular, this is not a good option. In order to deploy here you just need to know how to use a static site generator, github, and what's required to make a podcast rss feed.

AWS Web Hosting, or any web/cloud hosting, will host a website for you, for a fee. You can deploy any kind of website to these places, such as one with a database or one running PHP/Python/etc, which opens up your options for generating files and an accompaning website. Now, the cost of hosting at AWS can become pricey. Here is one podcaster's calculation of it. So as your show scales, it may not be a economically best option. Places like Libsyn don't charge on downloads or bandwidth, just storage, which for larger shows becomes very cost effective. Deploying to AWS requires knowledge of navigating all the AWS options, creating the files to upload, and then updating it for each new episode. And it'll scale to however big you need it to be.

Private Server hosting might be a scenario where you have something as basic as a Raspberry Pi at home and you want to use it to host your podcast. The price of a Pi is pretty cheap and you already have internet at home, so this can be pretty cheap overall. The problem comes when your podcast becomes pretty popular and you have thousands of people downloading huge mp3 files through your home internet. It'll bog it down. But that's a good problem to have and not many people actually have popular podcasts. To deploy here you'll need to know how to setup a server, getting a web service running like Apache, and deploy the web files to host the podcast. Keep in mind it's now on you to keep the server and software patched and follow good security practices. Which makes it more work but you get more privacy and satisfaction for doing it DIY style.

Stats

A problem you'll quickly run into by self hosting is getting accurate stats of who's downloading your podcast. It is notoriously hard to figure out how many downloads your mp3 files are getting. This is because a podcast player, might decide to download the file in portions and not all at once. So to download one episode, you might see 10 or more web server logs for that single file. You can't rely on any AWS plugin or Google Analytics for this.

Trying to roll your own download stats is pretty hard but possible, and it's best to start with the IAB guidelines which is the industry standard on podcast measurement.

The easier alternative that will give you accurate stats right away is by using Podtrac. Basically you point your mp3 files to be at Podtrac, which will then log the request and then do a 303 redirect to where your mp3 files are actually hosted. Podtrac can then provide you stats with how many downloads your podcast is getting. Best part is Podtrac is free AND IAB certified. There are alternatives such as Blubrry statistics and Chartable.

Deploying to Github Pages Step-by-step

Ok so let's walk you through how to deploy a podcast to Github pages. You can use this guide to understand how to deploy it anywhere but this is a simple version.

First go through the steps to setup your Github website repo. You can setup your own custom domain but it's not required. Just get to the point that you've setup a basic "it works" sort of website.

Podcast Anatomy

The most basic anatomy of a podcast is as follows:

  • An rss file (in compliant XML format)
  • An image for the podcast
  • The audio files in an acceptable format such as mp3

Optionally you can also deploy a website to accompany your podcast. This would be a place where people can see episodes and play them right from your website instead of having to use a podcast player. We'll cover this more at the end.

You can reference Apple's list of requirements to create a podcast.

Barebones Example

Here is a bare bones example podcast I found on Github:

https://github.com/thisyearweconquer/thisyearweconquer.github.io

You'll see the rss file, image for the show, and a folder for the mp3s. The github pages for this is https://thisyearweconquer.github.io/feed.xml. Once these files are publicly viewable, it's just a matter of submitting the xml file to the podcast directories to be added to the various players like Apple Podcasts. This show is also setup with Podtrac analytics.

But that's it! That's all a podcast needs to be.

Creating the RSS file

The entire point of the RSS file is that it will describe the show, and point the listener to where the podcast cover art image is, and the audio files.

This is the trickiest file to get right. It must follow specific guidelines and be compliant to be accepted into Apple Podcasts. Here are Apple's requirements.

<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:media="http://www.rssboard.org/media-rss" version="2.0">
<channel>
<title>PODCAST TITLE</title>
<link>https://PODCAST URL.com/</link>
<language>en-us</language>
<atom:link href="https://PODCAST URL.com/feed.xml" rel="self" type="application/rss+xml"/>
<copyright>PODCAST CREATOR</copyright>
<itunes:subtitle>PODCAST SUBTITLE</itunes:subtitle>
<itunes:author>PODCAST CREATOR</itunes:author>
<itunes:summary>
PODCAST DESCRIPTION
</itunes:summary>
<itunes:keywords>
KEYWORD1,KEYWORD2,KEYWORD3,...
</itunes:keywords>
<description>
PODCAST DESCRIPTION
</description>
<itunes:owner>
<itunes:name>PODCAST CREATOR</itunes:name>
<itunes:email>PODCAST CREATOR@EMAIL.COM</itunes:email>
</itunes:owner>
<itunes:image href="https://PODCAST IMAGE.jpg"/>
<itunes:category text="CATEGORY1"></itunes:category>
<itunes:category text="CATEGORY2"></itunes:category>
<itunes:category text="CATEGORY3"></itunes:category>

<item>
<title>EPISODE TITLE</title>
<itunes:title>EPISODE TITLE</itunes:title>
<itunes:author>PODCAST CREATOR</itunes:author>
<itunes:subtitle>
EPISODE SUBTITLE
</itunes:subtitle>
<itunes:summary>
<![CDATA[
EPISODE DESCRIPTION
]]>
</itunes:summary>
<description>
<![CDATA[
EPISODE DESCRIPTION
]]>
</description>
<itunes:image href="https://OPTIONAL EPISODE IMAGE.jpg"/>
<enclosure url="https://LOCATION OF MP3.MP3" length="LENGTH" type="audio/mpeg"/>
<itunes:duration>DURATION</itunes:duration>
<itunes:season>SEASON #</itunes:season>
<itunes:episode>EPISODE #</itunes:episode>
<itunes:episodeType>full</itunes:episodeType>
<guid isPermaLink="false">
https://LOCATION OF MP3.MP3
</guid>
<pubDate>EPISODE PUBLISH DATE</pubDate>
<itunes:explicit>YES/NO</itunes:explicit>
</item>

... REPEAT <item> for each episode ...

</channel>
</rss>

All of the above is straight forward, just replace the uppercase with your own podcast information. The tricky part is length and duration. This needs to be calculated somehow as this is the audio file size and duration.

Python

Here's a snippet from a python script you can use to calculate the length and duration.

import os
from mutagen.mp3 import MP3

        statinfo = os.stat(mp3filename)
        size = str(statinfo.st_size)

        audio = MP3(mp3filename)
        length = str(audio.info.length)

        xmlfile += "<enclosure url='https://PODCAST URL/{}' length='{}' type='audio/mpeg'/>\n".format(mp3filename,size)
        xmlfile += "<itunes:duration>{}</itunes:duration>\n".format(length)
Jekyll

I prefer to use Jekyll to calculate the size and duration. Here is how I do it.

Add ruby-audioinfo to your Gemfile. Then run bundle install to install it.

Add to _config.yml:

plugins:
  - audioinfo

Now add the two files to the _plugins directory.

audio_duration.rb

module Jekyll
  class AudioDurationBlock < Liquid::Block

    def initialize(tag_name, markup, tokens)
      super
    end

    def render(context)
      AudioInfo.open(super) do |info|
        secs = info.length
        "%d:%02d" % [secs / 60, secs % 60]
      end
    end
  end
end

Liquid::Template.register_tag('audioduration', Jekyll::AudioDurationBlock)

filesize.rb

module Jekyll
  class FileSizeBlock < Liquid::Block

    def initialize(tag_name, markup, tokens)
      super
    end

    def render(context)
      "#{File.size super}"
    end
  end
end

Liquid::Template.register_tag('filesize', Jekyll::FileSizeBlock)

Now set it up so each episode is a post which has frontmatter that contains the location of the mp3 file. Here's how the frontmatter of one episode/post of my podcast looks like:

---
layout: post
title:  "NotPetya"
slug:   "54"
date:   2019-12-24 08:00:00 
explicit: false
categories: ["hacking", "ukraine", "russia", "maersk", "tools", "ransomeware"]
author: "Jack Rhysider"
podcast_file: "darknet-diaries-ep54-notpetya.mp3"
podcast_summary: "This is the story of NotPetya. Which seems to be the first time we've seen what a cyber war looks like. In the summer of 2017 Ukraine suffered a serious and catastrophic cyber attack on their whole country. Hear how it went down, what got hit, and who was responsible."
podcast_image: "/imgs/notpetya.jpg"
podcast_image_alt: "Giant person ripping ethernet out from a city"
mp3_url: "https://traffic.megaphone.fm/ADV7741006833.mp3"
---

This way, in your xml file, you can loop through each episode like this:

{% for post in site.posts limit:300 %}

This will let you loop through all episodes so that in the xml file you can do something like:

<enclosure url="https://PODCAST URL/{{ post.podcast_file }}" length="{% filesize %}./mp3s/{{post.podcast_file}}{% endfilesize %}" type="audio/mpeg" />

<itunes:duration>{% audioduration %}./mp3s/{{post.podcast_file}}{% endaudioduration %}</itunes:duration>

Here's a link to my entire Jekyll xml file.

After that, hopefully Jekyll is generating the proper RSS file.

Publishing

Once you have your xml file setup, your image ready, and your mp3s ready, publish them to your host. Whether it's github/aws/private server. They need to be accessible from the internet. So push them to a location that will serve them.

Validating the RSS file

Once you have a public RSS feed, run it through a validator such https://castfeedvalidator.com/ to make sure it is compliant. Make sure you squash any problems before submitting to Apple.

Submitting Podcast

Lastly you can submit your podcast so players can see them. https://lime.link/blog/where-to-submit-your-podcast/