Skip to content

Tutorials

DevilsCoder edited this page Dec 19, 2023 · 17 revisions

Windows

Setting up NSSM to Auto-start Caddy

1.Please add Caddy and NSSM to your enviroment variables shown here

  1. Open an administrative powershell

image

  1. Type commmand below to register a service

nssm install Caddy

  1. Now it will show NSSM GUI

image

  1. Configure like below

image

Path= Your Caddy.exe (IE C:\Tools\Caddy\caddy.exe)

Startup Directory= Your Root Caddy folder (IE C:/Tools/Caddy)

Arguments= this will be the command your run to start caddy in the background

(IE run --config Caddyfile)

When done it should look like this

image

  1. Now Select Install Service

  2. Start the service in the administrative powershell by running

nssm start caddy (so if you name it something else in the nssm install myappname it will be nssm install sonarr to setup in nssm gui and nssm start sonarr to auto start the service)

  1. You can check to see if its running succesful by typing

nssm status Caddy

  1. To restart it

nssm restart Caddy

  1. To stop the service

nssm stop Caddy

Setting up a SMB/Samba Share on Windows

NOTE YOU WILL NEED A LOCAL WINDOWS USER THIS WILL NOT WORK WITH A EMAIL LOGIN TO WINDOWS HERES A TUTORIAL IF YOU WANT

How to Change Windows Email to Local User

  1. Go to this PC and right click the drive you want and select Properties

image

  1. Go to the sharing tab and click share

image

  1. Then click on advanced sharing

image

  1. Name the Share whatever you would like it to be

image

  1. Click on permission and add a couple of users to this share

  2. Add Network Service, Local Service, Guests

image

  1. To do this click Add and select the advanced on the bottom

image

  1. Click Find Now

image

  1. Select the 3 accounts from step 6 and add them to your permissions

image

  1. Then Click Ok

image

  1. Then Click Allow all on the 3 added account permissions

image

  1. Test to see if it works grab another windows PC or on your phone through a Samba client and type your internal ip of your samba share pc

my internal ip of my pc is 192.168.1.111 so i type into my folder search bar \\192.168.1.111 if you see your share your all set.

image

Nextcloud Setting up SMB/Samba Share

  1. Login in as Adminstrator
  2. Click on Apps

image

  1. Enable External Storage and SMB Connection Test

image

image

  1. Go into your docker-desktop and click on your nextcloud container and select the three dots where your nextcloud instance is shown and select terminal

image

  1. Run the Following commands in terminal

apt update

apt upgrade

apt install nano

apt install smbclient

apt install smbclient libsmbclient-dev

image

  1. Click on Administrative Settings

  2. Under Adminstration select smb test

  3. Type like below

Hostname: 192.168.1.111 (THIS WILL BE YOUR INTERNAL PC's IP) User: DemonWarrior (THIS WILL BE YOUR WINDOWS LOCAL USER) Workgroup: Workgroup Password: @@@@@@@ (THIS WILL BE YOUR WINDOWS LOCAL USER PASSWORD) Share: Jellyfin-Media (THIS WILL BE WHAT YOU NAMED YOUR SAMBA SHARE IN STEP 4 OF CREATING YOUR SAMBA SHARE)

image

  1. Once you have succesfully loaded your Samba Test go to Adminstration ---> External Storage

Copy the settings from your Samba test to your external storage it should read.

image

Wordpress Install on Windows

How to Install Wordpress + Caddy Natively on Windows

Downloads

NSSM

Wordpress

PHP 7.4

MAKE SURE YOU DOWNLOAD THE RC (RELIABLE CHANNEL) MSI RUN THE GUI MSI Installer MariaDB

Setting Up PHP 7.X

  1. Create a Directory in your C:\ for Tools IE. C:\Tools
  2. Create two subdirectories in Tools 2.1 NSSM 2.2 php
  3. Extract php-7.xx insides to another directory
  4. Extract NSSM.exe from \nssm-2.24\win64 to C:\Tools\NSSM

ie. C:\Tools\php

Add it to the enviroment variable paths

  1. Search Advanced System Settings

image

  1. Select Enviroment Variables

image

  1. Select System Variables Path by double clicking

image

  1. Add a New Path and type C:\Tools\php
  2. Add another new path this time for NSSM C:\Tools\NSSM
  3. Select OK
  4. Select OK again
  5. Then Select OK to cloe the systemp properties box
  6. Close all Powershells and Terminal Windows So these settings Save

Uncomment These Settings IE. Removing # from before each line You can Search in Your Text Editor by Clicking CTRL+ F

*PHP.ini Settings*

    Navigate to the “increase memory_limit” line in the file and change the value from 128M to 512MB.
    The next step is to uncomment the following lines by removing ‘;’ before the lines. For example the “;extionsion_dir=ext” should become “extionsion_dir = ext”.
    Similarly uncomment the following lines by removing ‘;’ from the beginning of the line.

extension=bz2
extension=curl
extension=ffi
extension=fileinfo
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=mbstring
extension=exif
extension=mysqli
extension=odbc
extension=openssl
extension=pdo_mysql
extension=pdo_odbc
extension=pdo_sqlite

Setting up PHP-CGI

  1. Open up an Administrative Powershell.

  2. type inside that powershell NSSM install PHP

  3. Add to Path

    3.1 C:\Tools\php\php-cgi.exe

    Add to Startup Dirctory

    3.2 C:\Tools\php

    Add to Argument

    3.3 -b 127.0.0.1:9000

  4. Click Save

  5. Start the Service nssm Start php

MariaDB Setup

RUN THE GUI MSI Installer

1.TUTORIAL (FOLLOW STEPS 1-4)

MariaDB Install Guide

  1. TYPE MARIADB INSIDE YOUR SEARCH BAR

image

  1. TYPE THE PASSWORD YOU CREATED in your installation 4.THEN Edit To Your liking
CREATE DATABASE wordpress;
use wordpress;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass12345678?';
GRANT ALL ON *.* TO 'user'@'localhost';
flush privileges;
  1. If you cant remember your password for your MYSQL User Use this command*

DROP USER 'devilsdesigns'@'localhost';

Then re-enter this below

use wordpress;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass12345678?';
GRANT ALL ON *.* TO 'user'@'localhost';
flush privileges;

Setting up Caddy

Caddyfile Download

Wordpress Caddyfile

Running Caddy inside the Caddy.exe Directory

  1. cd C:\Caddy\Directory ie. cd C:\Tools\Caddy

  2. Running Caddy Manually

  3. ./caddy run --config Caddy

  4. Accept both permissions if a windows Pops up

WP Reverse Proxy with a Dynamic IP with CloudFlareDDNS

Downloads

CloudFlare DDNS

Setting up A Name Record

  1. Download Cloudflare DDNS from github and extract it to a directory of your choice ie. C:\Tools\CloudflareDDNS

  2. Open https://dash.cloudflare.com/ and select your domain

  3. Click DNS on the side bar

image

  1. Click add a Record

image

  1. Go to https://ipchicken.com/ and copy your external ip into the A NAME ie.

image

  1. Click Save

Getting an API Key

  1. Go to Overview in the right Hand Menu

image

  1. Scroll Down till you see get API Token and click it

image

  1. Click Create a Token

image

  1. Scroll down and select Custom Token

image

  1. Name the Token, Give it Zone, Zone, Read and then click add more and add Zone, DNS, Edit Like so

image

  1. Then Click Create Token

  2. Create Copy your token somewhere safe

image

Running Cloudflare DDNS

  1. type in powershell cd C:\Tools\CloudflareDDNS

  2. Run this command after you edit the code to match yours

./cloudflare-ddns --token your-cloudflare-api-key --domain home.yourdomain.com

ie. ./cloudflare-ddns --token apkGKJHDkansjhcbsdjhc --domain home.demonwarriortech.com

  1. it should get a log like this
time="2023-01-28T17:54:39-06:00" level=info msg="updated record" content=123.123.123.123 name=home.ittechnut.com
PS C:\tools\cloudflareddns>

Autostartup CloudflareDDNS

  1. Search Run in Windows

image

  1. Type shell:startup and enter it will open a folder with your startup apps. These are all the apps that start when windows Starts

  2. Right Click anywhere in empty space in your folder and click new ---> Text Documents and name it CloudFlareDDNS.bat (Make sure You do Not save it as a .txt)

image

  1. Now open the text document and paste
C:\Tools\CloudFlareDDNS\cloudflare-ddns --token your-cloudflare-api-token--domain home.yourdomain.com
pause

ie.

C:\Tools\CloudFlareDDNS\cloudflare-ddns --token apkGKJHDkansjhcbsdjhc --domain home.demonwarriortech.com
pause
  1. Click Save or CTRL+S

  2. Run it and it should now be autorunning your background

Troubelshooting
  1. If your having issues writing a cert try clearing your caddy certificates

  2. Go to C:\Users\YOUR-USERNAME\AppData\Roaming\Caddy remove all files inside the Caddy directory and retry

Troubleshooting

IF ITS NOT LOADING

Allow App Through Advanced Firwall

  1. Go to Control Panel
  2. Search Firewall and Select Windows Defender Firewall

image

  1. Select Advanced Settings

image

  1. Click Inbouns Rules

image

  1. Click New Rule

image

  1. Check Port

image

  1. Add TCP Ports 9000 (IF YOU HAVENT ADDED CADDY PORT YET DO SO AS WELL FOR 443, 80, 2019)

image

  1. Leave Default Click Next

image

  1. Leave Default Click Next

image

  1. Name the rule whatever you want

image

Checking Your Ports
  1. Go to https://portchecker.co/ and see if your port 443 and 80 are open.
  2. If they are not you need to make sure your router connected to your modem has those ports portforwarded for your computer hosting caddy.

Check out Our Discord if you need more help! https://discord.gg/DtHUvGrp

Installing Docker-Desktop in Windows

Enabled Windows Featured

Requirements

  • Check to See if Virtualization is enabled in your bios
  1. Open Task Manager and See if Virtualization is running

image

  1. If it is on continue to step 3. If it is not you need to enable it in bios.

    2.1 Heres a good Tutorial for all Motherboard Manufacturers.

BIOS Intel Tutorial

BIOS AMD Tutorial

  1. Turn Windows Features On

image

  1. Turn on

    4.1 Hyper-V 4.2 Virtual Machine Platform 4.3 Windows Hypervisor Platform 4.4 Windows Subsystem Linux

image

image

  1. Reboot Your PC

Setting Up WSL2

  1. Once Rebooted You can install your VM.
  2. Go to MS Store and Search Ubuntu and select an install you want I WOULD RECOMMEND THE LATEST UBUNTU CURRENTLY ITS 22.04

image

  1. Once installed open the Ubuntu 22.04 from the MS Store

  2. Setting it up make a name (IT HAS TO BE ALL LOWER CASE)

image

  1. Set a Password

image

  1. Now Check What WSL Version in powershell your using

wsl --list --verbose

YOU NEED TO BE WSL2

  1. Install WSL2 Update by running the Installer

WSL2 Update Kernel

  1. Now Set the Default Kernel to WSL2 in powershell

wsl --set-default-version 2

  1. Once that is done if it still has not updated to 2 run this command

wsl --update

TroubleShooting Installing WSL2
  1. If your on Windows 10 and cannot enable or install WSL2 Use this installer

WSL2 Manual Install

  1. If running the wsl --set-default-version 2 then try to apply it directly to your linux. So if my install running the wsl --list --verbose it says the name add that in the code ie. Ubunut-22.04

wsl --set-version Ubuntu-22.04 2

Installing and Setting up Docker-Desktop

  1. Download Docker-Desktop
  2. Click through the Installer
  3. Once installed Run the Docker-Desktop (NOT IT MAY TAKE SOME TIME TO FIRST START DEPENDING ON YOUR HARDWARE)

Extra Docker Setups Configs

Limiting Dockers RAM Usage
  1. Navigate to C:\Users\DESKTOP-USERNAME
  2. Edit .wslconfig in any text editor

add these line to it. This will limit it to 4GB you can set any number from 2GB-64GB

[wsl2]
memory=4GB
  1. Restart Docker and it should update to the correct limit.

image

Docker-Desktop Troubleshooting

Docker-Desktop Not Starting
  1. If docker-desktop doesnt start after 10 Minutes ie. Showing the green background with the whale. Do these steps to fix it.

image

  1. You need to Fully remove Docker-Desktop RESTART COMPUTER
  2. Then re-install Docker Desktop
Docker-Desktop Not Saving Containers

If you are having issues with when you reboot and it not saving your containers or completely corrupting All you need to do is

  1. You need to Fully remove Docker-Desktop RESTART COMPUTER
  2. Then re-install Docker Desktop

This should fix the issue.

Installing Nextcloud on Windows with Memories and Hardware Acceleration Transcoding

Installing Nextcloud

  1. Make a directory inside C:\Tools called Nextcloud
  2. You need to make 3 files inside your Nextcloud Directory. You can get the code that needs to go in these files from here. https://github.com/DevilsDesigns/Youtube-Docs/wiki/Docker-Compose-Examples#nextcloud
    • docker-compose.yml
    • supervisord.conf
    • nextcloud.ini
    • Dockerfile it will look like this when done

image

  1. We need to run our initial setup of nextcloud to do this we need to edit our docker-compose as seen in the video on youtube
  2. Once we have edited this we have to wait for initial configurations and once it says loaded we can connect to localhost:9111
  3. Set your Administrative Username for the Admin Account. Set your password for the admin account.
  4. set your data directory to wherever you want your images/videos to be placed.
  5. Set your mysql and database user and database password.
  6. Set your DB from localhost to db:3306
  7. Once all the categories are filled out click install. (NOTE): Installation may take upwards of 15-20 minutes.
  8. Once installed we need to go to Apps and install Memories

Enabled Go-Vod

  1. Now that Memories is installed we need to activate the go-vod in the compose for our nvidia GPU
  2. It Should look like below once we uncomment the go-vod section
version: '2'

services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - C:\Tools\Nextcloud\db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=SQLROOTPASSWORD
      - MYSQL_PASSWORD=MYSQLPASSOWRD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
  app:
    image: nextcloud:latest
    restart: always
    ports:
      - 9111:80
    links:
      - db
    volumes:
      - J:/Nextcloud:/data
      - J:/Nextcloud:/var/www/html
    environment:
      - MYSQL_DPASSWORD=MYSQLPASSWORD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
  #ONLY REMOVE THE # FOR HWA IF YOU HAVE A GPU AND WANT TO USE MEMORIES APP INSIDE NEXTCLOUD
  go-vod:
    image: radialapps/go-vod
    restart: always
    depends_on:
      - app
#    devices:
#      - /dev/dri:/dev/dri # VA-API (omit for NVENC)
    environment:
      - NEXTCLOUD_HOST=https://NEXTCLOUD.DOMAIN.COM
      - NEXTCLOUD_ALLOW_INSECURE=1 # (self-signed certs or no HTTPS)
    volumes:
      #this is where you want your files stored on nextcloud
      - J:/Nextcloud:/data
      #this is where your configs and all nextcloud system files are stored
      - J:/Nextcloud:/var/www/html      
      #only enable if you have a nvidia 1xxx or later and want to use it to transcode
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1
            capabilities: [gpu]
  1. Now we can run docker compose up -d --force-recreate --remove-orphans to recreate the container and remove old resources
  2. We need to go into Adminstrative Settings ---> Memories ---> Binary Path and add in the connection address this go-vod:47788 like so

image

  1. Now we can see if the hwa is working. So we need to go to Admin Settings on nextcloud ---> memories --> make the transcoding section look like below

image

image

  1. Now that thats done. We need to test so input a video inside nextcloud photos or any directory and try to play it. You should see two options when you select the gear icon

image if you see this it is working correctly. Congrats!

You can also check docker desktop go-vod container and see if the logs say something alike to this

2023-12-19 00:12:38 2023/12/19 06:12:38 33w0pebs2le0-480p: /usr/local/bin/ffmpeg -loglevel warning -hwaccel cuda -i /var/www/html/data/__groupfolders/2/20231216_160438.mp4 -copyts -fflags +genpts -vf "format=nv12|cuda,hwupload,scale_cuda=force_original_aspect_ratio=decrease:passthrough=0:w=854:h=854" -map "0:v:0" "-c:v" h264_nvenc -preset p6 -tune ll -rc vbr -rc-lookahead 30 -cq 42 -temporal-aq 1 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 0 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/33w0pebs2le0-1296945068/480p-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2023-12-19 00:12:40 2023/12/19 06:12:40 33w0pebs2le0-480p: recv 480p-000000.ts
2023-12-19 00:12:41 2023/12/19 06:12:41 33w0pebs2le0-480p: recv 480p-000001.ts
2023-12-19 00:12:42 2023/12/19 06:12:42 33w0pebs2le0-480p: recv 480p-000002.ts
2023-12-19 00:12:43 2023/12/19 06:12:43 ffmpeg-error: More than 1000 frames duplicated
2023-12-19 00:12:44 2023/12/19 06:12:44 33w0pebs2le0-480p: recv 480p-000003.ts
2023-12-19 00:12:45 2023/12/19 06:12:45 33w0pebs2le0-480p: recv 480p-000004.ts
2023-12-19 00:12:45 2023/12/19 06:12:45 33w0pebs2le0-480p: goal satisfied: 4
2023-12-19 00:12:46 2023/12/19 06:12:46 33w0pebs2le0-480p: resuming transcoding
2023-12-19 00:12:48 2023/12/19 06:12:48 33w0pebs2le0-480p: recv 480p-000005.ts
2023-12-19 00:12:49 2023/12/19 06:12:49 33w0pebs2le0-480p: recv 480p-000006.ts
2023-12-19 00:12:50 2023/12/19 06:12:50 33w0pebs2le0-480p: recv 480p-000007.ts
2023-12-19 00:12:51 2023/12/19 06:12:51 33w0pebs2le0-480p: recv 480p-000008.ts
2023-12-19 00:12:51 2023/12/19 06:12:51 33w0pebs2le0-480p: goal satisfied: 8

Building the Custom Dockerfile for FFMPEG & Facial Recognition

** We will now build our custom repo for with ffmpeg previews and facial recognition**

  1. Open Terminal/Powershell and run inside C:\Tools\Nextcloud
docker build . -t nextcloud-apache-ffmpeg
  1. It should start building the custom repo
  2. Once done we need to edit our docker-compose.yml to use that repo so edit it like so.
version: '2'

services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - C:\Tools\Nextcloud\db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=SQLROOTPASSWORD
      - MYSQL_PASSWORD=MYSQLPASSOWRD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
  app:
    image: nextcloud-apache-ffmpeg
    restart: always
    ports:
      - 9111:80
    links:
      - db
    volumes:
      - J:/Nextcloud:/data
      - J:/Nextcloud:/var/www/html
    environment:
      - MYSQL_DPASSWORD=MYSQLPASSWORD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
  #ONLY REMOVE THE # FOR HWA IF YOU HAVE A GPU AND WANT TO USE MEMORIES APP INSIDE NEXTCLOUD
  go-vod:
    image: radialapps/go-vod
    restart: always
    depends_on:
      - app
#    devices:
#      - /dev/dri:/dev/dri # VA-API (omit for NVENC)
    environment:
      - NEXTCLOUD_HOST=https://NEXTCLOUD.DOMAIN.COM
      - NEXTCLOUD_ALLOW_INSECURE=1 # (self-signed certs or no HTTPS)
    volumes:
      #this is where you want your files stored on nextcloud
      - J:/Nextcloud:/data
      #this is where your configs and all nextcloud system files are stored
      - J:/Nextcloud:/var/www/html      
      #only enable if you have a nvidia 1xxx or later and want to use it to transcode
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1
            capabilities: [gpu]```

We are only changing this line for others who changed mysql password and other things From

  app:
    image: nextcloud:latest

to

  app:
    image: nextcloud-apache-ffmpeg
  1. Once this is done we can rebuild and docker-compose again by typing docker compose up -d --force-recreate --remove-orphans
  2. This time we should now have ffmpeg and facial recognition now ready.
  3. So go into the Admin Settings and go to Memories then this

image

  1. to find ffmpeg location go to docker find your nextcloud app and click on the 3 dots next to our app and select terminal like so

image

  1. type 2 commands to give us our ffmpeg and ffprobe binary's

whereis ffmpeg

whereis ffprobe

  1. Copy the path into those empty ffmpeg paths box and ffprobe path box.
  2. Once you click out of the box it should update.

Installing Facial Recognition

  1. Now we need 2 more apps from the app store. So we go to Adminstrative Panel --> Apps ---> Recognize Adminstrative Panel ---> Apps ---> Preview Generator
  2. Once this is done we need to enable recognize inside the Adminstrative Settings ---> Recognize and enable the slider

image

Tailscale Commands for Exit Node

Taiscale firewall and opening exit node commands

Reference: https://tailscale.com/kb/1019/subnets/?tab=linux

EXIT Node/Subnet Enable Command

sudo tailscale up --advertise-routes=192.168.1.0/24 --accept-routes --advertise-exit-node

Allowing ipv4 through exit node

echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
sudo sysctl -p /etc/sysctl.d/99-tailscale.conf

Extra Advice

I would Recommend You Install Windows Terminal its a good way to have all your VM's, Powershell, and CMD's all in one place

image

Windows Terminal Install