# Creating a Wings node

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>Time Required</td><td>20 Minutes</td></tr><tr><td>Difficulty</td><td>Moderate</td></tr></tbody></table>

{% hint style="info" %}
I am installing Wings on my test VM, 'Basil', for writing this documentation. Any references to Basil will need to be changed to your server. Once this documentation has been finalized, Wings will be deleted from Basil.
{% endhint %}

## Installing Wings and set up Reverse Proxy

### Configure the 'Pterodactyl Wings' Portainer stack

Refer to the [Portainer](https://github.com/trentnbauer/agg-docs/blob/main/guides/pterodactyl/broken-reference/README.md) and [GitOps](https://github.com/trentnbauer/agg-docs/blob/main/guides/pterodactyl/broken-reference/README.md) documentation for configuring a new Portainer stack using the AGG Pterodactyl Wings Docker Compose file

* Name the stack something simple, like 'wings'
* Ensure you fill all the variables from the ENV file

{% @github-files/github-code-block url="<https://github.com/trentnbauer/agg/blob/main/docker-compose/pterodactyl-wings.yml>" %}

{% code title=".ENV file" %}

```editorconfig
# --- General Settings ---
TZ=UTC

# --- Networking Ports ---
PORT=443
PORT_SFTP=2022
PORT_DB=3306
# This should be your internal DNS / IP address
HOSTNAME=localhost

# --- Database Credentials ---
# Replace these with strong passwords
SQL_PASS=
SQL_PASS_ROOT=

# --- Cloudflare Tunnel Configuration ---
CFDOMAIN=example.com
CFSUBDOMAIN=wings.
CFPOLICY=bypass
CFACCESSNAME=Pterodactyl Wings
CFDURATION=8h
```

{% endcode %}

### Allow Ports through the Firewall

1. SSH into your server
2. Allow SSH and enable the firewall with the below commands

   ```
   ufw allow ssh
   ufw enable
   ```

   \
   \&#xNAN;*This is to increase security on this hardware as a port forward is required*
3. Run the command `ufw allow PORT`, replacing PORT with what you set for PORT and PORT\_SFTP above, eg;

   <pre class="language-sh"><code class="lang-sh"><strong>ufw allow 2022
   </strong></code></pre>

### Test the reverse proxy works

{% hint style="info" %}
As you have configured the Panel using Dockflare, you do not need to take any additional steps for this.
{% endhint %}

Browse to the ${SUBDOMAIN}${DOMAIN} you set in your [.env file](/guides/installation-guides/pterodactyl/creating-a-new-panel.md#setting-up-the-portainer-stack) and ensure the page loads - you should see something similar to below. If it was freshly created, you may need to wait some time for DNS to sync.

```
{"error":"The required authorization heads were not present in the request."}
```

## Configure Panel & Wings

### Set up a Node on the Panel

1. Log into Pterodactyl with an administrator account
2. Click on the Settings cog in the top right
3. Click on Nodes
4. Click on Create New in the top right and
   * Name your Node (I normally give them the same name as the server, or node1)
   * Provide the FQDN of your Node (this is the externally available reverse proxy address configured here [#configure-the-reverse-proxy](#configure-the-reverse-proxy "mention"))
   * Tick 'Use SSL Connection'
   * Tick 'Behind Proxy'
   * Provide RAM & RAM over allocation of the machine or VM
   * Provide the disk space & over allocation of the machine or VM
   * Set your Daemon port to 443 (As Cloudflare uses 443 for its proxy)
   * Click on 'Create Node'

     <figure><img src="/files/O9BRuswpjyTGjDyJWFGj" alt=""><figcaption></figcaption></figure>

### Upload Configuration file to Wings

1. In Pterodactyl, click on 'Nodes' on the left
2. You should see your new Node, with a red heart

   <figure><img src="/files/YjECS8il6xZjoYzcaoWf" alt=""><figcaption></figcaption></figure>
3. Click on your new node, then the Configuration tab and confirm that the highlighted lines are the same as mine

   <figure><img src="/files/A84z72mV1heG28aCgBYh" alt=""><figcaption><p><em>I would also recommend changing the upload_limit to '1024'</em></p></figcaption></figure>

   *If the highlighted settings are NOT the same, you made a mistake in step* [#set-up-a-node-on-the-panel](#set-up-a-node-on-the-panel "mention")*. Delete the node and start back there*
4. Copy the contents of the file and save it as 'config.yml'

{% tabs %}
{% tab title="Using Portainer Edge Agent" %}

1. Log into Portainer and click on the Wings host
2. Click on 'Stacks' and select the 'wings' stack
3. Click on 'Stop stack'
4. Click on 'Volumes'
5. Locate the Wings 'config' volume - it will be named after your stack (eg wings\_config) and click on Browse
6. Click on the Upload button, then select your config.yml file
   {% endtab %}

{% tab title="Not using Edge Agent" %}

1. SSH onto your Wings Node
2. Run the command `docker volume list` and locate the Wings Config volume
3. Run the command docker `volume inspect <VolumeNameHere>` to get the mountpath of the volume
4. CD to the mountpath
5. run command `nano config.yml` and paste in the contents of the config file
6. Press `CTRL + O`, then `Enter` to save the config file
   {% endtab %}
   {% endtabs %}

### Restart the container to load the config file

1. Click on Stacks and open your Wings stack
2. Restart the stack and wait 30 seconds
3. Refresh the Pterodactyl Nodes page and it should now be connected

   <figure><img src="/files/HIhZ6QWPTZjjEbgOVkyM" alt=""><figcaption></figcaption></figure>

### Assigning Ports to the Node

1. Click on your new node and click the 'Allocations' tab
2. On the right hand panel, input
   1. IP address: 0.0.0.0
   2. IP Alias: Your domain or subdomain that points to your servers public IP
   3. Ports: The port range you will forward to this VM (I've chosen ports 500-600)\\

      <figure><img src="/files/As31FrI615wxaZsvZbK3" alt=""><figcaption></figcaption></figure>
   4. Run the `ufw allow` command to allow these ports through the firewall. You can use a : to allow a range, such as 500:600

### Port Forward

You will now need to port forward the chosen ports to your server.

Firstly, have a look at your modem / router. You will need to take note of

* Brand
* Model number or part number

Port forwarding is particularly tricky for beginners, mostly because every device is slightly different.

You'll need to do some Googling and / or Youtube'ing on how to port forward with your model router / modem.

## Why do I do it this way?

My assumption here is that the Pterodactyl dev's want us to set up and use SSL certs on the Wings host and make it publicly available without a proxy. I can't be bothered generating certs and managing their expirations in my Homelab. My configuration offloads the certificate management to Cloudflare (or any other reverse proxy - I used to use NGINX Proxy Manager for this) which means that I don't need to worry about cycling certificates on the host / containers themselves.

Offloading this task to the Cloudflare tunnel does create a couple of potential issues,

* If the tunnel is down / crashes, the Panel can't talk Wings
* If your hosting the Panel and Wings in your homelab, the connection is reliant on the internet being up
* Cloudflare outages may break the Panel / Wings communication
* Pterodactyl Discord does not provide support for proxied panel/wings connections

{% hint style="info" %}
I don't have SFTP working with this set up, though I imagine changing the SFTP port and forwarding that port to the host, then connecting via `ddns_address:port` would work.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.trentbauer.com/guides/installation-guides/pterodactyl/creating-a-new-wings-node.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
