Skip to content

Running Pterodactyl Panel in docker containers behind Traefik reverse proxy

Notifications You must be signed in to change notification settings

Zenomac/pterodactyl-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

There’s a lack of information about setting up and running Pterodactyl Panel inside docker using Traefik as reverse proxy. This guide focuses on the fastest and easiest way to do that!

Getting Started

We’ll be using docker, docker-compose and CloudFlare for DNS challenges to generate certificates. DNS challenges allow wildcard certificates allowing you to add any subdomains on the go. If you prefer using something else, have a look at Traefik's Docs.

Requirements

Setting up Cloudflare

Change settings
Login into your CloudFlare account and navigate to the domain you'll be using for this guide. Click on SSL/TLS tab and make sure your encryption mode is set to Full. Then navigate to Edge Certificates and enable Always Use HTTPS.

Set up DNS
Navigate to DNS tab and create A record for your panel pointing to server A and second A record pointing to server B, your daemon's server. Make sure both of records are proxied through Cloudflare. (The orange cloud should be on).

Installation

Notes before installation

  • By default the guide assumes you're cloning this repository into /srv/docker/ directory!
  • It's not recommended to run panel and daemon on the same server! While this may be possible, it may cause issues.

Setting up Traefik

Clone repository
Start by cloning this repository into /srv/docker/.

git clone https://github.com/EdyTheCow/pterodactyl-docker.git

Set variables
Navigate to _base/compose/ directory, rename .env.example to .env and change these variables:

Variable Example Description
CF_API_EMAIL [email protected] Your CloudFlare's account email
CF_API_KEY - Go to your CloudFlare's profile and navigate to "API Tokens". Copy the "Global API Key"

Start traefik container

docker-compose up -d traefik

Panel - (server A)

Set variables
Navigate to panel/compose/ directory and rename .env.example to .env. The most important variables to change right now are:

Variable Example Description
PANEL_DOMAIN panel.example.com Enter a domain that's behind CloudFlare
APP_URL https://panel.example.com Same as PANEL_DOMAIN but with https:// included
MYSQL_ROOT_PASSWORD - Use a password generator to create a strong password
MYSQL_PASSWORD - Don't reuse your root's password for this, generate a new one

Initialize database container
Allow around a minute or two before starting the panel. Starting it before database is fully initialized may cause errors!

docker-compose up -d mysql

Start panel container
Allow around two minutes to be fully initialized.

docker-compose up -d panel

Start panel's worker and cron containers

docker-compose up -d worker cron

Create a new user

docker-compose run --rm panel php artisan p:user:make

Login into the panel using newly created user by navigating to domain you've set in PANEL_DOMAIN

Create a new node
Navigate to admin control panel and add a new Location. Then navigate to Nodes and create a node.

Setting Set to Description
FQDN DAEMON_DOMAIN This is your daemon's domain you'll have to specify later in guide. Example: node.example.com
Behind Proxy Behind Proxy Set this to Behind Proxy for Traefik to work properly
Daemon Port 443 Change the default port
Daemon Server File Directory DATA_DIR_DAEMON By default it should be set to /srv/docker/pterodactyl-docker/daemon/data/daemon/servers. This setting can be changed if desired and is found in daemon/compose/.env-example

Rest of the settings can be set as you desire.

Daemon - (Server B)

Follow the same steps from Setting up Traefik section on your second server for daemon.

Setting variables
Navigate to panel/daemon/ directory and rename .env.example to .env and change these variables:

Variable Example Description
DAEMON_DOMAIN node.example.com Enter a domain that's behind CloudFlare

Copying daemon's config
Navigate to PANEL_DOMAIN and find the node you created earlier. Click on Configuration tab and copy the contents into daemon/data/config/config.yml. Sometimes the remote url inside config.yml may be set to http:// change it to https://.

Start daemon container

docker-compose up -d daemon

Known issues

  • None

Credits

About

Running Pterodactyl Panel in docker containers behind Traefik reverse proxy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published