Skip to content

Instantly share code, notes, and snippets.

@tikg
Last active January 20, 2023 07:21
Show Gist options
  • Select an option

  • Save tikg/708c8a6d78417d1a67cb3cbd042dc13b to your computer and use it in GitHub Desktop.

Select an option

Save tikg/708c8a6d78417d1a67cb3cbd042dc13b to your computer and use it in GitHub Desktop.

Homeserver Setup with CapRover, VM and Docker

Derived from Elitsur All credit goes to him

All below are notes from my experience with setting it up

Setting up Host VirtualBox environment

Buy domain from cloudflare
Download VirtualBox
Install Virtualbox
Download Ubuntu Server
Setup New VM in VirtualBox
Install Ubuntu on Minimal
Set Network to Bridge
If there is Invalid Settings Issue: Go Here

Fix: Re-download Virtualbox  
Launch as Admin  
Install as Repair  
Re-launch Virtualbox  

Activate in Advanced Bi-directional Copy-Paste

Install Necessary Utils

Utils: ping, ufw, vim, npm/Node.JS, dnf/cifs-utils,

sudo apt install vim ufw iputils-ping npm samba smbclient cifs-utils dnf winbind libnss-winbind libpam-winbind whois

Setting up Samba to copy paste url code as text

Only if necessary

sudo apt update
sudo apt install samba
whereis samba

Continue setting up samba based on link above.

Access windows from Linux command line

Setting up Docker

sudo apt-get update
sudo apt-get install 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

Installing docker compose to enable pulling of updated images

sudo apt-get install docker-compose

Checking docker statuses

sudo docker container ls  
sudo docker images  

Run Powershell as Admin and allow scripts to be run on your system here

Home Router Setup: Set Static IP / IP Reservation for your Ubuntu.

Home Router Setup: Set Port Forwarding on Router

Do not forget to ACTIVATE your port forward settings

Create Type A record on DNS Records on Cloudflare

Create API Tokens with below Settings

Zone - Zone Settings - Read
Zone - Zone - Read
Zone - DNS - Edit

Include - All zones

Allow SSH ports on Ubuntu first

*Don't forget to sudo ufw allow 80,443,3000,996,7946,4789,2377/tcp; ufw allow 7946,4789,2377/udp;

Installing ping on docker run

Modifying ports properly on Ubuntu

image

Text details to follow here.  
Make sure to enable ufw.
$ sudo ufw enable

Force ufw reset just in case

sudo ufw --force reset  

SSH to server and install CapRover

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

If all else fails try:

sudo docker run -e BY_PASS_PROXY_CHECK='TRUE' -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.soc
k:/var/run/docker.sock -v /captain:/captain caprover/caprover

or

sudo docker run -e MAIN_NODE_IP_ADDRESS='127.0.0.1' -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.soc
k:/var/run/docker.sock -v /captain:/captain caprover/caprover

If you encounter docker issues, try running nginx image

docker run -p 80:80 nginx

After running, try testing image Troubleshooting here

Successful Setup Should look like this:

image

Access Caprover and enter default password

captain42
image

Post login CapRover Setup

Install npm if required
sudo apt-get install -y npm

Follow instructions from localhost:3000 (after login)

Execute the following:
sudo npm i -g caprover
sudo caprover serversetup

Setup guide

Fixes

metadata.db (calibre-web) fix on CapRover

Download this fresh metadata.db file on your host. Credits to iJebus
Create /books folder on your container and chmod

docker exec -it CONTAINER_ID mkdir /books
docker exec -it CONTAINER_ID chmod a+w /books

Place the metadata.db file on the /books path and chmod it to be readable

docker cp /path/METADATA.DB.FILE CONTAINER_ID:/books/
docker exec -it CONTAINER_ID chmod a+w /books/METADATA.DB.FILE

Verify

docker exec -it CONTAINER_ID ls -lah /books

Use /books/ as Location and Click save. Worked like a charm for me!
image

@tikg
Copy link
Author

tikg commented Jan 4, 2023

Added Fixes section on the bottom, for fixing app Calibre-Web

@tikg
Copy link
Author

tikg commented Jan 4, 2023

Was able to deploy app from Dash by using pull latest image on deployment tab of App
Method 6: Deploy via ImageName

@tikg
Copy link
Author

tikg commented Jan 4, 2023

Data persistence for Calibre-web here

@tikg
Copy link
Author

tikg commented Jan 4, 2023

Deploying new calibre-web by using one click app and placing tag latest and clicking deploy
image

@tikg
Copy link
Author

tikg commented Jan 4, 2023

Ran one-click app as latest, but failed on Step 4.
Went to deployment tab and chose method 6 for "upgrade" to latest:
lscr.io/linuxserver/calibre-web:latest

@tikg
Copy link
Author

tikg commented Jan 5, 2023

Overlooked the "persistent data" option when creating Apps from scratch as One-Click on CapRover dashboard. Amazing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment