Skip to content

Instantly share code, notes, and snippets.

@RobinBeismann
Created September 27, 2022 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinBeismann/25de1fe5466d03512362616a75de9440 to your computer and use it in GitHub Desktop.
Save RobinBeismann/25de1fe5466d03512362616a75de9440 to your computer and use it in GitHub Desktop.
Pterodactyl via docker-compose
# Docker compose container prefix
COMPOSE_PROJECT_NAME=pterodactyl
# Data directory
DATA_DIR=./data
# Full path to wings volumes data
# NOTE: This path has to match the "Daemon Server File Directory" path you apply when creating a node in the panel!
# The default setting is "/var/lib/pterodactyl/", however this can be changed to something like:
# "/srv/docker/docker-pterodactyl/data/wings/lib/volumes" in order to store everything in one place, just make sure the paths in panel and here match!
SERVERS_DATA_FULL_PATH=/srv/pterodactyl/wings/serverdata
# Wings domain
WINGS_DOMAIN=wing1.contoso.com
# Panel domain
PANEL_DOMAIN=pt.contoso.com
version: '3.8'
x-common:
database:
&db-environment
# Do not remove the "&db-password" from the end of the line below, it is important
# for Panel functionality.
MYSQL_PASSWORD: &db-password "<password>"
MYSQL_ROOT_PASSWORD: "<password>"
panel:
&panel-environment
APP_URL: "https://pt.contoso.com"
# A list of valid timezones can be found here: http://php.net/manual/en/timezones.php
APP_TIMEZONE: "Europe/Berlin"
APP_SERVICE_AUTHOR: "dinosaurs@contoso.com"
mail:
&mail-environment
MAIL_FROM: "dodo@contoso.com"
MAIL_DRIVER: "smtp"
MAIL_HOST: "smtp"
MAIL_PORT: "25"
MAIL_USERNAME: ""
MAIL_PASSWORD: ""
MAIL_ENCRYPTION: "false"
services:
database:
image: library/mysql:8.0
restart: always
networks:
- local
command: --default-authentication-plugin=mysql_native_password
volumes:
- "${DATA_DIR}/database:/var/lib/mysql"
environment:
<<: *db-environment
MYSQL_DATABASE: "panel"
MYSQL_USER: "pterodactyl"
cache:
image: redis:alpine
restart: always
networks:
- local
panel:
image: ghcr.io/pterodactyl/panel:v1.9.1
restart: always
networks:
- gateway
- local
links:
- database
- cache
volumes:
- "${DATA_DIR}/panel/var/:/app/var/"
- "${DATA_DIR}/panel/logs/:/app/storage/logs"
- "${DATA_DIR}/panel/nginx/:/etc/nginx/conf.d/"
environment:
<<: [*panel-environment, *mail-environment]
DB_PASSWORD: *db-password
APP_ENV: "production"
APP_ENVIRONMENT_ONLY: "false"
CACHE_DRIVER: "redis"
SESSION_DRIVER: "redis"
QUEUE_DRIVER: "redis"
REDIS_HOST: "cache"
DB_HOST: "database"
TRUSTED_PROXIES: "*"
labels:
# Docker Gateway settings
- 'traefik.enable=true'
- "traefik.docker.network=gateway"
# HTTPS
- "traefik.http.routers.pterodactyl_panel-https.entrypoints=websecure"
- "traefik.http.routers.pterodactyl_panel-https.rule=Host(`${PANEL_DOMAIN}`)"
- "traefik.http.services.pterodactyl_panel-https.loadbalancer.server.port=80"
- "traefik.http.routers.pterodactyl_panel-https.tls.certresolver=le_production"
wings:
image: ghcr.io/pterodactyl/wings:v1.7.0
env_file:
- .env
restart: always
networks:
gateway:
wings0:
ports:
- "2022:2022"
tty: true
stdin_open: true
environment:
TZ: "Europe/Berlin"
WINGS_UID: 988
WINGS_GID: 988
WINGS_USERNAME: pterodactyl
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/lib/docker/containers/:/var/lib/docker/containers/"
- "/tmp/pterodactyl/:/tmp/pterodactyl/"
#- "/etc/ssl/certs:/etc/ssl/certs:ro"
- "${DATA_DIR}/wings/etc/:/etc/pterodactyl/"
- "${DATA_DIR}/wings/logs:/var/log/pterodactyl/"
- "${SERVERS_DATA_FULL_PATH}:${SERVERS_DATA_FULL_PATH}"
- "/etc/hosts:/etc/hosts"
labels:
# Docker Gateway settings
- 'traefik.enable=true'
- "traefik.docker.network=gateway"
# Middlewares
- "traefik.http.middlewares.pterodactyl_wings-headers.headers.customresponseheaders.Access-Control-Allow-Methods=GET,POST,PUT,PATCH,DELETE,OPTIONS"
- "traefik.http.middlewares.pterodactyl_wings-headers.headers.customresponseheaders.Access-Control-Allow-Credentials=true"
- "traefik.http.middlewares.pterodactyl_wings-headers.headers.customresponseheaders.Access-Control-Allow-Origin=https://${PANEL_DOMAIN}"
# HTTPS
- "traefik.http.routers.pterodactyl_wings-https.entrypoints=websecure"
- "traefik.http.routers.pterodactyl_wings-https.rule=Host(`${WINGS_DOMAIN}`)"
- "traefik.http.routers.pterodactyl_wings-https.tls=true"
- "traefik.http.routers.pterodactyl_wings-https.tls.certresolver=le_production"
- "traefik.http.routers.pterodactyl_wings-https.middlewares=pterodactyl_wings-headers"
- "traefik.http.services.pterodactyl_wings-https.loadbalancer.server.port=443"
networks:
gateway:
external: true
wings0:
name: wings0
driver: bridge
ipam:
config:
- subnet: "10.150.0.0/16"
driver_opts:
com.docker.network.bridge.name: wings0
local:
external: false
default:
ipam:
config:
- subnet: 172.20.0.0/16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment