Self-hosting means the practice of running some services yourself and maintaining and controlling it to the fullest extent you can. There are several reasons to self-host apps - you might be paranoid about Google / Apple having your data (photos, email, etc.), you might want to access a remote PC for work / school or host some website for your family and friends or just have fun tinkering and trying out new apps.
You can host a Google Photos like app, your own email client, a Wordpress website, Repl.it type service and much more. Although there are well written tutorials regarding all those different apps, I have found managing many apps and quickly trying out or debugging to be a huge bottleneck. It was a hassle and not the most fun thing to do especially when you want it to always work. Until I had found CapRover.
From its website -
> CapRover is an extremely easy to use app/database deployment & web server manager for your NodeJS, Python, PHP, ASP.NET, Ruby, MySQL, MongoDB, Postgres, WordPress (and etc...) applications!
CapRover basically is a simple tool to manage, create and deploy all types of applications. It uses Docker at its core and has a powerful and super functional & beautiful GUI to manage everything. It has an amazing collection of one-click to install apps and it auto generates and renews Let's Encrypt SSL certificates, making it as easy as clicking a button to deploy your own Google Drive alternative. The best part is that even after removing the CapRover utility, all the apps continue to function. Did I mention it's open-source!
(GitHub)
First off, you need a system to install CapRover on. For self-hosting the best thing is to have a server / old-pc / raspberry pi running in your home. You can also use a reputed Cloud Provider like Digital Ocean (affiliate link) to quickly create a small VM for free and play with it.
Currently, Oracle Cloud is offering amazing Always-Free tier with 2 AMD CPU cores or 4 ARM cores and 24 Gigs of RAM, also 200 GB storage, which is more than enough for most use-cases.
You can follow an amazing guide on their website to quickly get started, or expand the Steps below.
I would recommend Ubuntu as the distro of choice because most docker images function best with it. Official recomendation is for Ubuntu 18.04 but for me 20.04 has worked fine.
Step 0 : SSH into the machine (VM or bare-metal and follow these instructions)
Code to Upgrade packages:
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
To verify if Docker is working:
sudo docker run hello-world
Configure Firewall
Clear all already set iptables if set by your cloud provider and configure firewall via UFW (personal preference)
Also make sure to allow ports which you are actively using for caprover from your router or cloud provider's console.
sudo ufw allow 22,80,443,3000,996,7946,4789,2377/tcp; sudo ufw allow 7946,4789,2377/udp;
Installing Caprover
Just run the following line, sit back and enjoy!
sudo docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover
NOTE: Do not change the port mappings. CapRover only works on the specified ports.
Configure domain name (after port forwarding if hosting in your home)
*.domain.name should point to publicly reachable IP address of the machine
Assuming you have npm installed on your local machine (e.g., your laptop), simply run (add sudo if needed):
npm install -g caprover
Then, run
caprover serversetup
and follow the instructions shown.
CapRover should be available on the domain name you configured it with.
Once you login you will see a simple UI, click on one-click apps.
Firstly, these are some apps which I use and love, though your preference may vary. Secondly, it's not just that you can JUST install the apps already there, but in fact you can install any you like (instructions for same), although most well maintained apps are already available as one-click images.
If you are using an ARM processor (Raspberry Pi / Graviton instance, etc.) some images might not work and some tweaks may be needed in the captain-definition file. One such example for WordPress is attached below, and I will be adding others as and when I find compatibility issues.
Nextcloud
It is a must have all-in-one platform. It is Google Drive + Photos + Docs + iMessage combined. In fact it also has a huge library of apps you can install, within a Nextcloud instance. Link
Duplicati
Duplicati is a backup solution that takes encrypted backups to almost any provider of your choice (Backblaze, Onedrive, etc.) You might want to backup Nextcloud photos / notes or any other file to an offsite location. Link
Invidious
An alternative front-end for YouTube. Very customizable and mobile-friendly! Link
Plausible Analytics
Privacy friendly analytics platform for your websites. Link
Poste.io
A complete email server. Email hosting is hard, but with Poste.io not so much. Super easy and quick to setup. Link
Searx
A privacy-respecting meta search engine. Proxy your Google search results. Use multiple search engines - all from one place. Link
PrivateBin
PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Link
VScode via code-server
Run VS Code on any machine anywhere and access it in the browser. This has been a game-changer for me personally as now I can code my school projects and assignments from a chromebook, desktop PC, or any other device, with continuity and is maintained perfectly between all the devices. Link
Others
There are multiple RSS feed readers, database images, website platforms (Ghost, WP, etc.), File managers, Joplin server, Adguard Home, Plex, Etherpad, Gitea and many more. With CapRover you can easily try out as many as you want. Also you can host custom docker images, apps, etc.
With ability to easily (with press of a button) install and try out apps, auto generate SSL certs, and an amazing monitoring utility NetData already bundled in, it is the best platform to self-host most services (that offer docker images! - or which you can maintain). And probably the best for most users.
The only downside is that being a nodeJS application, its ram usage is a little high - although not even close to being a hinderance for most people.
CapRover ARM Wordpress Template
For Wordpress (with Database) -> using MariaDB for Databse
captainVersion: 4
services:
$$cap_appname-db:
image: arm64v8/mariadb:$$cap_database_version
volumes:
- $$cap_appname-db-data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: $$cap_db_pass
MYSQL_DATABASE: wordpress
MYSQL_USER: $$cap_db_user
MYSQL_PASSWORD: $$cap_db_pass
caproverExtra:
notExposeAsWebApp: 'true'
$$cap_appname-wordpress:
depends_on:
- $$cap_appname-db
image: arm64v8/wordpress:$$cap_wp_version
volumes:
- $$cap_appname-wp-data:/var/www/html
restart: always
environment:
WORDPRESS_DB_HOST: srv-captain--$$cap_appname-db:3306
WORDPRESS_DB_USER: $$cap_db_user
WORDPRESS_DB_PASSWORD: $$cap_db_pass
caproverOneClickApp:
variables:
- id: $$cap_db_user
label: Database user
defaultValue: wordpressuser
validRegex: /^([a-zA-Z0-9])+$/
- id: $$cap_db_pass
label: Database password
description: ''
validRegex: /^(\w|[^\s"'\\])+$/
- id: $$cap_wp_version
label: WordPress Version
defaultValue: '5.8'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/arm64v8/wordpress/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_database_version
label: Database Version, for MariaDB
defaultValue: 'latest'
description: We are USING MARIADB| Check out the Docker pages for the valid tags https://hub.docker.com/r/arm64v8/mariadb/tags
validRegex: /^([^\s^\/])+$/
instructions:
start: >-
WordPress is an online, open source website creation tool written in PHP. But in non-geek speak, it’s probably the easiest and most powerful blogging and website content management system (or CMS) in existence today.
Enter your WordPress Configuration parameters and click on next. A MariaDB (database) and a WordPress container will be created for you. The process will take about a minute for the process to finish.
end: >
Wordpress is deployed and available as $$cap_appname-wordpress .
IMPORTANT: It will take up to 2 minutes for WordPress to be ready. Before that, you might see a 502 error page.
displayName: WordPress
description: WordPress is one of the most popular a content management system (CMS) based on PHP.
documentation: Taken from https://docs.docker.com/compose/wordpress/. Port mapping removed from WP as it is no longer needed
CapRover ARM Etherpad Template
captainVersion: 4
services:
$$cap_appname:
image: vimarsh244/arm-etherpad:$$cap_etherpad_version
depends_on:
- $$cap_appname-db
environment:
NODE_ENV: production
DB_TYPE: mysql
DB_HOST: srv-captain--$$cap_appname-db
DB_PORT: '3306'
DB_NAME: etherpad
DB_USER: etherpad
DB_PASS: $$cap_db_pass
DB_CHARSET: utf8mb4
TRUST_PROXY: 'true'
caproverExtra:
containerHttpPort: '9001'
$$cap_appname-db:
image: mariadb:$$cap_mysql_version
volumes:
- $$cap_appname-db-data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: $$cap_db_pass
MYSQL_DATABASE: etherpad
MYSQL_USER: etherpad
MYSQL_PASSWORD: $$cap_db_pass
caproverExtra:
notExposeAsWebApp: 'true'
caproverOneClickApp:
variables:
- id: $$cap_etherpad_version
label: Etherpad Docker Image
defaultValue: latest
description: Check out their Docker page for the valid tags https://hub.docker.com/r/vimarsh244/arm-etherpad/tags
- id: $$cap_db_pass
label: Database password
description: ''
validRegex: /.{1,}/
- id: $$cap_mysql_version
label: Mariadb Version
defaultValue: '10.5.7'
description: Check out their Docker page for the valid tags https://hub.docker.com/_/mariadb/tags/
validRegex: /^([^\s^\/])+$/
instructions:
start: Etherpad is a real-time collaborative editor for the web
end: Etherpad is a real-time collaborative editor for the web is deployed and available as srv-captain--$$cap_appname. Note that the application may take some time to become available.
displayName: Etherpad
isOfficial: true
description: Etherpad is a real-time collaborative editor for the web
documentation: 'https://github.com/ether/etherpad-lite/blob/develop/doc/docker.md'