Skip to content

Commit

Permalink
docs: improve plugin setup documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Dec 8, 2024
1 parent 8e46784 commit 2d54750
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 60 deletions.
4 changes: 2 additions & 2 deletions docs/API-v2.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
> **Warning:** API v2 is no longer supported or compatible with HuskSync v3.0. See [[Data Snapshot API]] for the equivalent v3 API. 🚨
HuskSync v2.0 provides an API for fetching and retrieving `UserData`; a snapshot of a user's synchronization.

> **Warning:** API v2 is no longer supported or compatible with HuskSync v3.0. See [[Data Snapshot API]] for the equivalent v3 API. 🚨
This page assumes you've read the general [[API]] introduction and imported HuskSync (v2.x) into your project, and added it as a dependency.

🚨 HuskSync API v2 only targets HuskSync v2.0-2.2.8. It is **not compatible with HuskSync v3.0+**. The equivalent API for HuskSync v3 is the [[Data Snapshot API]].
Expand Down
8 changes: 7 additions & 1 deletion docs/Compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ This plugin does not support the following software-Minecraft version combinatio
| 1.16.5 | _All_ | Please use v3.3.1 or lower |
| below 1.16.5 | _All_ | Upgrade to Minecraft 1.16.5 |

†Further downstream forks of this server software are also affected.
†Further downstream forks of this server software are also affected.

## Incompatible plugins / mods
Please note the following plugins / mods can cause issues with HuskSync:

* Restart plugins / mods are not supported. These will cause [player data to not save correctly when your server restarts](troubleshooting#issues-with-player-data-going-out-of-sync-during-a-server-restart) due to the way these plugins utilise bash scripts. It's important to understand that restart plugins don't actually restart yur server, they just trigger some (often unstable) process-killing scripting logic to occur!
* Combat logging plugins / mods are not supported. Some have built-in support for HuskSync and should work as expected, but for others you may wish to modify the [[Event Priorities]]
2 changes: 1 addition & 1 deletion docs/Config-File.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ database:
user_data: husksync_user_data
# Redis settings
redis:
# Specify the credentials of your Redis database here. Set "password" to '' if you don't have one
# Specify the credentials of your Redis server here. Set "password" to '' if you don't have one
credentials:
host: localhost
port: 6379
Expand Down
73 changes: 73 additions & 0 deletions docs/Database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
HuskSync persists player data and snapshots in a database of your choice. This is separate from a [[Redis]] server, which HuskSync uses for caching and inter-server messaging, which is also required to use HuskSync.

## Database types
> **Warning:** There is no automatic way of migrating between _database_ types. Changing the database type will cause data to be lost.
| Type | Database Software |
|:--------------------------|:--------------------------|
| `MYSQL` | MySQL 8.0 or newer |
| `MARIADB` | MariaDB 5.0 or newer |
| `POSTGRES` | PostgreSQL |
| [`MONGO`](#mongodb-setup) | MongoDB |

## Configuring
To change the database type, navigate to your [`config.yml`](Config-File) file and modify the properties under `database`.

<details>
<summary>Database options (config.yml)</summary>

```yaml
# Database settings
database:
# Type of database to use (MYSQL, MARIADB, POSTGRES, MONGO)
type: MYSQL
# Specify credentials here for your MYSQL, MARIADB, POSTGRES OR MONGO database
credentials:
host: localhost
port: 3306
database: minecraft
username: root
password: ''
# Only change this if you're using MARIADB or POSTGRES
parameters: ?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
# MYSQL, MARIADB, POSTGRES database Hikari connection pool properties. Don't modify this unless you know what you're doing!
connection_pool:
maximum_pool_size: 10
minimum_idle: 10
maximum_lifetime: 1800000
keepalive_time: 0
connection_timeout: 5000
# Advanced MongoDB settings. Don't modify unless you know what you're doing!
mongo_settings:
using_atlas: false
parameters: ?retryWrites=true&w=majority&authSource=HuskSync
# Names of tables to use on your database. Don't modify this unless you know what you're doing!
table_names:
users: husksync_users
user_data: husksync_user_data
```
</details>
### Credentials
You will need to specify the credentials (hostname, port, username, password and the database). These credentials are used to connect to your database server.
If your database server account doesn't have a password (not recommended), leave the password field blank (`password: ''`') and the plugin will attempt to connect without a password.

### Connection Pool properties
If you're using MySQL, MariaDB, or PostgreSQL as your database type, you can modify the HikariCP connection pool properties if you know what you're doing.

Please note that modifying these values can cause issues if you don't know what you're doing. The default values should be fine for most users.

## MongoDB Setup
If you're using a MongoDB database, in addition to setting the database type to `MONGO`, you'll need to perform slightly different configuration steps.

- Under `credentials` in the `database` section, enter the credentials of your MongoDB Database. You shouldn't touch the `connection_pool` properties.
- Under `parameters` in the `mongo_settings` section, ensure the specified `&authSource=` matches the database you are using (default is `HuskSync`).

### MongoDB Atlas setup
If you're using a MongoDB Atlas database, you'll also need to set the Atlas settings and adjust the connection parameters string.

- Set `using_atlas` in the `mongo_settings` section to `true`.
- Remove `&authSource=HuskSync` from `parameters` in the `mongo_settings`.

Note that the `port` setting in `credentials` is ignored when using Atlas.
53 changes: 47 additions & 6 deletions docs/FAQs.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
This page addresses a number of frequently asked questions about the plugin.
This page addresses a number of frequently asked questions about HuskSync.

## Frequently Asked Questions

<details>
<summary>&nbsp;<b>What data can be synchronized?</b></summary>
<summary>&nbsp;<b>What data can be synced?</b></summary>

HuskSync supports synchronising a wide range of different data elements, each of which can be toggled to your liking. Please check out the [[Sync Features]] page for a full list.

Expand All @@ -29,17 +29,57 @@ Please note we cannot guarantee compatibility with everything &mdash; test thoro

</details>

<details>
<summary>&nbsp;<b>What versions of Minecraft does HuskSync support?</b></summary>

Check the [[Compatibility]] table. In addition to the latest release of Minecraft, the latest version of HuskSync will support specific older versions based on popularity and mod support.

If your server's version of Minecraft isn't supported by the latest release, there's plenty of older, stable versions of HuskSync you can download, though note support for these versions will be limited.

</details>

<details>
<summary>&nbsp;<b>What do I need to run HuskSync?</b></summary>

See the [Requirements](setup#requirements) section under Setup.

You need a [[Database]] server, a [[Redis]] server, and [compatible Minecraft servers](compatibility).

</details>

<details>
<summary>&nbsp;<b>Is Redis required? What is Redis?</b></summary>

Yes! HuskSync requires Redis to operate (for reasons demonstrated below).
Yes, HuskSync requires a [[Redis]] server **in addition to a [[Database]] server** to operate.

Redis is an in-memory database server used for caching data at scale and sending messages across a network. You have a Redis server in a similar fashion to the way you have a MySQL database server. If you're using a Minecraft hosting company, you'll want to contact their support and ask if they offer Redis. If you're looking for a host, I have a list of some popular hosts and whether they support Redis [available to view here.](https://william278.net/docs/website/redis-hosts)

Redis is an in-memory database server used for caching data at scale and sending messages across a network. You have a Redis server in a similar fashion to the way you have a MySQL database server. If you're using a Minecraft hosting company, you'll want to contact their support and ask if they offer Redis. If you're looking for a host, I have a list of some popular hosts and whether they support Redis [available to read here.](https://william278.net/redis-hosts)
For more information, check our [Redis setup instructions](redis).

</details>

<details>
<summary>&nbsp;<b>How does the plugin synchronize data?</b></summary>
<summary>&nbsp;<b>How much RAM does my Redis server need?</b></summary>

We recommend your Redis server has 1GB of RAM, and that your Redis server is installed locally (on the same server as your game servers, or at least on the server running your Velocity/BungeeCord/Waterfall proxy).

</details>

<details>
<summary>&nbsp;<b>Is a Database required? What Databases are supported?</b></summary>

Yes. HuskSync requires both a [[Database]] server and a [[Redis]] server to operate.

HuskSync supports the following database types:
* MySQL v8.0+
* MariaDB v5.0+
* PostgreSQL
* MongoDB

</details>

<details>
<summary>&nbsp;<b>How does data syncing work?</b></summary>

HuskSync makes use of both MySQL and Redis for optimal data synchronization. You have the option of using one of two [[Sync Modes]], which synchronize data between servers (`DELAY` or `LOCKSTEP`)

Expand Down Expand Up @@ -71,9 +111,10 @@ Indeed, there exist economy plugins &mdash; such as [XConomy](https://github.com
</details>

<details>
<summary>&nbsp;<b>Is this better than MySQLPlayerDataBridge?</b></summary>
<summary>&nbsp;<b>Is HuskSync better than MySQLPlayerDataBridge?</b></summary>

I can't provide a fair answer to this question! What I can say is that your mileage will of course vary.

The performance improvements offered by HuskSync's synchronization method will depend on your network environment and the economies of scale that come with your player count. In terms of featureset, HuskSync does feature greater rollback and snapshot backup/management features if this is something you are looking for.

</details>
22 changes: 14 additions & 8 deletions docs/Home.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# [![HuskSync banner](https://raw.githubusercontent.com/WiIIiam278/HuskSync/master/images/banner.png)](https://github.com/WiIIiam278/HuskSync)
Welcome! This is the plugin documentation for HuskSync v3.x+. Please click through to the topic you'd like to read about.

## Guides
## Setup
* 📚 [[Setup]]
* 💾 [[Database]]
*[[Redis]]
* ⚠️ [[Compatibility]]
* 📄 [[Config File]]
* 🔗 [[Troubleshooting]]
* ↪️ [[Data Rotation]]
* ↗️ [[Legacy Migration]]
*[[MPDB Migration]]
* 🎏 [[Translations]]
*[[FAQs]]

## Documentation
## Features
* 🖥️ [[Commands]]
*[[Sync Features]]
* ⚙️ [[Sync Modes]]
* 🟩 [[Plan Hook]]
* ↪️ [[Data Rotation]]
*[[FAQs]]

## Guides
* ↗️ [[Legacy Migration]]
*[[MPDB Migration]]
* ☂️ [[Dumping UserData]]
* 🟩 [[Plan Hook]]
* 📋 [[Event Priorities]]
* ⚔️ [[Keep Inventory]]
* 🎏 [[Translations]]

## Developers
* 📦 [[API]] v3
* 📝 [[Data Snapshot API]]
* 📝 [[Custom Data API]]
Expand Down
2 changes: 1 addition & 1 deletion docs/Keep-Inventory.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
If your server uses the `keepInventory` gamerule, where players keep the contents of their inventory after dying, HuskSync's built-in snapshot-on-death and dead-player synchronization features can saveCause a conflict leading to synchronization issues.
If your server uses the [`keepInventory` game rule](https://minecraft.wiki/w/Keep_inventory), where players keep the contents of their inventory after dying, HuskSync's built-in snapshot-on-death and dead-player synchronization features can saveCause a conflict leading to synchronization issues.

To solve this issue, you will need to adjust three settings in your `config.yml` file, as described below.

Expand Down
80 changes: 80 additions & 0 deletions docs/Redis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Redis is a piece of server used for data caching and cross-server messaging. A Redis server running Redis v5.0+ is **required** in addition to a compatible [[Database]] to use HuskSync. There are a number of ways of [installing or getting a Redis server](#getting-a-redis-server).

For the best results, we recommend a Redis server with 1GB of RAM, hosted locally (on the same machine as all your other servers). If your setup has multiple machines, install Redis on the machine with your Velocity/BungeeCord/Waterfall proxy server and ensure lockstep syncing mode is in use.

## What is Redis?
[Redis](http://redis.io/) (**RE**mote **DI**ctionary **S**erver) is an open-source, in-memory data store server that can be used as a cache, message broker, streaming engine, or database.

HuskSync requires Redis and uses it for caching player data when they change server, and for pub/sub messaging to facilitate cross-server admin actions (such as the [`/invsee` command](Commands) to update a player's data on other servers). Check the [[FAQs]] for more details.

## Configuring
To configure Redis, navigate to your [`config.yml`](Config-File) file and modify the properties under `redis`.

<details>
<summary>Database options (config.yml)</summary>

```yaml
# Redis settings
redis:
# Specify the credentials of your Redis server here. Set "password" to '' if you don't have one
credentials:
host: localhost
port: 6379
password: ''
use_ssl: false
# Options for if you're using Redis sentinel. Don't modify this unless you know what you're doing!
sentinel:
# The master set name for the Redis sentinel.
master: ''
# List of host:port pairs
nodes: []
password: ''
```
</details>
### Credentials
Enter the hostname, port, and default user password of your Redis server.
If your Redis default user doesn't have a password, leave the password field blank (`password: ''`') and the plugin will attempt to connect without a password.

### Default user password
Depending on the version of Redis you've installed, Redis may or may not set a random default user password. Please check this in your Redis server config. You can clear the password of the default user with the below command in `redis-cli`.

```bash
requirepass thepassword
user default on nopass ~* &* +@all
```

### Using Redis Sentinel
If you're using [Redis Sentinel](https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/), set this up by filling out the properties under the `sentinel` subsection.

You'll need to supply your master set name, your sentinel password, and a list of hosts/ports in the format `host:port`.

## Getting a Redis Server
HuskSync requires a Redis server. Instructions for getting Redis on different servers are detailed below. HuskSync is tested for the official Redis package, but should also work with Redis forks or other compatible software.

For the best results, we recommend a Redis server with 1GB of RAM, hosted locally (on the same machine as all your other servers). If your setup has multiple machines, install Redis on the machine with your Velocity/BungeeCord/Waterfall proxy server and ensure lockstep syncing mode is in use.

### If you're using a Minecraft server hosting provider
Please contact your host's customer support and request Redis. You can direct them to this page if you wish. Looking for a Minecraft Server host that supports Redis? We maintain a list of [server hosts which offer Redis](https://william278.net/docs/website/redis-hosts).

If your host doesn't offer Redis, you should consider whether HuskSync is the right plugin for you. If you still want to use HuskSync, you could choose to rent a cheap Redis server externally from a provider such as DigitalOcean, though note we don't recommend this as it increases the latency between your game servers and cache, which will impact syncing performance.

### Redis on Linux or macOS
You can [install Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/) on your distribution of Linux. Redis is widely available on most package manager repositories.

You can also [install Redis](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-mac-os/) on your macOS server.

### Redis on Windows
Redis isn't officially supported on Windows, but there's a number of [unofficial ports](https://github.com/tporadowski/redis/releases) you can install which work great and run Redis as a Windows service.

You can also [install Redis via WSL](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-windows/) if you prefer.

### Pterodactyl / Pelican panel hosts
If you're self-hosting your server on a Pterodactyl or Pelican panel, you will already have Redis installed and can use this server for HuskSync, too.

If you are hosting your Redis server on the same node as your servers, you need to use `172.18.0.1` as your host (or equivalent if you changed your network settings), and bind it in the Redis config `nano /etc/redis/redis.conf`.

You will also need to uncomment the `requirepass` directive and set a password to allow outside connections, or disable `protected-mode`. Once a password is set and Redis is restarted `systemctl restart redis`, you will also need to update the password in your pterodactyl `.env` (`nano /var/www/pterodactyl/.env`) and refresh the cache `cd /var/www/pterodactyl && php artisan config:clear`.

You may also need to allow connections from your firewall depending on your Linux distribution.
Loading

0 comments on commit 2d54750

Please sign in to comment.