Compare commits

...

54 Commits

Author SHA1 Message Date
d46b53dcfe add start of knowledgebase 2023-06-29 23:48:51 +01:00
fc988dd4f8 move systemd service to ubuntu 2023-06-28 21:56:12 +01:00
bde1113de4 update cronjob info 2023-06-28 21:49:05 +01:00
cbe8a0a9e4 add missing tags 2023-06-28 21:22:49 +01:00
972206371e update nodejs page description 2023-06-28 20:55:49 +01:00
fd36bb3dbd update rest api guide 2023-06-28 20:53:08 +01:00
4070f91484 running nodejs in docker guide 2023-06-28 20:51:45 +01:00
9b23c65ee1 add simple rest api example 2023-06-28 20:43:59 +01:00
63c656a977 update home 2023-06-28 20:37:38 +01:00
ef768d8ef2 move some guides into what OS they were made for 2023-06-28 20:36:21 +01:00
017c4eb74d add text 2023-06-28 18:20:18 +01:00
1ff612124e show the version for the guides 2023-06-28 18:18:04 +01:00
57dc0a9941 fix the pages not working 2023-06-28 18:16:49 +01:00
ad145084ea add more tags 2023-06-28 18:16:01 +01:00
b43592cc2a move guides into a specific ubuntu version 2023-06-28 18:15:24 +01:00
eeb25f56fa add ubuntu to home page 2023-06-28 18:02:53 +01:00
21b2f20c38 update site description 2023-06-28 17:56:33 +01:00
678c5722e5 update order of steps 2023-06-28 12:45:47 +01:00
c7737f0441 no longer using the deprecated command 2023-06-28 12:42:44 +01:00
9719b96342 make it make more sense 2023-06-28 12:39:06 +01:00
d71eb26037 add more info to adding user 2023-06-28 12:38:08 +01:00
f5bce8ae80 add user and db creation section 2023-06-28 12:35:54 +01:00
192e252c48 update mongodb install securing section 2023-06-28 12:31:06 +01:00
9b5d3ebbb7 capitalize mongo in the install guide 2023-06-28 12:28:08 +01:00
67e0af133b add mongodb 2023-06-28 12:26:25 +01:00
5842f98517 fix my silly spelling 2023-06-27 15:34:43 +01:00
0cb75b2781 add unraid to home 2023-06-27 15:22:43 +01:00
6b5de3bd45 add extra on unraid recycle bin guide 2023-06-27 15:09:38 +01:00
c13519b192 add recycle bin to unraid home 2023-06-27 15:03:05 +01:00
ab5a6315e8 add recycle bin to unraid 2023-06-27 15:02:45 +01:00
228e583dc7 update script on unraid backup 2023-06-27 14:45:38 +01:00
d2751933db fix small issue in the script 2023-06-27 14:35:47 +01:00
d21928826e add first unraid tutorial - application backups 2023-06-27 14:34:27 +01:00
dd12110298 change action runner image 2023-06-27 12:12:45 +01:00
9e2c1798af start work on actions 2023-06-27 12:10:05 +01:00
0d3918ac45 first ubuntu guide - how to expand a lvm 2023-06-27 11:42:56 +01:00
032db63c26 add nodejs to home 2023-06-27 11:25:59 +01:00
45e0552302 change sort to be like the side bar 2023-06-27 11:24:09 +01:00
91b9fffaa1 add clickable links to the main home page 2023-06-27 11:22:50 +01:00
e1b83182ed add linux basics to its home page 2023-06-27 11:19:52 +01:00
6dee2d1b38 move cronjob and linux basics 2023-06-27 11:18:26 +01:00
229d5423d8 fix tags on nodejs home 2023-06-27 11:11:49 +01:00
f19e359095 change how guides are layed out 2023-06-27 11:07:53 +01:00
f24a032b52 update cronjob example 2023-06-27 09:36:10 +01:00
87b6a55781 add what system cronjobs was tested on 2023-06-27 09:33:54 +01:00
b161a8e649 add cronjobs to examples 2023-06-27 09:32:19 +01:00
Lee
3aae34f344 docs: create examples/cronjob 2023-06-27 08:28:15 +00:00
8205d28d7a add systemd to linux basics 2023-06-27 09:10:56 +01:00
6dc03e437f update order on linux basics 2023-06-27 09:08:47 +01:00
b333976596 add nano to linux basics 2023-06-27 09:07:18 +01:00
f859c5d8e5 add networking and ufw to linux basics 2023-06-27 09:05:58 +01:00
18c94ad885 add linux basics 2023-06-27 09:00:08 +01:00
Lee
5874a51b36 docs: create guides/linux-basics 2023-06-27 07:54:20 +00:00
a439c5bf26 add non root user info to systemd service exaample 2023-06-27 08:48:02 +01:00
19 changed files with 928 additions and 8 deletions

@ -0,0 +1,23 @@
name: Close inactive issues
on:
schedule:
# Runs at 1am every day
- cron: "0 1 * * *"
jobs:
close-issues:
runs-on: ubuntu-20.04
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "Status/Abandoned"
stale-issue-message: "This issue is abandoned because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as abandoned."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITEA_TOKEN }}

13
guides/docker/home.md Normal file

@ -0,0 +1,13 @@
---
title: Docker Home
description: Docker guides
published: true
date: 2023-06-27T11:06:30.081Z
tags: docker
editor: markdown
dateCreated: 2023-06-27T11:06:59.640Z
---
# Pages
N/A

14
guides/linux/home.md Normal file

@ -0,0 +1,14 @@
---
title: Linux Home
description: Linux guides
published: true
date: 2023-06-27T11:15:30.081Z
tags: linux
editor: markdown
dateCreated: 2023-06-27T11:15:59.640Z
---
# Pages
- [Basics](/guides/linux/pages/basics)
- [How to use Cronjobs](/guides/linux/pages/cronjob)

@ -0,0 +1,93 @@
---
title: The basics of Linux
description: Simple examples showing you around Linux
published: true
date: 2023-06-27T07:54:18.672Z
tags: linux, server
editor: markdown
dateCreated: 2023-06-27T07:54:18.672Z
---
# Linux Basics
This guide provides a brief introduction to Linux, including basic commands and concepts.
## Navigating the filesystem
- Change a directory: `cd <directory>`
- List files in a directory: `ls`
- List files in a directory (including hidden files): `ls -a`
- Getting the current directory: `pwd`
- Going back a directory: `cd ..`
## Managing Files and Directories
- Create a new directory: `mkdir <directory>`
- Create a new file: `touch <file>`
- Copy a file: `cp <file> <new-file>`
- Remove a file: `rm <file>`
- Remove a directory: `rm -r <directory>`
## File Permissions
- Change file permissions: `chmod <permissions> <file>`
- Change file ownership: `chown <user> <file>`
- Change file ownership (recursively): `chown -R <user> <directory>`
- View file permissions: `ls -l <file>`
## Text Processing
There are alternatives to nano, but it is the easiest to use.
- Edit a file: `nano <file>`
- View a file: `cat <file>`
- View a file (with line numbers): `cat -n <file>`
- Get the beginning of a file: `head <file>`
- Get the end of a file: `tail <file>`
## File Compression and Archiving
- Create a tar archive: `tar -cvf <archive.tar> <file>`
- Extract a tar archive: `tar -xvf <archive.tar>`
- Create a zip archive: `zip <archive.zip> <file>`
- Extract a zip archive: `unzip <archive.zip>`
## Package Management (Ubuntu)
- Update package lists: `sudo apt update`
- Install a package: `sudo apt install <package>`
- Purge a package: `sudo apt purge <package>`
- Remove a package: `sudo apt remove <package>`
- Search for a package: `apt search <package>`
- Upgrade packages: `sudo apt upgrade`
## Networking
- Get all interface ips: `ip a`
- Ping a host: `ping <host>`
- Get the public IP: `curl ifconfig.me`
- Get the public IP (alternative): `curl ipinfo.io/ip`
## Firewall (UFW)
Make sure to allow SSH before enabling the firewall, otherwise you will be locked out of your server. `sudo ufw allow ssh`
- Enable the firewall: `sudo ufw enable`
- Disable the firewall: `sudo ufw disable`
- List all rules: `sudo ufw status`
- List all rules (showing numbers): `sudo ufw status numbered`
- Delete a rule: `sudo ufw delete <rule>`
- Allow a port: `sudo ufw allow <port>`
- Deny a port: `sudo ufw deny <port>`
- Allow a service: `sudo ufw allow <service>`
- Deny a service: `sudo ufw deny <service>`
## Service Management (Systemd)
- Start a service: `sudo systemctl start <service>`
- Stop a service: `sudo systemctl stop <service>`
- Check the status of a service: `sudo systemctl status <service>`
- Restart a service: `sudo systemctl restart <service>`
- Enable a service (start on boot): `sudo systemctl enable <service>`
- Disable a service (stop on boot): `sudo systemctl disable <service>`
- Reload a service: `sudo systemctl reload <service>`

@ -0,0 +1,68 @@
---
title: How to use cronjobs
description: Examples on how to use cronjob to automate tasks
published: true
date: 2023-06-27T08:28:13.676Z
tags:
editor: markdown
dateCreated: 2023-06-27T08:28:13.676Z
---
# How to use cronjobs
This guide provides examples on how to use cronjob to automate tasks. _This was tested on Ubuntu 22.04._
## Get Started
- Begin by opening a terminal and running the following command:
```bash
crontab -e
```
If it's the first time you're using cronjob, you will be asked to select an editor. You can choose `nano` or `vim`. If you're not familiar with either, choose `nano` as the guide is based on this and it's the easiest. This command will open the crontab file in the nano text editor.
- Next, you need to define the cronjob. Add the following lines to the file:
```bash
* * * * * <command>
```
- Finally, you can save the file by pressing `Ctrl + X` and then `Y`.
## Syntax
```bash
* <- minute (0-59)
* <- hour (0-23)
* <- day of month (1-31)
* <- month (1-12)
* <- day of week (0-6) (Sunday=0)
<command> <- the command to execute
```
## Examples
### Run a command every minute
```bash
* * * * * <command>
```
### Run a command every 5 minutes
```bash
*/5 * * * * <command>
```
### Run a command every hour
```bash
0 * * * * <command>
```
### Run a command every day at midnight
```bash
0 0 * * * <command>
```

14
guides/nodejs/home.md Normal file

@ -0,0 +1,14 @@
---
title: NodeJS Home
description: NodeJS Guides and Tutorials
published: true
date: 2023-06-27T11:06:30.081Z
tags: nodejs
editor: markdown
dateCreated: 2023-06-27T11:06:59.640Z
---
# Pages
- [Creating a Simple REST API](/guides/nodejs/pages/creating-a-simple-rest-api)
- [Running a NodeJS Application in Docker](/guides/nodejs/pages/running-nodejs-in-docker)

@ -0,0 +1,94 @@
---
title: Creating a Simple REST API
description: Creating a simple REST API with NodeJS and Express
published: true
date: 2023-06-28T20:38:30.081Z
tags: nodejs, rest, api, express
editor: markdown
dateCreated: 2023-06-28T20:38:59.640Z
---
# Creating a Simple REST API
## Introduction
In this guide we will be creating a simple REST API using NodeJS and Express. We will be using the following tools:
- NodeJS
- Express
## Prerequisites
- NodeJS installed
- NPM installed
## Creating the project
1. First we need to create a new directory for our project. You can do this by creating a new folder in your file explorer or by using the following command:
```bash
mkdir nodejs-rest-api
```
2. Next, we need to navigate to our new directory. We can do this by opening the folder in our file explorer or by using the following command:
```bash
cd nodejs-rest-api
```
3. Next, we need to initialize our project. We can do this by running the following command:
```bash
npm init -y
```
4. Next, we need to install the Express package. We can do this by running the following command:
```bash
npm install express
```
5. Next, we need to create a new file called `index.js`.
6. Next, we need to open the `index.js` file and add the following code:
```javascript
const express = require("express");
const app = express();
```
This will import the Express package and create a new Express application.
7. Next, we need to add the following code to the `index.js` file:
```javascript
app.get("/", (req, res) => {
res
.contentType("application/json")
.send(JSON.stringify({ message: "Hello World!" }));
});
```
This will create a new route that will return a JSON object with the message "Hello World!".
8. Next, we need to add the following code to the `index.js` file:
```javascript
app.listen(3000, () => {
console.log("Server is running on port 3000");
});
```
This will start the server on port 3000.
9. Next, we need to run the following command to start the server:
```bash
node index.js
```
10. Next, we need to open our browser and navigate to `http://localhost:3000/`. We should see the message "{message: "Hello World!"}".
## Conclusion
In this guide we created a simple REST API using NodeJS and Express. We created a new directory for our project, initialized our project, installed the Express package, created a new file called `index.js`, added the code to the `index.js` file, and started the server.

@ -0,0 +1,103 @@
---
title: Running a NodeJS application in Docker
description: Guide for running a NodeJS application in Docker
published: true
date: 2023-06-28T20:38:30.081Z
tags: nodejs, docker
editor: markdown
dateCreated: 2023-06-28T20:38:59.640Z
---
# Running a NodeJS application in Docker
We will be using the guide [Creating a Simple REST API](/guides/nodejs/pages/creating-a-simple-rest-api) as the example application.
## Prerequisites
- Docker installed
- Docker Compose installed
## Get Started
1. First we need to create a new file called `Dockerfile`.
2. Next, we need to open the `Dockerfile` file and add the following code:
```dockerfile
FROM node:latest
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
```
3. Now we can move on to the `docker-compose.yml` file. We need to create a new file called `docker-compose.yml`.
4. Next, we need to open the `docker-compose.yml` file and add the following code:
```yaml
version: "3.9"
services:
nodejs_rest_api:
build: .
restart: unless-stopped
ports:
- "3000:3000"
```
This will create a new service called `nodejs_rest_api` and build the Docker image using the `Dockerfile` in the current directory.
5. You can now copyy the project files to where you want to run the application.
6. Next, we need to open the terminal and run the following command:
```bash
docker-compose up -d
```
This will start the application in the background.
7. Next, we need to open a web browser and navigate to `http://server_ip:3000`.
You should now see your application running.
## Updating the application
1. First we need to open the terminal and run the following command:
```bash
docker-compose down
```
This will stop the application.
2. Next, we need to update the application files. You can do this by copying the updated files to the server.
3. Next, we need to open the terminal and run the following command:
```bash
docker-compose build
```
This will re-build the Docker image.
4. Next, we need to open the terminal and run the following command:
```bash
docker-compose up -d
```
This will start the application in the background again.
## Finished
You have now successfully created a NodeJS application and run it in Docker and know how to update it.

21
guides/ubuntu/home.md Normal file

@ -0,0 +1,21 @@
---
title: Ubuntu Home
description: Ubuntu guides
published: true
date: 2023-06-27T11:35:30.081Z
tags: ubuntu
editor: markdown
dateCreated: 2023-06-27T11:35:59.640Z
---
# Pages
Below is a list of guides for Ubuntu.
## Ubuntu 22.04
- [Expanding an LVM](/guides/ubuntu/pages/22_04/expanding-an-lvm)
- [Installing MongoDB](/guides/ubuntu/pages/22_04/install-mongodb)
- [Installing Node.js](/guides/ubuntu/pages/22_04/install-nodejs)
- [Installing Docker](/guides/ubuntu/pages/22_04/install-docker)
- [Systemd service](/guides/ubuntu/pages/22_04/systemd-service)

@ -0,0 +1,66 @@
---
title: Expanding a LVM
description: How to expand a LVM
published: true
date: 2023-06-27T07:54:18.672Z
tags: linux, server, ubuntu, lvm, ubuntu 22.04
editor: markdown
dateCreated: 2023-06-27T07:54:18.672Z
---
# Expanding a LVM
This guide provides instructions on how to expand a LVM. _This was tested on Ubuntu 22.04._
## Get Started
- Begin by opening a terminal and running the following command:
```bash
lvdisplay
```
This command will display the volume groups.
You should see something like this:
```bash
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID eIxgxf-ABCD-EFGH-IJKL-MNOP-QRsT-UVWxYz
LV Write Access read/write
LV Creation host, time ubuntu, 2023-06-27 08:00:00 +0000
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
```
You can find the volume we will be expanding by looking at the `LV Path` it should be something like `/dev/ubuntu-vg/ubuntu-lv`.
- Next, you need to expand the volume. Run the following command:
```bash
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
```
This command will expand the volume to use all available space.
- Finally, you need to expand the filesystem. Run the following command:
```bash
resize2fs /dev/ubuntu-vg/ubuntu-lv
```
This command will expand the filesystem to use all available space.
## Finished
You now have a LVM that has been expanded to use all available space.

@ -3,7 +3,7 @@ title: How to install Docker
description: How to install Docker on Ubuntu 22.04 description: How to install Docker on Ubuntu 22.04
published: true published: true
date: 2023-06-26T10:57:30.081Z date: 2023-06-26T10:57:30.081Z
tags: docker, ubuntu, installation, containerization, container, linux, server, ubuntu tags: docker, ubuntu, installation, containerization, container, linux, server, ubuntu, ubuntu 22.04
editor: markdown editor: markdown
dateCreated: 2023-06-26T10:43:59.640Z dateCreated: 2023-06-26T10:43:59.640Z
--- ---

@ -0,0 +1,223 @@
---
title: Installing MongoDB
description: How to install MongoDB on Ubuntu 22.04
published: true
date: 2023-06-28T12:09:18.672Z
tags: linux, server, ubuntu, mongodb, ubuntu 22.04
editor: markdown
dateCreated: 2023-06-28T12:09:18.672Z
---
# Installing MongoDB
This guide provides instructions on how to install MongoDB on Ubuntu 22.04. Installing Mongo is a fairly simple process.
## Updating the System
- We will start by updating the apt package list. Run the following command:
```bash
sudo apt update
```
This will update the apt package list so that we ensure that the latest versions of packages are available.
- Next, we will upgrade the packages. Run the following command:
```bash
sudo apt upgrade
```
This will upgrade the packages to the latest versions.
## Installing required packages
- Now, we will install some packages that are required. Run the following command:
```bash
sudo apt install gnupg2 wget
```
## Installing MongoDB
1. Import the MongoDB GPG key. Run the following command:
```bash
wget -nc https://www.mongodb.org/static/pgp/server-6.0.asc
cat server-6.0.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/mongodb.gpg >/dev/null
```
These commands will download the GPG key and import it, which will allow us to verify the packages.
2. Add MongoDB to the apt sources list. Run the following command:
```bash
sudo sh -c 'echo "deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" >> /etc/apt/sources.list.d/mongo.list'
```
This command will add the MongoDB apt repository to the sources list.
3. Update the apt package list. Run the following command:
```bash
sudo apt update
```
This will update the apt package list so that we ensure that the latest versions of packages are available.
4. Install MongoDB. Run the following command:
```bash
sudo apt install mongodb-org
```
This will install the latest stable version of MongoDB.
5. Start MongoDB. Run the following command:
```bash
sudo systemctl start mongod
```
6. Enable MongoDB so that it will automatically start on system boot. Run the following command:
```bash
sudo systemctl enable mongod
```
7. Verify that MongoDB is running. Run the following command:
```bash
sudo systemctl status mongod
```
You should see something like this:
```bash
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-06-27 08:00:00 UTC; 1min 30s ago
Docs: https://docs.mongodb.org/manual
Main PID: 1234 (mongod)
Tasks: 33 (limit: 4915)
Memory: 1.2G
CGroup: /system.slice/mongod.service
└─1234 /usr/bin/mongod --config /etc/mongod.conf
```
## Finished
You have successfully installed MongoDB on Ubuntu 22.04. For user creation and securing MongoDB, please see the next sections.
## Optional: Securing MongoDB
1. Connect to MongoDB, so that we can create an admin user. Run the following command:
```bash
mongosh
```
2. Switch to the `admin` database. Run the following command:
```bash
use admin
```
3. Create an admin user. Run the following command:
```bash
db.createUser(
{
user: "admin",
pwd: "SET ME", # Generate a random string with: openssl rand -base64 32 | cut -c1-32
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
```
4. Exit the mongo shell. Run the following command:
```bash
exit
```
5. Now, we need to secure enable authentication, this will secure the server and prevent unauthorized access. Run the following command:
```bash
sudo nano /etc/mongod.conf
```
6. Find the `security` section. We need to uncomment it, and add the following line below it, it should look like this:
```bash
security:
authorization: enabled
```
7. Save the file and exit the editor. You can do this by pressing `CTRL + X`, then `Y`, then `ENTER`.
## Optional: Adding a user / database
1. Connect to MongoDB, so that we can create a user. Run the following command:
```bash
mongosh -u admin -p --authenticationDatabase admin
```
This will ask you for the password that you set earlier in the Securing MongoDB section, or if you didn't secure MongoDB, run the following command:
```bash
mongosh
```
2. Switch to the database that you want to add a user to eg: `forum`. Run the following command:
```bash
use forum
```
3. Create a user. Make sure to change the `db` to match the database used above. Run the following command:
```bash
db.createUser(
{
user: "forum",
pwd: "SET ME", # Generate a random string with: openssl rand -base64 32 | cut -c1-32
roles: [ { role: "readWrite", db: "forum" } ]
}
)
```
4. Exit the mongo shell. Run the following command:
```bash
exit
```
You have now created a user for the `forum` database. You can repeat this process for any other databases that you want to create users for.
## Optional: Allowing remote connections
1. Open the MongoDB configuration file. Run the following command:
```bash
sudo nano /etc/mongod.conf
```
2. Find the `net` section, we need to update the `bindIp` value, it should look like this:
```bash
net:
port: 27017
bindIp: 0.0.0.0
```
3. Save the file and exit the editor. You can do this by pressing `CTRL + X`, then `Y`, then `ENTER`.
4. Restart MongoDB. Run the following command:
```bash
sudo systemctl restart mongod
```
You should now be able to connect to MongoDB from a remote machine.

@ -3,7 +3,7 @@ title: How to install NodeJS
description: How to install NodeJS on Ubuntu 22.04 description: How to install NodeJS on Ubuntu 22.04
published: true published: true
date: 2023-06-26T13:04:30.081Z date: 2023-06-26T13:04:30.081Z
tags: nodejs, ubuntu, installation, linux, server, ubuntu tags: nodejs, ubuntu, installation, linux, server, ubuntu, ubuntu 22.04
editor: markdown editor: markdown
dateCreated: 2023-06-26T13:04:59.640Z dateCreated: 2023-06-26T13:04:59.640Z
--- ---

@ -3,7 +3,7 @@ title: How to create a Systemd service
description: How to create a Systemd service on Ubuntu 22.04 description: How to create a Systemd service on Ubuntu 22.04
published: true published: true
date: 2023-06-26T13:28:49.025Z date: 2023-06-26T13:28:49.025Z
tags: docker, ubuntu, installation, containerization, container, linux, server, ubuntu, systemd, service tags: linux, server, ubuntu, systemd, service
editor: markdown editor: markdown
dateCreated: 2023-06-26T13:28:49.025Z dateCreated: 2023-06-26T13:28:49.025Z
--- ---
@ -38,7 +38,7 @@ Description=<name>
ExecStart=<command> ExecStart=<command>
WorkingDirectory=<directory> WorkingDirectory=<directory>
Restart=always Restart=always
User=root User=root (use a non root user for better security)
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

14
guides/unraid/home.md Normal file

@ -0,0 +1,14 @@
---
title: Unraid Home
description: Unraid guides
published: true
date: 2023-06-27T14:20:30.081Z
tags: unraid
editor: markdown
dateCreated: 2023-06-27T14:20:59.640Z
---
# Pages
- [Backing up a Docker application](/guides/unraid/pages/docker-app-backup)
- [Recycle Bin](/guides/unraid/pages/recycle-bin)

@ -0,0 +1,106 @@
---
title: Docker application backup
description: How to backup a Docker application on Unraid
published: true
date: 2023-06-27T07:54:18.672Z
tags: linux, server, unraid, backup
editor: markdown
dateCreated: 2023-06-27T07:54:18.672Z
---
# Docker application backup
This guide will show you how to backup a Docker application on Unraid. _Tested on Unraid 6.12.1_
## Get Started
- Begin by installing the [User Scripts plugin](https://forums.unraid.net/topic/48286-plugin-ca-user-scripts/).
- Now we need to create the script. Go to `Settings > User Utilites > User Scripts` and click `Add New Script`.
- Give the script a name, for example `Backup Docker Application`.
- Paste the following into the script:
```bash
#!/bin/bash
# --- DO NOT TOUCH ---
now="$(date +"%Y-%m-%d"@%H.%M)"
# --- Variables ---
# The name of the application
applicationName="application_name"
# The name of the backup
backupName="backup-$(date +%Y-%m-%d_%H-%M-%S)"
# Set the path to the application's data directory
applicationData="/mnt/user/appdata/application_name/"
# Set the path to the backup directory
# Example: /mnt/user/Storage/Backups/$applicationName/
backupDirectory=""
# Set Number backups to keep
backupsToKeep=30
# The user of your account
# Example: lee
user=""
# --- Backup Application ---
# Start notification
echo "Backup of $applicationName starting."
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "$applicationName Backup" -d "Backup of $applicationName starting."
# Create backup directory
mkdir -p "$backupDirectory"
cd "$backupDirectory"
# Create the backup tarball
tar -cf "$applicationName-$now".tar "$applicationData"
# Set Permissions
chown "$user:$user" "$applicationName-$now".tar
# Cleanup old backups
for file in $(ls -t); do
if [[ $count -ge $backupsToKeep ]]; then
rm -- "$file"
echo "Deleted old backup: $file"
fi
((count++))
done
# Stop notification
echo "Backup of $applicationName completed!"
/usr/local/emhttp/plugins/dynamix/scripts/notify -s "$applicationName Backup" -d "Backup of $applicationName completed!"
```
- You can now test the script by clicking `Run Script`. If everything is working correctly, you should see a notification in the top right corner of the screen.
- Now we need to set the script to run on a schedule. Next to `Run In Background` you will see a dropdown menu. Select how often you want it to run and click `Apply`.
## Restore a backup
- Delete the application's data directory.
- Copy the backup to the application's data directory.
Move the backup with the following command: (or via the Unraid web interface)
```bash
mv <backup_name>.tar /mnt/user/appdata/application_name/
```
- To restore a backup, simply extract the tarball and copy the files to the application's data directory.
You can extract the tarball by running the following command:
```bash
tar -xvf <backup_name>.tar
```
This command will extract the tarball to the current directory.
## Finished
You have now successfully setup a backup script for your Docker application. You can view the backups in the directory you set in the script.

@ -0,0 +1,45 @@
---
title: Save deleted files to the Recycle Bin
description: A simple guide on how to save and restore deleted files via smb/samba
published: true
date: 2023-06-27T07:54:18.672Z
tags: linux, server, unraid, backup
editor: markdown
dateCreated: 2023-06-27T07:54:18.672Z
---
# Save deleted files to the Recycle Bin
This guide will show you how to save deleted files to the Recycle Bin on Unraid. _Tested on Unraid 6.12.1_
## Get Started
- Begin by installing the [Recycle Bin plugin](https://forums.unraid.net/topic/41044-recycle-bin-vfs-recycle-for-smb-shares/).
- We now need to enable the plugin. Go to `Settings > User Utilities > Recycle Bin`.
- Now we can configure the plugin. I have used the following settings:
```bash
Enable Recycle Bin > Yes
Hide Recycle Bin Folder > No
Update Recycle Bin Size in Background > Yes
Enable on Unassigned Devices? > No
Recycle Bin parameters > %m/%S
Recycle Bin permission > Default
Excluded Files > Empty
Excluded Directories > This is where you can exclude directories from the Recycle Bin. For example: /mnt/user/Storage/Backups/
Excluded Shares > You can put any share name that you want to exclude. Example: Plex-Media,Backups
Age Days > 7 (This is how long the files will stay in the Recycle Bin before being deleted)
Remove Aged Files on Schedule? > Weekly
Remove Aged Files Notification? > Yes
Log Deleted Files? > No
```
- Click `Apply` to save the settings.
## Finished
The Recycle Bin is now enabled and ready to use. You can test it by deleting a file from a share and then checking the Recycle Bin folder.
## Extra
This wont work for files deleted via the cli or the Unraid webui. This will only work for files deleted over smb/samba.

11
home.md

@ -1,6 +1,6 @@
--- ---
title: Home title: Home
description: Useful docs to help you in your Homelab description: Useful guides and documentation to help you learn and solve problems efficiently.
published: true published: true
date: 2023-06-26T11:03:27.502Z date: 2023-06-26T11:03:27.502Z
tags: tags:
@ -18,8 +18,11 @@ Fascinated's Wiki is a comprehensive resource for Docker, Ubuntu, and more. Whet
## Topics Covered ## Topics Covered
- Docker: Discover the power of containerization and learn how to efficiently package, deploy, and run applications using Docker containers. - [Linux](/guides/linux/home): Explore the popular Linux distribution and learn how to set up and manage Linux-based systems, including installation, configuration, and common tasks.
- Ubuntu: Explore the popular Linux distribution and learn how to set up and manage Ubuntu-based systems, including installation, configuration, and common tasks. - [Ubuntu](/guides/ubuntu/home): Learn how to use Ubuntu. Ubuntu is a Linux distribution based on Debian.
- [Docker](/guides/docker/home): Discover the power of containerization and learn how to efficiently package, deploy, and run applications using Docker containers.
- [NodeJS](/guides/nodejs/home): Learn how to use NodeJS. NodeJS is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- [Unraid](/guides/unraid/home): Learn how to use Unraid. Unraid is a Linux-based operating system optimized for media file storage.
## How to Use ## How to Use
@ -27,7 +30,7 @@ Navigate through the different topics using the menu on the left or the search b
## Contribute ## Contribute
We encourage contributions from the community to improve and expand our content. If you have a tutorial, guide, or any valuable information related to Docker, Ubuntu, or other relevant topics, feel free to open a pull request on <https://git.fascinated.cc/Fascinated/docs>. Together, we can make the wiki a valuable resource for everyone. We encourage contributions from the community to improve and expand our content. If you have a tutorial, guide, or any valuable information related to Docker, Ubuntu, Linux, or other relevant topics, feel free to open a pull request on <https://git.fascinated.cc/Fascinated/docs>. Together, we can make the wiki a valuable resource for everyone.
## Contact ## Contact

20
knowledgebase.md Normal file

@ -0,0 +1,20 @@
---
title: Knowledgebase
description: Collection of useful information related to Docker, Ubuntu, Linux, and other relevant topics
published: true
date: 2023-06-29T03:45:18.672Z
tags:
editor: markdown
dateCreated: 2023-06-29T03:45:30.708Z
---
# Knowledgebase
This is a collection of useful information related to Docker, Ubuntu, Linux, and other relevant topics.
## Docker
- What is Docker? Docker is a tool that helps you bundle up and use programs easily. It's like a box that holds all the things needed to run an app.
- What is a Docker container? A Docker container is a small and self-contained package that has everything necessary to run a program. It's like a tiny computer that runs only one program.
- What is a Docker image? A Docker image is a blueprint for creating a Docker container. It's like a recipe that tells Docker how to build a container.
- What is Docker Compose? Docker Compose is a tool that makes it simple to manage and run multiple Docker containers together. It's like a manager that coordinates different containers for a group of apps.