This commit is contained in:
DoTheEvo 2024-03-29 00:29:18 +01:00
parent 6c7a99e817
commit 8f1ae6955e
9 changed files with 472 additions and 95 deletions

View File

@ -222,29 +222,22 @@ or enable freshly discovered feature for all future deployments.
### For docker noobs
Docker is easy. Really.<br>
* [Beginners speedrun to selfhosting](beginners-speedrun-selfhosting/)
There are two main uses.
* For developers who daily work on apps and docker eases everything about it,
from setting up environment, to testing and deployment.
* A hosting approach, where you mostly care about getting containers, that are
prepared for you by developers, up and running.
### YouTube channels
This repo is about the second use. So be careful that you wont
spend time on resources used to educate developers. Sure, if you get through
that you will know docker better, but theres the danger that after sinking
4 hours reading and watching videos you still cant get a plain nginx web server
up and running and loses motivation.<br>
Maybe list of some youtube channels to follow would not be bad idea.
So when googling for guides, look for **docker compose**
rather than just **docker** tutorials.
* [Fireship](https://www.youtube.com/@Fireship/videos) - funny news and tips
* [TechnoTim](https://www.youtube.com/@TechnoTim/videos) - general homeserver selfhosting
* [Craft Computing](https://www.youtube.com/@CraftComputing/videos) - general homeserver, bit more focus on hw and building
* [Wolfgang's Channel](https://www.youtube.com/@WolfgangsChannel/videos) - general homeserver selfhosting, power consumption priority
* [Lawrence Systems](https://www.youtube.com/@LAWRENCESYSTEMS/videos) - general homeserver selfhosting
* [Christian Lempa](https://www.youtube.com/@christianlempa/videos) - general homeserver selfhosting
* [NASCompares](https://www.youtube.com/@nascompares) - Nas builds / home servers
* [Awesome Open Source](https://www.youtube.com/@AwesomeOpenSource/videos)
\- open source software insight
* [Hardware Haven](https://www.youtube.com/@HardwareHaven/videos) - nas, servers, miniPCs focused
* [ServeTheHome](https://www.youtube.com/@ServeTheHomeVideo/videos) - hardware, miniPCs, switches,.
[Beginners speedrun to selfhosting something in docker](beginners-speedrun-selfhosting/)
* [Good stuff](https://adamtheautomator.com/docker-compose-tutorial/)
* [https://devopswithdocker.com/getting-started](https://devopswithdocker.com/getting-started)
* [This](https://youtu.be/DM65_JyGxCo) one is pretty good. That entire channel
has good stuff.
Will add shit I encounter and like.

View File

@ -5,21 +5,22 @@
You want to selfhost stuff.<br>
You know little and want to start somewhere, FAST!
# Requirements
#### Requirements
* A **spare PC** that will be the server. Can be a **virtualmachine**.
* A **spare PC** that will be the server, can be a **virtualmachine**.
* **Google** and **chatGPT**.<br>
If the guide says do X and the steps seem insufficient,
you google that shit and add the word **youtube**,
or you ask chatGPT few questions.
# Common terminology
#### Common terminology
* `repository` - a place from which linux distro installs stuff
* `root` - name for an administrator account in linux,
but also can be a place - top level path
* `repository` - a place on the internet from which linux distro installs stuff.
* `root` - a name for an administrator account in linux.
Can also mean a place - top level path, like `c:\` is top in windows,
root - `\` is top level in linux.
* `sudo` - [executes](https://www.explainxkcd.com/wiki/images/b/b1/sandwich.png)
command as root with all privilages
command as root with all privilages.
# Install a Linux
@ -45,7 +46,8 @@ You know little and want to start somewhere, FAST!
except:
* SSH server
* standard system utilities<br>
* This means no graphical interface, just command line.
This linux will have no graphical interface, just command line.
# SSH
@ -76,34 +78,23 @@ To [check status](https://i.imgur.com/frlyy6P.png) of ssh - `systemctl status ss
* [have a pic](https://i.imgur.com/dHncQBv.png)
* [have a video](https://youtu.be/A7pHiPgW2u8&t=10s)
### Install few packages
Onnce you are comfortably connected install some handy utilities,
only **curl** is really needed.
`sudo apt install curl neofetch btop ncdu`
* curl - utility to download stuff, useful in the next section
* [neofetch](https://i.imgur.com/VlSAr59.png) - shows general info about the machine
* [btop](https://i.imgur.com/HS0gsYQ.png) - resource monitoring and task manager
* [ncdu](https://i.imgur.com/P6fIonK.png) - disk space use
# Install docker
![docker_logo](https://i.imgur.com/6SS5lFj.png)
**Docker** - a thing that makes hosting super easy. People prepared *recipes*,
you copy paste them, edit a bit, run them. [ChatGPT](https://i.imgur.com/eyWePqj.png).
**Docker** - a thing that makes hosting easier. People prepared *recipes*,
you copy paste them, edit a bit, run them. Bam a container is running
and answering at some IP. [ChatGPT](https://i.imgur.com/eyWePqj.png).
* **install docker** - `sudo curl -fsSL https://get.docker.com | bash`<br>
* **install docker** - `sudo wget -O- https://get.docker.com | bash`<br>
The above method is called
[Install using the convenience script](https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script)
[Install using the convenience script](https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script),
cuz oldman Debian cant be bothered to keep docker up to date in its repos.
* add your user to docker group so you dont need to sudo all the time<br>
* **add your user to docker group** so you dont need to sudo all the time<br>
`sudo gpasswd -a noob docker`
* log out - `exit`, log back in
* intall [**ctop**](https://github.com/bcicen/ctop) to get some basic monitoring and management.<br>
Unfortunately ctop is also not in debians repositories, so uglier
* log out - `exit`, log back in so the group change takes effect
* **install [ctop](https://github.com/bcicen/ctop)** to get some basic monitoring and management.<br>
Unfortunately ctop is also not in Debians repositories, so uglier
[two commands](https://github.com/bcicen/ctop?tab=readme-ov-file#linux-generic) to install it:
* `sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop`
* `sudo chmod +x /usr/local/bin/ctop`
@ -155,7 +146,109 @@ for editing files as it is simple and everywhere.
with the port 80 we see in the compose being used in the url too.
But since port 80 is the default http port, it is what browsers go for anyway.
# Moving beyond terminal
### understanding what you just did
* On a linux server a docker container is running, its a webserver and it is
accessible for others on your network.<br>
Most of selfhosted stuff is just webserver with some database.
* If this part is done that means that shit like hosting own netflix(jellyfin),
or google drive/calendar/photos(nextcloud), or own password manager(vaultwarden)
or own minecraft server(minecraft server) is just one `docker-compose.yml` away.
### understanding what you did not get done
* this shit is on your own local network, not accessible from the outside.
Cant call the grandma and tell her to write `192.168.1.8` in to her browser
to see your awesome nginx welcome running.
She tells you that the dumb fuck you are, you do not have public IP and ports
forwarded.<br>
To get that working is bit challenging, probably deserves own page,
not really speedrun, but thorough steps as shit gets sideways fast and people
can dick around for hours trying wrong shit.
* everything here is just basic setup that breaks easily,
server got dynamic IP, turn it off for a weekend and it might get a different ip
assigned next time it starts. Nginx container is not set to start on boot,...
* you dont understand how this shit works, deploying more complicated stuff,
fixing not working stuff be hard, but now you can start to consume all
the guides and tutorials on docker compose and try stuff...
# WebGUI
* *my recommendation is to not abandon the ssh + terminal. Persevere.
Use it, make it comfortable, natural, not foreign and bothersome.
This is what gets you proficiency and ability to solve problems...
but I understand*
Several options to manage docker using a website.
* Portainer CE - the most popular, deployed as a container, they started to push hard
their paid version so fuck em
* **CasaOS** - simple install, seems nice and growing in popularity
* **Dockge** - a very new one, but seems nice and simple
* TrueNAS SCALE - NAS operating systems with docker managment
* openmediavault - NAS operating systems with docker managment
* Unraid - paid NAS operating systems with docker managment
# CasaOS
[The official site](https://casaos.io)
Easy to also create public shares, easy to deploy docker popular docker
containers from their *"app store"*
#### Installation
* `docker compose down` any containers you run, or remove them in ctop, or
do clean Debian install again
* To install CasaOS execute:<br>
`sudo wget -O- https://get.casaos.io | sudo bash`
* Afterwards, it tells the ip to visit.
* First login set credentials
---
<details>
<summary><b><font size="+1">Create a network share </font></b></summary>
test
</details>
---
---
<details>
<summary><b><font size="+1">Deploy Crafty - Minecraft server manager</font></b></summary>
test
</details>
---
---
<details>
<summary><b><font size="+1">Deploy Jellyfin - selfhosted netflix</font></b></summary>
test
</details>
---
---
<details>
<summary><b><font size="+1">Deploy something not in the app store</font></b></summary>
test
</details>
---
---
# Dockge
![dockge_pic](https://i.imgur.com/Vh0JN5F.png)
@ -193,37 +286,26 @@ using slightly edited compose file from their
Now you can do stuff from webgui, pasting compose and .env files.
# understanding what you just did
* On a linux server a docker container is running, its a webserver and it is
accessible for others on your network.<br>
Most of selfhosted stuff is just webserver with some database.
* If this part is done that means that shit like hosting own netflix(jellyfin),
or google drive/calendar/photos(nextcloud), or own password manager(vaultwarden)
or own minecraft server(minecraft server) is just one `docker-compose.yml` away.
# understanding what you did not get done
* this shit is on your own local network, not accessible from the outside.
Cant call the grandma and tell her to write `192.168.1.8` in to her browser
to see your awesome nginx welcome running.
She tells you that the dumb fuck you are, you do not have public IP and ports
forwarded.<br>
To get that working is bit challenging, probably deserves own page,
not really speedrun, but thorough steps as shit gets sideways fast and people
can dick around for hours trying wrong shit.
* everything here is just basic setup that breaks easily,
server got dynamic IP, turn it off for a weekend and it might get a different ip
assigned next time it starts. Nginx container is not set to start on boot,...
* you dont understand how this shit works, deploying more complicated stuff,
fixing not working stuff be hard, but now you can start to consume all
the guides and tutorials on docker compose and try stuff...
## where to go from here
Can check out [this repo](https://github.com/DoTheEvo/selfhosted-apps-docker)
Google and consume docker tutorials and videos and try to spinning up
some containers.<br>
Heres some stuff I encountered and liked.
* [8 min video on docker](https://www.youtube.com/watch?v=rIrNIzy6U_g)
* [docker compose cheat sheet](https://devopscycle.com/blog/the-ultimate-docker-compose-cheat-sheet/)
* [Good stuff](https://adamtheautomator.com/docker-compose-tutorial/)
* [https://devopswithdocker.com/getting-started](https://devopswithdocker.com/getting-started)
* [NetworkChuck](https://www.youtube.com/@NetworkChuck/videos)
\- youtube channel
has some decent stuff, specificly [this docker networking](https://youtu.be/bKFMS5C4CG0)
video is fucking great and the general
[introduction to docker compose](https://youtu.be/DM65_JyGxCo) is good too.
* [Christian Lempa](https://www.youtube.com/@christianlempa/search?query=docker)
\- lot of videos about docker
Check of course [this github repo you are in right](https://github.com/DoTheEvo/selfhosted-apps-docker)
for some stuff to deploy.
It has tiny section for noobs, with few links to docker tutorials.<br>
You should get some understanding of docker networks going,
making sure you create custom named one and use that in your compose files.
Then its time to start trying stuff like bookstack or jellyfin or minecraft.

0
disk_NAS_bench_Fio/lawrance_script.sh Executable file → Normal file
View File

View File

@ -7,9 +7,8 @@
Free virtual private server hosting on a cloud.<br>
Here are github repos with details on various providers:
* [Cloud Service Providers Free Tier Overview](https://github.com/cloudcommunity/Cloud-Free-Tier-Comparison)
* [Stack on a budget](https://github.com/255kb/stack-on-a-budget)
* [Cloud Service Providers Free Tier Overview](https://github.com/cloudcommunity/Cloud-Free-Tier-Comparison)
So far I only run Oracle Cloud.<br>
Will add others if I will deal with them, or if Oracle fucks me over.
@ -169,3 +168,51 @@ Some youtube videos and articles
* [youtube-1](https://youtu.be/NKc3k7xceT8)
* [youtube-2](https://youtu.be/zWeFD4NNF5o)
* [ryanharrison - oracle-cloud-free-server](https://ryanharrison.co.uk/2023/01/28/oracle-cloud-free-server.html)
# GCE - Google Compute Engine
![logo-gce](https://i.imgur.com/Eau2Hm5.png)
### What Free Tier Offers
[Official docs](https://cloud.google.com/free/docs/free-cloud-features#compute)
As of 2023.
* 1 e2-micro VM instance; 0.25-2 vCPU (1 shared core); 1GB ram
* 30 GB disk storage (default 10GB)
* 600/300 Mbps bandwidth
* 1 GB per month outbound data transfer
### Registration
Credit card is required.<br>
Otherwise it's smooth process as you likely have google account,
and if you have credit card tight to, its just few yes clicks.
### New VM instance in Free Tier
On the GCE console web
* Create a new project named whatever lowercase.
* Add your SSH key to be able to ssh in<br>
left pane > metadata > SSH Keys > Edit > Add Item<br>
* Create a new virtual machine<br>
left pane > Compute Engine > VM instances > Create new instance
* it asks to enable Compute Engine API, enable it
* Name
* Region - must be one the three: `us-west1`, `us-central1`, `us-east1`
* Zone - default
* Machine series - `E2`
* Machine type - e2-micro(2vCPU, 1 core, 1GB memory)
* stuff left on default
* Boot disk > Change
* debian 12 (latest)
* disk increase if desired, up to 30GB should be free
* Firewall > allow both `http` and `https` traffic
* CREATE
After few minutes new one with public IP listed should be listed.<br>
Test ssh in to it from your terminal.

View File

@ -0,0 +1,49 @@
# Get Good in Linux terminal
###### guide-by-example
WORK IN PROGRESS<br>
WORK IN PROGRESS<br>
WORK IN PROGRESS<br>
You want or need to use terminal in linux.<br>
You want it to not suck donkey balls.
*requirements* - installed linux distro once, knows what a distro is,
knows how how to install packages in linux, knows what a repository is
and other basic terms
### Core aspects to make comfortable
* Terminal
* ssh in to linux
* moving between directories
* editing files
### Advanced aspects
* shell
* services and systemd
* logs
* scheduled stuff
* filesystems and mounting
# Terminal
The application that you run to connect remotely to a server.<br>
For windows you want to use mobaXterm. Learn how to use well.
Tips
* set font globaly to something larger, like 14<br>
Settings > Configuration > Terminal > Default Font Settings<br>
be aware that once set it only applies to newly created sessions,
if there is a session in left pane it already has own settings that needs changing
* be aware of copy paste in it, middle click right click menu
*
# SSH
You connect to the linux server only sometimes, but when you do
you want it to be instant

View File

@ -170,16 +170,6 @@ Manual image update:
- `docker-compose up -d`</br>
- `docker image prune`
# Backup and restore
# Useful
#### Backup
Using [borg](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/borg_backup)
that makes daily snapshot of the entire directory.
#### Restore
* down the bookstack containers `docker-compose down`</br>
* delete the entire bookstack directory</br>
* from the backup copy back the bookstack directory</br>
* start the containers `docker-compose up -d`
* https://www.reddit.com/r/selfhosted/comments/1bit5xr/livetv_on_jellyfin_2024/

146
lubelog/readme.md Normal file
View File

@ -0,0 +1,146 @@
# LubeLog in docker
###### guide-by-example
![logo](https://i.imgur.com/7zjQQzy.png)
# Purpose & Overview
Vehicle service records and maintainence tracker.
* [Official site](https://lubelogger.com/)
* [Github](https://github.com/hargata/lubelog)
LubeLogger is a new open source vehicle info dump place.
Written in javascript with LiteDB file based database.
# Files and directory structure
```
/home/
└── ~/
└── docker/
└── LubeLog/
├── 🗁 lubelog_config/
├── 🗁 lubelog_data/
├── 🗁 lubelog_documents/
├── 🗁 lubelog_images/
├── 🗁 lubelog_keys/
├── 🗁 lubelog_log/
├── 🗁 lubelog_temp/
├── 🗁 lubelog_translations/
├── 🗋 .env
└── 🗋 docker-compose.yml
```
* `lubelog directories` - with data
* `.env` - a file containing environment variables for docker compose
* `docker-compose.yml` - a docker compose file, telling docker how to run the containers
Only the two files are required. The directories are created on the first run.
# docker-compose
[Dockercompose](https://github.com/hargata/lubelog/blob/main/docker-compose.yml)
from the github page used as a template.
`docker-compose.yml`
```yml
services:
lubelog:
image: ghcr.io/hargata/lubelogger:latest
container_name: lubelog
hostname: lubelog
restart: unless-stopped
env_file: .env
volumes:
- ./lubelog_config:/App/config
- ./lubelog_data:/App/data
- ./lubelog_translations:/App/wwwroot/translations
- ./lubelog_documents:/App/wwwroot/documents
- ./lubelog_images:/App/wwwroot/images
- ./lubelog_temp:/App/wwwroot/temp
- ./lubelog_log:/App/log
- ./lubelog_keys:/root/.aspnet/DataProtection-Keys
ports:
- 8080:8080
networks:
default:
name: $DOCKER_MY_NETWORK
external: true
```
`.env`
```bash
# GENERAL
DOCKER_MY_NETWORK=caddy_net
TZ=Europe/Bratislava
#LUBELOG
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
MailConfig__EmailServer=smtp-relay.brevo.com
MailConfig__EmailFrom=lubelog@example.com
MailConfig__UseSSL=True
MailConfig__Port=587
MailConfig__Username=<registration-email@gmail.com>
MailConfig__Password=<brevo-smtp-key-goes-here>
LOGGING__LOGLEVEL__DEFAULT=Error
```
**All containers must be on the same network**.</br>
Which is named in the `.env` file.</br>
If one does not exist yet: `docker network create caddy_net`
# Reverse proxy
Caddy v2 is used, details
[here](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/caddy_v2).</br>
`Caddyfile`
```php
auto.{$MY_DOMAIN} {
reverse_proxy lubelog:80
}
```
# First run
---
# Trouble shooting
# Update
Manual image update:
- `docker-compose pull`</br>
- `docker-compose up -d`</br>
- `docker image prune`
It is **strongly recommended** to now add current **tags** to the images in the compose.<br>
Tags will allow you to easily return to a working state if an update goes wrong.
# Backup and restore
#### Backup
#### Restore
# Backup of just user data
#### Backup script
#### Cronjob - scheduled backup
# Restore the user data

View File

@ -1,7 +1,14 @@
# reset config
`/system reset-configuration`
# clien mode range extender
# Dumb switch with wifi AP
## Objective
## Steps

View File

@ -0,0 +1,63 @@
# Mounting Network Shares in Linux
possible ways to mount stuff - fstab, autofs, systemd, docker volumes if its for docker
possible types of shares
* smb/samba/cifs - the most common share, support on all OS
* nfs - mostly used between linux machines, bit better performance
* iSCSI - the share is mounted as a block device as if it was really a disk,
great performance for small files
More on setup of these shares is in
[TrueNAS Scale guide.](https://github.com/DoTheEvo/selfhosted-apps-docker/tree/master/trueNASscale)
# smb/samba/cifs
[Arch wiki](https://wiki.archlinux.org/title/samba#As_systemd_unit)
on samba systemd mount
* you will create two files in `/etc/systemd/system`
* one will have extension `.mount` the other `.automount`
* the name will be the same for both and it MUST correspond with the planned
mount path. Slashes `/` being replaced by dashes `-`.<br>
So if the share should be at `/mnt/mirror` the files are named
`mnt-mirror.mount` and `mnt-mirror.automount`
* copy paste the bellow content, edit as you see fit,
changing description, ip address and path, user and password,..
* linux command `id` will show your current user `uid` and `gid`
* after ther changes execute command `sudo systemctl enable mnt-mirror.automount`
This will setup mounting that does not fail on boot if there are network issues,
and really mounts the target only on request
`mnt-mirror.mount`
```ini
[Unit]
Description=3TB truenas mirror mount
[Mount]
What=//10.0.19.11/Mirror
Where=/mnt/mirror
Type=cifs
Options=rw,username=kopia,password=aaa,file_mode=0644,dir_mode=0755,uid=1000,gid=1000
[Install]
WantedBy=multi-user.target
```
`mnt-mirror.automount`
```ini
[Unit]
Description=3TB truenas mirror mount
[Automount]
Where=/mnt/mirror
[Install]
WantedBy=multi-user.target
```
### Useful commants
`smbclient -L 10.0.19.11` - list shares mounted from the ip
`systemctl list-units -t mount --all`