Add tutorial on how to setup Redis

This commit is contained in:
Telesphoreo 2022-02-04 16:26:27 -06:00
parent 4807a75213
commit 5e1deb41fd
5 changed files with 114 additions and 19 deletions

View file

@ -10,12 +10,12 @@ import TabItem from '@theme/TabItem';
# Introduction
Compiling Plex is straightforward as there are no dependencies that need to be added manually. Plex uses Gradle as the build system. All compiling instructions are in the ```build.gradle``` file.
# Prerequisites
## Prerequisites
Please ensure that you have Java 17 installed on your computer, as Plex requires JDK 17 to compile. You will get an error if you try to use an older version.
If you have Java 17 installed, it may not be set in your path. If you do not already have Java installed, the recommended place to get Java is from [Adoptium](https://adoptium.net/). In the installer, there is an option to set JDK 17 to your path. **You must select that option if it is not already selected by default.**
Plex does not require, but recommends having Git installed on your computer. If you do not want to install Git, you may download the source code manually. Git for Windows can be downloaded [here](https://git-scm.com). macOS and Linux users should already have Git installed by default.
# Using the command line
## Using the command line
First, clone the Plex source code from GitHub on to your computer using the following command.
```bash
git clone https://github.com/PlexDevelopment/Plex

View file

@ -1,13 +1,12 @@
---
id: config
title: Configuration
sidebar_position: 1
---
# Introduction
This page will show you how to modify the configuration file. The configuration file is located at: ```/plugins/Plex/config.yml```.
# Default configuration
## Default configuration
Below is the default `config.yml` file when Plex is loaded for the first time.
```yaml title=/plugins/Plex/config.yml
# Plex Configuration File
@ -70,7 +69,7 @@ worlds:
debug: false
```
# Server
## Server
### server.name
The name of your server goes here and is used throughout Plex.
### server.motd
@ -78,17 +77,17 @@ The text here will appear on the server list.
### server.colorize_motd
This determines if the message of the day should randomly be colorized. You can disable this option and manually colorize your MOTD.
# Banning
## Banning
### banning.message
This message will appear whenever a player tries to join the server, but is banned. You can use any color coding you would like here.
# Commands
## Commands
### comamnds.permissions
**Options:** `ranks` or `permissions`
This determines how Plex's command system works. If `ranks` is selected, Plex will use a ranking system and give all players operator status. If `permissions` is selected, no players are given operator. Instead, every command will have a permission attached to it which can be assigned in any permission system.
# Data
## Data
### data.central.storage
**Options**: `sqlite`, `mariadb`, `mongodb`
@ -133,7 +132,7 @@ This is the port that Redis is listening on. This is requird for Redis to work.
This is the password for your Redis instance. Note that this can be left if authentication is turned off.
# Worlds
## Worlds
An infinite amount of worlds can be generated from the configuration file. A few are automatically generated by default. The format for generating new worlds is as follows:
```yaml title=/plugins/Plex/config.yml
<world_name>:
@ -146,7 +145,7 @@ An infinite amount of worlds can be generated from the configuration file. A few
```
Note that in the `parameters` section, this is how the world should actually be generated. The order is from top to bottom. In the example above, a world will generate with one grass layer, 32 layers of dirt, 16 layers of stone, and one layer of bedrock.
# Debugging
## Debugging
**Options:** `true` / `false`
The `debug` option is standalone and enables additional logging. This may be useful for diagnosing issues as more information will be displayed in the console. It is recommended to keep this option turned off.

View file

@ -1,13 +1,12 @@
---
id: messages
title: Messages
sidebar_position: 2
---
# Introduction
Almost all of the messages inside of Plex are fully customizable. This page will document how to change messages in the ```messages.yml``` file inside the Plex folder.
# Default file
## Default file
The default `messages.yml` file is below.
```yaml title=/plugins/Plex/messages.yml
# Plex Messages File
@ -71,5 +70,5 @@ playerNotBanned: "<e>That player is not banned!"
teleportedToWorldSpawn: "<b>Teleporting to the local spawn"
```
# Troubleshooting
## Troubleshooting
If you receive `No message.` when executing a command, it is likely you need to regenerate your `messages.yml` file. The default configuration file is also available on [GitHub](https://raw.githubusercontent.com/PlexDevelopment/Plex/master/src/main/resources/messages.yml).

83
docs/redis.md Normal file
View file

@ -0,0 +1,83 @@
---
id: redis
title: Configuring Redis
sidebar_position: 6
---
# Introduction
This page will show you how to setup and configure Redis for Plex. This tutorial assumes a moderate amount of computer knowledge. Please note that setting up Redis is optional. It offers many performance improvements, but can be dangerous if improperly configured.
## Using Pterodactyl
If you are using Pterodactyl, setting up Redis is easy. You will need to download and add the Redis egg, which requires administrator privileges. If you are not an administrator, you may request an administrator to set up Redis for you.
### Setup the Redis egg
Download the Redis egg from [here](https://raw.githubusercontent.com/ign-gg/Pterodactyl-Eggs/master/database/redis/redis-6/egg-redis-6.json). You can right click on the page and click "Save As". Please ensure that the filename ends in .json
On your Pterodactyl admin page, click on the "Nests" from the sidebar. Click the blue "Create New" button and enter "Databases" for the name.
Then, click on the green "Import Egg" button. Import the `egg-redis-6.json` file you just downloaded and make sure the "Associated Nest" is set to "Databases".
### Configure the allocations
Click on the "Nodes" tab from the sidebar. Click on the node you would like to add Redis. Click on the "Allocation" tab. On the right, you will see a box that says "Assign New Allocations". For the IP Address, enter `172.18.0.1`, and for the port enter `6380`.
:::danger
Do ***NOT*** enter the public IP for the server under IP Address. If you do that, you will open up your Redis instance to the entire internet. Also, do ***NOT*** use port `6379` for Redis. Pterodactyl itself uses Redis and it will not work. You have been warned.
:::
### Add a new server
Go to the Servers tab and click the "Create New" button. The Server Name can be whatever you like. Under "Allocation Management" > "Default Allocation", select the allocation you made for Redis. If you have done the above step correctly, you should see `172.18.0.1:6380` in the list. Redis does not need much memory, 256MB is plenty.
To ensure Redis is actually used, you need to use the Redis egg. Under "Nest Configuration", select the "Databases" nest. Redis should be the only option under there.
### Set the password
The password for Redis is set under the "Service Variables" tab. Please change it from the default password. A good website to generate a secure password can be found here: [https://www.grc.com/passwords.htm](https://www.grc.com/passwords.htm).
:::danger
***DO NOT USE THE DEFAULT PASSWORD PROVIDED BY THE EGG.***
:::
### Configuration
Once the Redis server has been installed, go to the "File Manager" tab and open `redis.conf`. You will need to change the bind address.
```title=redis.conf
...
################################## NETWORK #####################################
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 loopback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 172.18.0.1
...
```
Find this block in your Redis configuration file and ensure bind is set to `172.18.0.1`. It is normally set to `127.0.0.1`, which will **not** work.
### Plex Configuration
Redis should be successfully set up! Now all you have to do is enter your credentials into the Plex configuration file.
```yaml title=/plugins/Plex/config.yml
side:
enabled: true
auth: true
hostname: '172.18.0.1'
port: 6380
password: 'your_secure_password_here'
```
Replace `your_secure_password_here` with the password you made for Redis. Now, Plex will use Redis for storing punishment data. Note that the JSON files are still made as a backup no matter what.

View file

@ -14,18 +14,32 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
//tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
// But you can create a sidebar manually
/*
tutorialSidebar: [
defaultSidebar: [
{
type: 'doc',
label: 'Introduction',
id: 'intro',
},
{
type: 'doc',
label: 'Compiling',
id: 'compiling',
},
{
type: 'category',
label: 'Tutorial',
items: ['hello'],
label: 'Customization',
items: ['customization/config', 'customization/messages'],
},
{
type: 'doc',
label: 'Configuring Redis',
id: 'redis',
},
],
*/
};
module.exports = sidebars;