balrog

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

balrog's Achievements

Noob

Noob (1/14)

2

Reputation

  1. This is one of them. Here is an example of a full script (mount and unmount): Mount (0_Mount-vDisks.sh) #!/bin/bash #name=0_Mount-vDisks #backgroundOnly=true # Plex mount -t auto -o loop /mnt/disks/VM/vdisks/PlexMediaServer.img /mnt/disks/VM/appdata/PlexMediaServer/ # VOD mount -t auto -o loop /mnt/disks/VM/vdisks/vod.img /mnt/disks/VM/appdata/vod/ # Media mount -t auto -o loop /mnt/disks/VM/vdisks/media.img /mnt/disks/VM/appdata/media/ Unmount (0_Unmount-vDisks.sh) #!/bin/bash #name=0_Unmount-vDisks #backgroundOnly=true # Plex umount -l /mnt/disks/VM/appdata/PlexMediaServer/ # VOD umount -l /mnt/disks/VM/appdata/vod/ # Media umount -l /mnt/disks/VM/appdata/media/
  2. I just want to show some examples of how I configured my caddyfile as a reverse proxy. Maybe it is helpful for someone. Basics Activate HTTP/3 (put this on the top of your Caddyfile) Source { servers * { protocol { experimental_http3 } } } Simple Reverse Proxy Source sub.domain.com { reverse_proxy 10.0.0.254:8080 } Reverse Proxy with HTTPS backend and no trusted certificate Source sub.domain.com { reverse_proxy 10.0.0.254:443 { transport http { tls_insecure_skip_verify } } } Reverse Proxy with IP-Whitelist (allowed Networks: 10.0.0.0/24 and 10.1.1.0/24) Source sub.domain.com { @internal { remote_ip 10.0.0.0/24 10.1.1.0/24 } handle @internal { reverse_proxy 10.0.0.254:8080 } respond 403 } Streaming (Plex, Jellyfin, ...) Source ... reverse_proxy 10.0.0.254:32400 { flush_interval -1 } ... Cloudflare This is only needed if you have the Cloudflare-Proxy activated (orange cloud) Requirements Caddy-Binary with dns.providers.cloudflare-Plugin (Caddy-Builder): LINK Create an API-Token on Cloudflare: LINK Cloudflare API Source sub.domain.com { tls { issuer acme { dns cloudflare <api-token> or {env.CLOUDFLARE_API_TOKEN} resolvers 1.1.1.1 } } } Cloudflare API + reverse proxy sub.domain.com { tls { issuer acme { dns cloudflare <api-token> or {env.CLOUDFLARE_API_TOKEN} resolvers 1.1.1.1 } } reverse_proxy 10.0.0.254:80 } Cloudflare API + reverse proxy + streaming sub.domain.com { tls { issuer acme { dns cloudflare <api-token> or {env.CLOUDFLARE_API_TOKEN} resolvers 1.1.1.1 } } reverse_proxy 10.0.0.254:32400 { flush_interval -1 } } Header Security Create in the Caddyfile-Directory (/etc/caddy/) a file called "caddy_security.conf" with the following content: header { Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" X-Xss-Protection "1; mode=block" X-Content-Type-Options "nosniff" Content-Security-Policy "frame-ancestors *.opum.ch" Referrer-Policy "strict-origin-when-cross-origin" Cache-Control "public, max-age=15, must-revalidate" Permissions-Policy "accelerometer=(), ambient-light-sensor=(), autoplay=(self), camera=(), encrypted-media=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(*), speaker=(), sync-xhr=(), usb=(), vr=()" } Now import this config into the Caddyfile: sub.domain.com { import /etc/caddy/caddy_security.conf reverse_proxy 10.0.0.254:8080 } With this settings you'll get an A+ on https://securityheaders.com/
  3. I recently had the problem that I wanted to move all my Docker data (in the appdata folder) over the network to an external NAS. But since Plex and Jellyfin consists of a lot of small files depending on the size of the media library, copying took me two days despite 10 Gbit/s. I would like to show you here how I solved the problem by moving these files to a vDisk and thus the transfer is now much faster. Structure Create thin provisioned vDisk Adjust vDisk-Size Remove vDisk Show size Auto-Mount/-Unmount Backup vDisk Create thin provisioned vDisk 1. Create vDisk (.img) truncate -s 100G /path/vDisk.img (This creates a .img-File with the maximum size of 100 GiB) 2. Create file system mkfs.xfs /path/vDisk.img (possible options can be displayed by typing "mkfs" in the console and pressing Tab twice) 3. Create Mountpoint mkdir /mountpoint/ (in my case the mountpoint is /mnt/disks/vm/appdata/plex) 4. Mount vDisk mount -t auto -o loop /path/vDisk.img /mountpoint/ 5. Adjust permissions chown nobody:users /mountpoint/ (or wathever group or user you use) 6. Move files Now, you can move/copy your files to this mountpoint (vDisk) mv /plex_directory/* /mountpoint/ (keep in mind to change the permissions after moving the files) Adjust vDisk-Size 1. unmount vDisk umount /mountpoint/ (with the option -l you can force the unmount) 2. adjust vDisk size truncate -s 200G /path/vDisk.img (200G is the new size) e2fsck -f /path/vDisk.img && resizefs /path/vDisk.img (allocate the new size to the filesystem) Remove vDisk 1. unmount vDisk umount /mountpoint/ 2. delete vDisk rm /path/vDisk.img Show size Maximum size vDisk du -h --apparent-size /path/vDisk.img Effective disk space used du -h /path/vDisk.img Auto-Mount/-Unmount You can insert this commands into a Userscript for mounting with the start of the Array or unmount with stop of the Array (I use this config for my daily use. I haven't notice any serious performance drawbacks. Just make sure the vDisk is mountet before you start the Docker-Container!) Backup vDisk To backup a vDisk we just copy the .img fith the following command: dd if=srcFile.img of=dstFile.img iflag=direct oflag=direct bs=64K conv=sparse