Update README.md

This commit is contained in:
2024-02-03 10:55:57 +00:00
parent 60a3ec3558
commit 17ca1c805f
+313 -65
View File
@@ -1,93 +1,341 @@
# Home Server ## Directories in /srv
```bash
➜ /srv ls -la
## Getting started total 64
drwxr-xr-x 16 null null 4096 Jul 15 06:23 .
To make it easy for you to get started with GitLab, here's a list of recommended next steps. drwxr-xr-x 26 root root 4096 Jun 24 06:11 ..
drwxr-xr-x 4 root root 4096 Dec 22 2020 convos
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! drwxrwxr-x 2 null null 4096 Jul 15 06:23 file_browser
drwxr-xr-x 5 root root 4096 Aug 8 2020 gitlab
## Add your files drwxrwxr-x 3 root root 4096 Aug 7 2020 gitlab-runner
drwxrwxr-x 2 999 root 4096 Jun 10 11:33 hastebin
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files drwxrwxr-x 4 root root 4096 Aug 7 2020 jackett
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: drwxr-xr-x 3 root root 4096 Jan 7 2021 jellyfin
drwxrwxr-x 4 root root 4096 Aug 7 2020 mongodata
``` drwxr-xr-x 8 root root 4096 Aug 9 2020 nextcloud
cd existing_repo drwxrwxr-x 4 root root 4096 Aug 7 2020 sonarr
git remote add origin https://gitlab.com/null4bl3/home_server.git drwx------ 4 null null 4096 May 8 19:30 syncthing
git branch -M main drwxrwxr-x 3 null null 4096 Oct 1 2020 traefik
git push -uf origin main drwxrwxr-x 3 null null 4096 Jan 28 12:25 xbs
drwxrwxr-x 5 null null 4096 Aug 7 2020 znc
``` ```
## Integrate with your tools OR tree:
- [ ] [Set up project integrations](https://gitlab.com/null4bl3/home_server/-/settings/integrations)
## Collaborate with your team ```sh
.
├── cube
│   └── schema
├── dim
├── emby
│   ├── cache
│   ├── config
│   ├── data
│   ├── logs
│   ├── metadata
│   ├── plugins
│   ├── root
│   └── transcoding-temp
├── emu
│   ├── config
│   └── data
├── file_browser
├── ftp
├── gitea
│   ├── git
│   ├── gitea
│   └── ssh
├── gitlab
│   ├── config
│   ├── data
│   └── logs
├── gitlab-runner
├── http
├── jellyfin
│   └── config
├── kuma
│   ├── kuma.db
│   ├── kuma.db.bak0
│   ├── kuma.db-shm.bak0
│   ├── kuma.db-wal.bak0
│   └── upload
├── mastodon
│   ├── postgres14
│   ├── redis
│   ├── sidekiq
│   └── web
├── nextcloud
│   ├── apps
│   ├── config
│   ├── data
│   └── database
├── plausible-clickhouse
│   ├── clickhouse-config.xml
│   ├── clickhouse-user-config.xml
│   └── event-data
├── plausible-db-data [error opening dir]
├── plausible-geoip
├── plex
├── portainer
│   └── portainer-data
├── syncthing
│   ├── cert.pem
│   ├── config.xml
│   ├── config.xml.v0
│   ├── csrftokens.txt
│   ├── https-cert.pem
│   ├── https-key.pem
│   ├── index-v0.14.0.db
│   ├── key.pem
│   └── Sync
├── tmm
├── traefik
├── vaultwarden_data
│   ├── attachments
│   ├── db.sqlite3
│   ├── db.sqlite3-shm
│   ├── db.sqlite3-wal
│   ├── icon_cache
│   ├── rsa_key.pem
│   ├── rsa_key.pub.pem
│   ├── sends
│   ├── tmp
│   └── vaultwarden.log
├── vaultwarden_data_backup [error opening dir]
├── youtube_dl
│   ├── appdata
│   ├── db
│   └── users
└── znc
├── configs
├── moddata
├── users
└── znc.pem
```
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy Create the `traefik` network
Use the built-in continuous integration in GitLab. ```sh
docker network create traefik
```
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
*** ## Docker Swarm
# Editing this README ```sh
docker swarm init
```
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. ## Mount NFS NAS Share
## Suggestions for a good README We need the `nfs-utils` package installed.
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. ```sh
sudo mount -t nfs -o nfsvers=4 192.168.1.110:/media /WHERE/TO/MOUNT
sudo mount -t nfs -v 192.168.1.110:/media /home/knast/shares/disk1
```
## Name if mounting on host, add to `fstab`
Choose a self-explaining name for your project.
## Description ```sh
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. 192.168.1.110:/media /home/null/shares/disk1 nfs rw,auto,vers=3,nofail,noatime,nolock,timeo=14 0 0
```
## Badges Or create a docker volume for the nfs mount that can then be accessed in compose file:
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals ```sh
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.110,rw,vers=4 --opt device=:/media --name nfs_data
```
## Installation The volume can then be mounted in the compose file in the following way:
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage ```yml
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. version: "3"
services:
web-server:
image: nginx:latest
ports:
- 1212:80
volumes:
- nfs_data:/usr/share/nginx/html
## Support volumes:
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. nfs_data:
external: true
## Roadmap networks:
If you have ideas for releases in the future, it is a good idea to list them in the README. traefik:
external: true
## Contributing ### Firewall
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. ```sh
sudo ufw allow 80,443,22,8096,8097,8384,3040,51820,51821,21027,32400,2222,8888,4444,22000/tcp
sudo ufw allow 80,443,22,8096,8097,8384,3040,51820,51821,21027,32400,2222,8888,4444,22000/udp
```
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. ```
## Fstab
using the `blkid` command to mount an external drive in fstab to use for restic backups
## Authors and acknowledgment ```sh
Show your appreciation to those who have contributed to the project. # /etc/fstab: static file system information.
## License UUID=6fb3bc60-e984-43ce-a688-151b49f558e0 /home/null/shares/disk2 auto defaults,nofail,x-systemd.automount 0 2
For open source projects, say how it is licensed. ```
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
# Gitlab
After adding the domain name to the docker-compose.yml and the gitlab configuration:
``` yaml
hostname: 'gitlab.knast.cc'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.knast.cc'
```
We also need to please the dark lords of reverse proxying by adding the following lines to the gitlab.rb configuration:
```bash
nginx['listen_port'] = 80
nginx['listen_https'] = false
```
## Nextcloud
edit the nextcloud config.php to use the https protocol
```sh
nano /srv/nextcloud/config/config.php
```
```sh
We also use traefik and docker. I have added the following traefik label in our docker-compose.yml:
```yml
- "traefik.http.middlewares.nc-header.headers.customRequestHeaders.X-Forwarded-Proto=https"
```
And in the config.php, Ive also added some values regarding reverse proxies:
'forwarded_for_headers' =>
array (
1 => 'HTTP_X_FORWARDED',
2 => 'HTTP_FORWARDED_FOR',
3 => 'HTTP_FORWARDED',
0 => 'HTTP_X_FORWARDED_FOR',
),
'trusted_proxies' =>
array (
0 => '10.0.0.0/8',
),
```
#### Connecting a container directly to an NFS mount
```yml
version: "3"
services:
web-server:
image: nginx:latest
ports:
- 80:80
volumes:
- type: volume
source: nfs-volume
target: /nfs
volume:
nocopy: true
volumes:
nfs-volume:
driver_opts:
type: "nfs"
o: "addr=192.168.1.110,nolock,soft,rw"
device: ":/var/data"
```
NOTE: Just switch to syncthing
```sh
#SYNC MOVIES FROM UNITY TO DISK 2
# CRON JOB
* * * * * /usr/bin/flock -n /tmp/classics.lockfile /home/$USER/home_server/scripts/sync_classics.sh
* * * * * /usr/bin/flock -n /tmp/flims.lockfile /home/$USER/home_server/scripts/sync_flims.sh
* * * * * /usr/bin/flock -n /tmp/tv.lockfile /home/$USER/home_server/scripts/sync_tv.sh
# movie_sync.sh CONTENT
```
```sh
#!/bin/bash
echo "STARTING TV FILE SYNC RAN AT: " `date '+%Y-%m-%d %H:%M:%S'` >> /home/null/logs/film_cron.log
/usr/bin/rsync -ravz --bwlimit=5000 --stats --progress --exclude='/home/null/shares/disk2/media/movies/_movies' -e "ssh -i /home/null/.ssh/id_rsa_sync " 'invalid@unity.whatbox.ca:/home/invalid/files/_movies' '/home/null/shares/disk2/media/movies/_movies' >> /home/null/logs/film_cron.log
echo "CRON TV FILE SYNC RAN AT: " `date '+%Y-%m-%d %H:%M:%S'` >> /home/null/logs/film_cron.log
```
```sh
#SYNC TV FROM UNITY TO DISK 2
# CRON JOB
* * * * * /usr/bin/flock -n /tmp/fcj.lockfile /home/null/scrpts/tv_sync.sh
```
```sh
@reboot /usr/sbin/ddclient -daemon=0 -noquiet -debug -query > /home/knast/logs/dynamic_dns.log
#@reboot /usr/bin/mount -t nfs 192.168.1.110:/media /home/knast/shares/disk1
0 */2 * * * /usr/sbin/ddclient -daemon=0 -noquiet -debug -query > /home/knast/logs/dynamic_dns.log
*/5 * * * * /usr/bin/chmod -v 0777 -R /home/knast/shares/disk1/film/* > /home/knast/logs/film_chmod.log
*/15 * * * * /usr/bin/chmod -v 0777 -R /home/knast/shares/disk1/classics/* > /home/knast/logs/classic_chmod.log
*/25 * * * * /usr/bin/chmod -v 0777 -R /home/knast/shares/disk1/tv/* > /home/knast/logs/tv_chmod.log
```sh
# tv_sync.sh CONTENT
#!/bin/bash
echo "STARTING TV FILE SYNC RAN AT: " `date '+%Y-%m-%d %H:%M:%S'` >> /home/null/logs/tv_cron.log
/usr/bin/rsync -ravz --bwlimit=5000 --stats --progress --exclude='/home/null/shares/disk2/media/tv' -e "ssh -i /home/null/.ssh/id_rsa_sync " 'invalid@unity.whatbox.ca:/home/invalid/files/_tv' '/home/null/shares/disk2/media/tv' >> /home/null/logs/tv_cron.log
echo "CRON TV FILE SYNC RAN AT: " `date '+%Y-%m-%d %H:%M:%S'` >> /home/null/logs/tv_cron.log
```
### Dynamic IP for namecheap domains
in config file `/etc/ddclient.conf`
```conf
use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=knast.cc
password=<NAMECHEAP_GENERATED_TOKEN>
@
```
and in the root crontab:
```sh
@reboot /usr/sbin/ddclient -daemon=0 -noquiet -debug > /home/null/dynamic_dns.log
0 */2 * * * /usr/sbin/ddclient -daemon=0 -noquiet -debug > /home/null/dynamic_dns.log
```