Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional allocations #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 39 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

## WHMCS
WHMCS Module for the [WISP Panel](https://wisp.gg/).

## Configuration support
Please use the [WISP Discord](https://wisp.gg/discord) for configuration related support instead of GitHub issues.

## Installation
[Video Tutorial](https://www.youtube.com/watch?v=wURpRD9vfj4)
[Video Tutorial](https://www.youtube.com/watch?v=wURpRD9vfj4)

1. Download/Git clone this repository.
1. Download/Git clone this repository.
2. Move the ``wisp/`` folder into ``<path to whmcs>/modules/servers/``.
3. Create API Credentials with these permissions: ![Image](https://owo.whats-th.is/fa1eee.png)
3. Create API Credentials with these permissions: ![Image](https://i.imgur.com/nzo0u8C.png)
4. In WHMCS navigate to Setup > Products/Services > Servers
5. Create new server, fill the name with anything you want, hostname as the url to the panel. For example: ``my-panel.panel.gg``
6. Change Server Type to WISP, leave username empty, fill the password field with your generated API Key.
Expand All @@ -24,24 +25,25 @@ Please use the [WISP Discord](https://wisp.gg/discord) for configuration related
## Credits
[Dane](https://github.com/DaneEveritt) and [everyone else](https://github.com/Pterodactyl/Panel/graphs/contributors) involved in development of the Pterodactyl Panel.
[death-droid](https://github.com/death-droid) for the original WHMCS module.
[snags141](https://github.com/snags141/) for additional allocation support.

# FAQ

## Migrating from pterodactyl's module
This module is backwards compatible and requires no changing other than switching to this module.

## Overwriting values through configurable options
Overwriting values can be done through either Configurable Options or Custom Fields.
Overwriting values can be done through either Configurable Options or Custom Fields.

Their name should be exactly what you want to overwrite.
dedicated_ip => Will overwrite dedicated_ip if its ticked or not.
Valid options: ``server_name, memory, swap, io, cpu, disk, nest_id, egg_id, pack_id, location_id, dedicated_ip, port_range, image, startup, databases, allocations, oom_disabled, force_outgoing_ip, username, backup_megabytes_limit``
Valid options: ``server_name, memory, swap, io, cpu, disk, nest_id, egg_id, pack_id, location_id, dedicated_ip, port_range, image, startup, databases, allocations, oom_disabled, username, backup_megabytes_limit``

This also works for any name of environment variable:
Player Slots => Will overwrite the environment variable named "Player Slots" to its value.
Player Slots => Will overwrite the environment variable named "Player Slots" to its value.

Useful trick: You can use the | seperator to change the display name of the variable like this:
dedicated_ip|Dedicated IP => Will be displayed as "Dedicated IP" but will work correctly.
Useful trick: You can use the | separator to change the display name of the variable like this:
dedicated_ip|Dedicated IP => Will be displayed as "Dedicated IP" but will work correctly.

[Sample configuration for configurable memory](https://owo.whats-th.is/85JwhVX.png)

Expand All @@ -52,7 +54,35 @@ This can be caused from any of the following: Wrong location, not enough disk sp
The customer gets an email from the panel to setup their account (incl. password) if they didn't have an account before. Otherwise they should be able to use their existing credentials.

## My game requires multiple ports allocated.
Currently, this isn't possible with this module but is planned.
Configure the "**Additional Ports**" option in the module settings.
It expects a valid JSON string consisting of the parameter name or NONE, and a number representing a port as a numeric offset from the first available allocation.
E.g: If you enter `{"1":"NONE", "2":"NONE", "4":"NONE"}` and the first available port happens to be 25565, you'll get as additional allocations:
* 25566 (First Port + 1)
* 25567 (First Port +2)
* 25569 (First Port +4)

(If they're available)

Note: I this option is set, it will override anything specified under "port_range" - Use one or the other, not both.

You'll also want to configure "**Additional Port Failure Mode**".
This determines what the module should do if there are no allocations available on any of the defined nodes.
* "Continue" - Continues creating the server but only with one allocation, whatever is available at the time. You'll need to manually go in after the server gets created to assign additional ports as required.
* "Stop" - Stops the server creation and raises an error.

## How to assign additional allocations to server parameters like RCON_PORT
See the table below for "Additional Ports" example values.
*These examples assume your WISP node has allocations available from 1000-2000.*

| Game | Required Ports |Additional Ports Example | Ports Assigned |
| ------------ | ------------ | ------------ | ------------ |
| Rust | Game port and RCON port | `{"1":"RCON_PORT"}` | Game Port: 1000, RCON_PORT: 1001|
| Arma 3 | Game port, Game port +1 for Steam Query, Game port + 2 for Steam Port, and Game port +4 for BattleEye | `{"1":"NONE", "2":"NONE", "4":"NONE"}` | Game Port: 1000, Additional Ports: 1001, 1002, 1004 |
| Unturned | Game port, Game port +1 and Game port +2 | `{"1":"NONE", "2":"NONE"}` | Game Port: 1000, Additional Ports: 1001, 1002 |
| Project Zomboid | Game Port, Steam port and an additional port for every player. Let's say we want 10 additional ports for 10 players. | `{"1":"STEAM_PORT", 2":"NONE", "3":"NONE", "4":"NONE", "5":"NONE", "6":"NONE", "7":"NONE", "8":"NONE", "9":"NONE", "10":"NONE", "11":"NONE"}` | Game Port: 1000, Steam Port: 1001, Additional Ports: 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011|

**What does "NONE" mean?**
"NONE" means you want to assign the additional port to the server, but it doesn't need to be assigned to a server parameter. If instead you want to add a +1 port and assign it to the parameter "RCON_PORT" then you'd use `{"1":"RCON_PORT"}` for example.

## How to enable module debug log
1. In WHMCS 7 or below navigate to Utilities > Logs > Module Log. For WHMCS 8.x navigate to System Logs > Module Log in the left sidebar.
Expand Down
Loading