MediaCMS – Hosting your own video platform.

Open Source solution MediaCMS, is a self hosting YouTube like clone, allowing you to upload, encode, and stream your videos. Allowing for a open community, your own platform, a family friendly site, even ahem a “paid” site.

Why self-host

There are many reasons where self-hosting our content is preferable over utilizing one of the commercial solutions:

  • We want to maintain full control of what is getting uploaded.
  • We want to serve ads-free content to our users, and avoid unneeded distractions, for example, a plethora of totally unrelated (but interesting!) content.
  • We care about privacy and don’t want our users to get tracked by a number of external services while browsing the content, for advertising purposes.
  • We don’t want the content to leave the company/organization —for example, a company might have training material for new employees that they do not want to leave their own infrastructure and not be uploaded to the internet.
  • Low internet connectivity, or no internet at all, this is the case for a number of rural areas, where serving content from a local network will be preferred.

So lets make a Video Portal.

We will make a video portal to upload videos from our 2021 holidays. The portal will be public, served under its own domain, under HTTPS.

If you don’t have a valid domain name you can still follow up the instructions and skip any part that specifies working with the domain name. MediaCMS will utilize any IP address it finds on the server.

We encourage users to upload content, so the workflow will be that

  • users self-register their accounts
  • users upload their videos, then optionally assign tags to them, curate titles/descriptions, and set categories
  • users may comment on other users videos or organize them through playlists
  • users may add interactions such as like/dislike
  • portal manager(s) get notified of incoming videos

Videos will get transformed to web-friendly formats (a procedure called transcoding) and will be available for streaming, but also to download.

Content is served as mp4 video files, but also through HLS adaptive streaming, a technology where the browser negotiates what resolutions to request from the server in order to stream to the user, based on its network bandwidth at the time, so the experience is optimized for the end-user.

Or lets create a closed portal where users can not upload content, it allows you to control 100% of everything on your site/network. You can even disable user(s), thumbs up, thumbs down, even down to encoding so the users only see the content in the format you want them to see it in.

Lets get going, so first things first, lets head over to your favorite VPS provider, again we love BuyVM, and Linode. Please note there are three (basic) setups.

  1. A startup, that wants dozens of files to be streamed or uploaded.
  2. A closed system that only hosts the videos you want to.
  3. A open system that limits users, uploads, and streaming formats.

I am going to focus in this write up on a closed system where the admin controls the content, and the formats. I will use https://videos.theserveradmin.com as the working example. I created this demo with no user registrations, no content approvel, and no encoding. This way I alone control what is on the site, and with the no encoding, the videos are streamed out in the format I want, which in this case is 1080p HD.

So lets get started, I headed over to Linode and I signed up for a simple 1GB Nano VPS, costing all of $5/Month. ** I selected Debian 11, as that is what is recommend. I am not going to go over this process, as I assume one can get this done. Ok so now that we have the VPS online, we have a few items of things to do. Now I am not going to go into crazy details, but there are many setup guides out there but darn it if they don’t go over some of the basics *at least to me.

So ssh into your vps.

ssh root@ip address or DNS name if you already set this up.  You did right?

Now we have to do some basics, but again it seems that nobody talks about this.

passwd root

Why is that always overlooked? I mean your password is 95% of the time emailed to you, or such as Linode you still put it into an online submit form. *** Not saying ANYTHING BAD about Linode, just a statement.

Now we need to do a few more things.

apt-get update
apt install ufw

Yes a firewall!! Holy cow how many write ups forget this. MediaCMS sets up a ton of items but not the firewall.

ufw allow 22
ufw allow 80
ufw allow 443
ufw enable

Now lets update this and start things going.

apt-get update; apt-get upgrade -y ; apt-get install git -y

Ok yay! We have your root password reset, a firewall installed with the 3 open ports you need, your system updated, and upgraded, and then git installed.

Now lets get MediaCMS installed and configured.

mkdir /home/mediacms.io && cd /home/mediacms.io/ && git clone https://github.com/mediacms-io/mediacms && cd /home/mediacms.io/mediacms/ && bash ./install.sh

This will start off the install, during the install you will be asked a few questions.

Welcome to the MediacMS installation!
This script will attempt to perform a system update, install required dependencies, install and configure PostgreSQL, NGINX, Redis and a few other utilities.
It is expected to run on a new system **with no running instances of any these services**. Make sure you check the script before you continue. Then enter yes or no

Enter Yes.

yes
OK!
Performing system update and dependency installation, this will take a few minutes.

Give your system a few minutes now.

Enter portal URL, or press enter for localhost :

You can press enter, and this will install MediaCMS and make it available on all ips of the server, plus give it a default portal title. But remember, if you are going to use our own DNS name, and get a valid SSL certificate automatically produced for us, you will need to specify the URL of our portal, plus a custom title optionally.

Enter portal URL, or press enter for localhost : videos.theserveradmin.com
Enter portal name, or press enter for 'MediaCMS : Videos The Server Admin

After a few more minutes the installation completes, and the last message we see is:

MediaCMS installation completed, open browser on http://videos.theserveradmin and login with user admin and password ds8uy2ls0sk

Congratulations, we have a working MediaCMS installation! Keep note of the admin password auto-generated for you.

Backend Configuration.

Ok, so I am going to show you how I have my demo https://videos.theserveradmin.com setup. I have the following setup.

  • Now User Registration.
  • No User Uploads.
  • No Encoding * I upload 1080p HD videos that is viewable even on cell phones now.
  • No Email or Email Notifications.

We need to edit only one file to make the above happen. ** BIG NOTE ** The file what we are going to edit pretty much controls the entire site, so back it up, and be sure you are following the example and or the docs exactly: https://github.com/mediacms-io/mediacms/blob/main/docs/admins_docs.md

I use nano, your free to use what you want.

nano /home/mediacms.io/mediacms/cms/settings.py

Now at the top look for the following

# PORTAL NAME, this is the portal title and
# is also shown on several places as emails
PORTAL_NAME = "Video - The Server Admin"
PORTAL_DESCRIPTION = "Video Demo - MediaCMS"
LANGUAGE_CODE = "en-us"
TIME_ZONE = "Europe/London"

Now you have to change this to your information, the install for some reason does not set this, but only in the database.

Now look for the following and change to

# These are passed on every request
# if set to False will not fetch external content
# this is only for the static files, as fonts/css/js files loaded from CDNs
# not for user uploaded media!
LOAD_FROM_CDN = False
LOGIN_ALLOWED = False  # whether the login button appears
REGISTER_ALLOWED = False  # whether the register button appears
UPLOAD_MEDIA_ALLOWED = False  # whether the upload media button appears

Now find the last piece, which is all the way at the end, like 15 lines up. and change it to

# if True, only show original, don't perform any action on videos
DO_NOT_TRANSCODE_VIDEO = True

Now save everything. Ok so for me, at this point I restart the vps, this gives everything a fresh clean load.

reboot

Now depending on the vps you purchased but assuming your justing started and got the same $5 one at Linode give yourself about 60ish seconds for the system to reboot and all the services to start.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *