Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
c20ff2744f |
@ -1,23 +0,0 @@
|
||||
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 }}
|
@ -3,7 +3,7 @@ title: How to create a Systemd service
|
||||
description: How to create a Systemd service on Ubuntu 22.04
|
||||
published: true
|
||||
date: 2023-06-26T13:28:49.025Z
|
||||
tags: linux, server, ubuntu, systemd, service
|
||||
tags: docker, ubuntu, installation, containerization, container, linux, server, ubuntu, systemd, service
|
||||
editor: markdown
|
||||
dateCreated: 2023-06-26T13:28:49.025Z
|
||||
---
|
||||
@ -38,7 +38,7 @@ Description=<name>
|
||||
ExecStart=<command>
|
||||
WorkingDirectory=<directory>
|
||||
Restart=always
|
||||
User=root (use a non root user for better security)
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,13 +0,0 @@
|
||||
---
|
||||
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
|
@ -3,7 +3,7 @@ title: How to install Docker
|
||||
description: How to install Docker on Ubuntu 22.04
|
||||
published: true
|
||||
date: 2023-06-26T10:57:30.081Z
|
||||
tags: docker, ubuntu, installation, containerization, container, linux, server, ubuntu, ubuntu 22.04
|
||||
tags: docker, ubuntu, installation, containerization, container, linux, server, ubuntu
|
||||
editor: markdown
|
||||
dateCreated: 2023-06-26T10:43:59.640Z
|
||||
---
|
||||
@ -60,3 +60,39 @@ Docker version 23.0.6, build ef23cbc
|
||||
## Finished
|
||||
|
||||
Congratulations! You have now installed Docker Community Edition on your Ubuntu machine. Docker is ready to be used, allowing you to leverage the power of containerization for your projects and applications.
|
||||
|
||||
Certainly! Here's the raw Markdown syntax for the rootless part, enclosed in a code block:
|
||||
|
||||
# Optional: Running Docker in Rootless Mode
|
||||
|
||||
By default, Docker requires root privileges to run. However, Docker also supports running in rootless mode, which allows non-root users to use Docker without needing to escalate their privileges. Keep in mind that rootless mode has some limitations and may not be suitable for all use cases.
|
||||
Warning: Rootless Mode Implications
|
||||
|
||||
Running Docker in rootless mode has the following implications:
|
||||
|
||||
Some advanced features, such as accessing privileged resources or running privileged containers, may be restricted.
|
||||
Network functionality may be limited, and you may encounter issues when trying to bind to privileged ports.
|
||||
Docker volumes may have reduced functionality or performance.
|
||||
|
||||
If you understand these implications and still wish to run Docker in rootless mode, you can follow the steps below:
|
||||
|
||||
Install the necessary dependencies for rootless mode by running the following command in the terminal:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://get.docker.com/rootless | sh
|
||||
```
|
||||
|
||||
This command downloads a script specifically for rootless mode and executes it.
|
||||
|
||||
After the installation completes, you can initialize your Docker environment by running the following command which starts the rootless Docker service.:
|
||||
|
||||
```bash
|
||||
sudo systemctl --user start docker
|
||||
```
|
||||
|
||||
To verify that Docker is running in rootless mode, use the following command:
|
||||
```bash
|
||||
docker version
|
||||
```
|
||||
|
||||
You should be able to run docker commands without the need of sudo privileges!
|
@ -3,7 +3,7 @@ title: How to install NodeJS
|
||||
description: How to install NodeJS on Ubuntu 22.04
|
||||
published: true
|
||||
date: 2023-06-26T13:04:30.081Z
|
||||
tags: nodejs, ubuntu, installation, linux, server, ubuntu, ubuntu 22.04
|
||||
tags: nodejs, ubuntu, installation, linux, server, ubuntu
|
||||
editor: markdown
|
||||
dateCreated: 2023-06-26T13:04:59.640Z
|
||||
---
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
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)
|
@ -1,93 +0,0 @@
|
||||
---
|
||||
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>`
|
@ -1,68 +0,0 @@
|
||||
---
|
||||
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>
|
||||
```
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
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)
|
@ -1,94 +0,0 @@
|
||||
---
|
||||
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.
|
@ -1,103 +0,0 @@
|
||||
---
|
||||
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.
|
@ -1,21 +0,0 @@
|
||||
---
|
||||
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)
|
@ -1,66 +0,0 @@
|
||||
---
|
||||
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.
|
@ -1,223 +0,0 @@
|
||||
---
|
||||
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.
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
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)
|
@ -1,106 +0,0 @@
|
||||
---
|
||||
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.
|
@ -1,45 +0,0 @@
|
||||
---
|
||||
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
11
home.md
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Home
|
||||
description: Useful guides and documentation to help you learn and solve problems efficiently.
|
||||
description: Useful docs to help you in your Homelab
|
||||
published: true
|
||||
date: 2023-06-26T11:03:27.502Z
|
||||
tags:
|
||||
@ -18,11 +18,8 @@ Fascinated's Wiki is a comprehensive resource for Docker, Ubuntu, and more. Whet
|
||||
|
||||
## Topics Covered
|
||||
|
||||
- [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](/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.
|
||||
- Docker: Discover the power of containerization and learn how to efficiently package, deploy, and run applications using Docker containers.
|
||||
- Ubuntu: Explore the popular Linux distribution and learn how to set up and manage Ubuntu-based systems, including installation, configuration, and common tasks.
|
||||
|
||||
## How to Use
|
||||
|
||||
@ -30,7 +27,7 @@ Navigate through the different topics using the menu on the left or the search b
|
||||
|
||||
## 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, 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.
|
||||
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.
|
||||
|
||||
## Contact
|
||||
|
||||
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
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.
|
Loading…
Reference in New Issue
Block a user