From 725bfbad130990c1a51cf915ddcfb1fd6d833028 Mon Sep 17 00:00:00 2001 From: Risto Lahtela Date: Thu, 12 Dec 2019 19:24:43 +0200 Subject: [PATCH] Updated Bungee Set Up (markdown) --- Bungee-Set-Up.md | 294 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 237 insertions(+), 57 deletions(-) diff --git a/Bungee-Set-Up.md b/Bungee-Set-Up.md index ce1e718..3ba94d5 100644 --- a/Bungee-Set-Up.md +++ b/Bungee-Set-Up.md @@ -1,99 +1,279 @@ -![Plan Header](http://puu.sh/AXSg7/5f2f78c06c.jpg) -# Bungee/Velocity Set-Up +![Plan Header](https://puu.sh/AXSg7/5f2f78c06c.jpg) -This is the Set-Up tutorial for Networks. If you're installing the plugin on a single server refer to [[Bukkit Set-Up]] +# Network Set-up -## Steps +This is the set-up tutorial for proxy platforms; **BungeeCord** & **Velocity** based servers. -1. Create a MySQL Database for Plan -2. Install Plan on the Bungee server -3. Install Plan on the Bukkit servers +If you have a single game server, use this tutorial: [Server Set-up](https://github.com/plan-player-analytics/Plan/wiki/Bukkit-Set-Up) -## 1. Create a MySQL Database for Plan -Create a new database in your MySQL with `CREATE DATABASE _dbname_` +These icons are used to aid during installation -Make sure to `GRANT PRIVILEGES` to the MySQL user for the new database. +💭 Question about possible issues (Someone has had these before) +📢 Important note about the settings being changed +🚧 Additional steps for some users +💡 Extra stuff -> Plan uses a plan_ prefix on all table names, so you can use an existing database. +---- -## 2. Install Plan on the Bungee server +## ✔️ Requirements -Place the .jar in the plugins folder and restart the server +- An unused open port for Plan webserver on your Minecraft server machine +- MySQL Database -### 2.1 Change the config settings: +> 💭 **I'm using a host, how do I get an open port?** +> +> Some hosts offer a port range that contains open ports, while others need you to contact them to have a port opened. +> If you have access to the firewall, you can open the port from there directly. +> +> Opening port on a firewall is explained in this tutorial. -#### 2.1.1 Server.IP +> 💭 **I don't have an open port, what now?** +> +> You can try [using an existing webserver](https://github.com/plan-player-analytics/Plan/wiki/External-WebServer-Use) on the same machine. Please note that the support for this is limited. -Change this to the Address or IP used to connect to your bungee server directly (Without port) - For example `play.exampleserver.com` or `123.123.4.5` -![1](http://puu.sh/zu9tA/15410504a1.png) +---- -#### 2.1.2 Database Settings +## 🚩 Installation Goals -Change these to the settings of the Database you just created. -![2](http://puu.sh/zu9x5/9ccfb5428b.png) +Here are the goals the tutorial aims to guide you through. +At the end of this tutorial you will have -In case Plan starts with MySQL-error about unrecognized timezone, [set up your default timezone for MySQL](https://stackoverflow.com/questions/26515700/mysql-jdbc-driver-5-1-33-time-zone-issue/44720416#44720416) +- .. MySQL Database for Plan +- .. access to the webserver of Plan (Running on the plugin) + - .. an open port for the Plan webserver. +- .. connected other Plan instances on game servers to the same database. -#### 2.1.3 WebServer.Port +Additionally you might have -Plan has a built in webserver - **extra web hosting provider is not required** if you have an open port on your server. On Bungee/Velocity only one webserver is required. +- .. if using Pterodactyl Panel, allocated a port for Plan +- .. if using Azure or similar, enabled port forwarding -Change to a suitable port and open the port in the firewall. -![3](http://puu.sh/zu9yT/40433d2af6.png) +After installing, it is also possible to -- [How to open a port on the firewall](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/Bukkit-Set-Up#step-3-open-port-from-firewall) +- .. set up Login and HTTPS on Plan webserver -> **Pterodactyl users** -> The port must be allocated to be accessible, see [Possible Additional Setup section](https://github.com/plan-player-analytics/Plan/wiki/Bungee-Set-Up#pterodactyl-users) +---- -### 2.2 Reload the plugin +## Step 0: Prepare -`/planbungee reload` +Download `Plan.jar` - If you don't have one get one from [Releases](https://github.com/plan-player-analytics/Plan/releases) -> /planbungee reload is available even if plugin fails to enable so that you can change the config settings easily. +## Step 1: Install -## 3. Install Plan on the Bukkit/Sponge servers +Place Plan.jar to the plugin directory (`/plugins/`) and restart the server. -**NOTE: Do not copy-paste ServerInfoFile.yml**: This file stores ServerUUID which differentiates servers from each other. Same ServerUUID will lead to Bungee sending same config settings to two servers! +`Plan/config.yml` should appear in the plugin directory. -1. Place the .jar to the plugins folder and restart the bukkit server. -2. Set the Database settings to the same MySQL Bungee is using (Also change `Database.Type` to `MYSQL`) -3. Disable the Plan webserver on this server with `Webserver.Disable_Webserver` setting -4. `plan reload` on the server +Set `Server.IP` setting in the Plan config to point to your server machine: +```yml +Server: + IP: play.exampleserver.com +``` -In case of a set-up difficulties you can join discord for support: -[Discord Support](https://discord.gg/yXKmjzT) +> 📢 **Important** +> +> Plan does not enable completely at this point. `Server.IP` setting and MySQL are required. -## 4. (Optional) Protect the Website with a Login Prompt +## Step 2: Create a MySQL Database for Plan -In order to enable user authentication, HTTPS set up is required. -This requires a Certificate to be installed in a Java Keystore: +Plan does not create a new database automatically, so you need to either create or use an existing one. -- [[How to set up SSL Certificate|SSL Certificate (HTTPS) Set-Up]] +- Open your MySQL client or panel and connect to the MySQL. +- Find 'Execute SQL' or similar, where you can execute SQL statements. +- Create a new database with `CREATE DATABASE CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;` +- Give the MySQL user privileges to the table with a `GRANT` statement. -You can use the same Keystore on all servers. +> 💭 **Should I give all privileges?** +> +> [MySQL: Privilege-Granting Guidelines](https://dev.mysql.com/doc/refman/5.6/en/privileges-provided.html#privileges-provided-guidelines) +> +> If you don't want to give all privileges, Plan needs at least the following: `ALTER, CREATE, CREATE_TEMPORARY_TABLES, CREATE_VIEW, DELETE, DROP, INDEX, INSERT, LOCK_TABLES, REFERENCES, SELECT, SHOW_VIEW, UPDATE` -### For further configuration refer to: -- [[Bungee Configuration]] -- [[Bukkit Configuration]] -- [Commands & Permissions](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/Commands-%26-Permissions) +- Set `Database.MySQL` settings appropriately in the Plan config: -## Possible additional Set up +```yml +Database: + MySQL: + Address: localhost + Port: 3306 + User: + Password: + Database: + Launch_options: "?rewriteBatchedStatements=true&useSSL=false" +``` -### Pterodactyl users +- Reload the plugin with `planbungee/planvelocity reload` + +> 💡 **Tip** +> +> Once Plan has partially enabled you can reload it with `planbungee reload` or `planvelocity reload` without restarting the server. (Note that replacing Plan.jar requires a restart.) + + +#### ⚠️ If you get MySQL time zone error on start-up + +Example of the error: +`Failed to initialize pool: The server time zone value 'unknown' is unrecognized or represents more than one time zone.` +- Set up [default time zone for MySQL](https://stackoverflow.com/questions/26515700/mysql-jdbc-driver-5-1-33-time-zone-issue/44720416#44720416) +- or add `&serverTimezone=UTC` to `Database.MySQL.Launch_options` + +## Step 3: Change Webserver Port + +> 💡 **Tip** +> +> Plan has a built in webserver. +> Extra web-hosting is not required if you have an open port. + +Default Webserver Port is **8804**. +If 8804 is not available or you want to use another port, change `Webserver.Port` to another value in the Plan config: + +```yml +Webserver: + Port: 8804 +``` + +Reload the plugin after changing the port with `/planbungee reload` to apply changes. + +> 🚧 **Pterodactyl Panel Users** +> +> Port needs to be allocated before it can be used, see [this section](https://github.com/plan-player-analytics/Plan/wiki/Bungee-Set-Up#pterodactyl-panel) to do so. + +> 💭 **Failed to bind port, what now?** +> +> The port is likely in use by another program, try using another port. + +## Step 4: Open Port from Firewall + +Open the port you chose in Step 3 by using your firewall software. If your host has given you an open port you can skip this step. + +- [Windows Server 2012](https://support.rackspace.com/how-to/managing-the-windows-server-2012-firewall/) +- [Windows 10](http://www.tomshardware.co.uk/faq/id-3114787/open-firewall-ports-windows.html) +- [Linux/Debian iptables](https://wiki.debian.org/iptables) +- [Linux/Debian/Ubuntu uwf](https://wiki.debian.org/Uncomplicated%20Firewall%20%28ufw%29) + +> 💡 **Tip** +> +> You can use this tool to test if the port is open: +> https://www.yougetsignal.com/tools/open-ports/ + +> 🚧 **Azure Users** +> +> Make sure to [enable port forwarding on Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal) + +## Step 5: Check that the address is correct + +Now Plan should have enabled. +Find the address in the Plan enable log on the console. +```log +[INFO]: [Plan] Webserver running on PORT #### (
) +``` + + +You can change the address with `Webserver.Alternative_IP` settings. + +Point the address to your server: +```yml +Webserver: + Alternative_IP: true + Address: "play.address.net:%port%" +``` + +> 📢 **Important** +> +> Don't replace `%port%` in the address with any port, it is replaced with `Webserver.Port` by Plan automatically. Make sure to change `Alternative_IP` to `true`. + +> 💡 **Advanced Tip** +> +> If you don't want to have `:PORT` at the end of the address, you can use a reverse-proxy like [Nginx](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) or [Apache](https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html). + +## Step 6: Try to access the page + +If you didn't reload Plan after the last step, do so now with `/plan reload`. + +Find the address in the Plan enable log on the console like in the previous step, and try to access it with your browser. + +> 💭 **Why can't I access the page?** +> +> There can be multiple different causes depending on the error the browser gives you. +> +> - `ERR_CONNECTION_REFUSED` or `ERR_TIMED_OUT`: The browser could not connect to the address or port. Make sure you got the address right and check that the port is open (Redo steps 4 and 5 if necessary). +> - `ERR_NAME_NOT_RESOLVED`: The address could not be resolved, this is a problem with DNS. Set up DNS A-record to point to your server machine or change the address to something else (Step 5) +> +> If these steps do not solve the issue, you can [ask for support on Discord](http://support.playeranalytics.net) + +## Step 7: Set-up Plan on game servers + +1. Place Plan.jar to the plugin folder and restart the game server (Bukkit / Sponge / Nukkit) + +2. Set the Database settings in the Plan config on that server to match the proxy (Bungee / Velocity) + +```yml +Database: + Type: MySQL + MySQL: + Address: localhost + Port: 3306 + User: + Password: + Database: + Launch_options: "?rewriteBatchedStatements=true&useSSL=false" +``` + +> 📢 **Important** +> +> Note that on game servers `Database.Type` has to be set to `MySQL` + +> 📢 **Important** +> +> The MySQL user might need privileges for external access if it is located on a different machine. + +3. Disable Plan webserver on this server by setting `Webserver.Disable_Webserver` to `true` + +```yml +Webserver: + Disable_Webserver: true +``` + +4. `plan reload` to apply changes. Plan should detect proxy-server information in the database. + +> 💡 **Tip** +> You can set a name for the server with `Server.Name` setting. + +---- + +Now you should have Plan gathering lots of useful data and be able to access all servers through the Plan webserver on Bungee / Velocity. + +Next section is about additional set-up + +---- + +## (Optional) Protect the Website with a Login Prompt + +In order to enable user authentication, HTTPS set up is required. +This requires a Certificate to be installed: + +- [How to set up SSL Certificate](https://github.com/plan-player-analytics/Plan/wiki/SSL-Certificate-%28HTTPS%29-Set-Up) + +How to create users is also covered by the linked tutorial. + +> 💭 **I set this up correctly, why can't I access the page?** +> +> Make sure that the address has `https://` in front of it. +> Plan doesn't upgrade http traffic to https because it only has one port. + +---- + +# Extra (necessary) Set-up Section + +## Pterodactyl Panel On Pterodactyl the port Plan runs on needs to be allocated. - Go to node category of your panel (http(s)://panel.domain.com`/admin/nodes`) & create a new node if you don't have one. - Navigate to The node > `Allocation` -- On the right side in `Assign New Allocations`, put your IP Address (Alias is not necessary) & fill in the port(s) you wish to reserve (for all servers). +- On the right side in `Assign New Allocations`, put your IP Address (Alias is not necessary) & fill in the port(s) you wish to reserve. - Next, Choose a server from http(s)://panel.domain.fr/`admin/servers` & navigate to `Build Configuration` > `Allocation Management` - Click on `Assign Additional Ports` and choose what port(s) you wish to assign to this server. Click `Update Build Configuration` to save changes. -After the steps change `Alternative_IP` settings in Plan config to point to the machine Pterodactyl is running on. +After the steps change `Alternative_IP` settings in Plan config to point to the machine Pterodactyl is running on (in step 4). -Only Bungee WebServer needs to be accessible from outside the machine. - -### Azure or similar service - -Make sure to [enable port forwarding on Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal) \ No newline at end of file +[Back to step 3](https://github.com/plan-player-analytics/Plan/wiki/Bungee-Set-Up#step-3-change-webserver-port) \ No newline at end of file