diff --git a/templates/compose/pterodactyl-with-wings.yaml b/templates/compose/pterodactyl-with-wings.yaml new file mode 100644 index 000000000..bd0c07cca --- /dev/null +++ b/templates/compose/pterodactyl-with-wings.yaml @@ -0,0 +1,140 @@ +# documentation: https://pterodactyl.io/ +# slogan: Pterodactyl is a free, open-source game server management panel +# tags: game, game server, management, panel, minecraft +# logo: svgs/pterodactyl.png +# port: 80, 8443 + +services: + mariadb: + image: mariadb:10.5 + healthcheck: + test: + ["CMD-SHELL", "healthcheck.sh --connect --innodb_initialized || exit 1"] + start_period: 10s + interval: 10s + timeout: 1s + retries: 3 + environment: + - MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_MYSQLROOT + - MYSQL_DATABASE=pterodactyl-db + - MYSQL_USER=$SERVICE_USER_MYSQL + - MYSQL_PASSWORD=$SERVICE_PASSWORD_MYSQL + volumes: + - pterodactyl-db:/var/lib/mysql + + redis: + image: redis:alpine + healthcheck: + test: ["CMD-SHELL", "redis-cli ping || exit 1"] + interval: 10s + timeout: 1s + retries: 3 + + pterodactyl: + image: ghcr.io/pterodactyl/panel:latest + volumes: + - "panel-var:/app/var/" + - "panel-nginx:/etc/nginx/http.d/" + - "panel-certs:/etc/letsencrypt/" + - type: bind + source: ./etc/entrypoint.sh + target: /entrypoint.sh + mode: "0755" + content: | + #!/bin/sh + set -e + + echo "Setting logs permissions..." + chown -R nginx: /app/storage/logs/ + + USER_EXISTS=$(php artisan tinker --no-ansi --execute='echo \Pterodactyl\Models\User::where("email", "'"$ADMIN_EMAIL"'")->exists() ? "1" : "0";') + + if [ "$USER_EXISTS" = "0" ]; then + echo "Admin User does not exist, creating user now." + php artisan p:user:make --no-interaction \ + --admin=1 \ + --email="$ADMIN_EMAIL" \ + --username="$ADMIN_USERNAME" \ + --name-first="$ADMIN_FIRSTNAME" \ + --name-last="$ADMIN_LASTNAME" \ + --password="$ADMIN_PASSWORD" + echo "Admin user created successfully!" + else + echo "Admin User already exists, skipping creation." + fi + + exec supervisord --nodaemon + command: ["/entrypoint.sh"] + healthcheck: + test: ["CMD-SHELL", "curl -sf http://localhost:80 || exit 1"] + interval: 10s + timeout: 1s + retries: 3 + environment: + - SERVICE_FQDN_PTERODACTYL_80 + - ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com} + - ADMIN_USERNAME=${SERVICE_USER_ADMIN} + - ADMIN_FIRSTNAME=${ADMIN_FIRSTNAME:-Admin} + - ADMIN_LASTNAME=${ADMIN_LASTNAME:-User} + - ADMIN_PASSWORD=${SERVICE_PASSWORD_ADMIN} + - PTERODACTYL_HTTPS=${PTERODACTYL_HTTPS:-false} + - APP_ENV=production + - APP_ENVIRONMENT_ONLY=false + - APP_URL=$SERVICE_FQDN_PTERODACTYL + - APP_TIMEZONE=${TIMEZONE:-UTC} + - APP_SERVICE_AUTHOR=${APP_SERVICE_AUTHOR:-author@example.com} + - LOG_LEVEL=${LOG_LEVEL:-debug} + - CACHE_DRIVER=redis + - SESSION_DRIVER=redis + - QUEUE_DRIVER=redis + - REDIS_HOST=redis + - DB_DATABASE=pterodactyl-db + - DB_USERNAME=$SERVICE_USER_MYSQL + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_PASSWORD=$SERVICE_PASSWORD_MYSQL + - MAIL_FROM=$MAIL_FROM + - MAIL_DRIVER=$MAIL_DRIVER + - MAIL_HOST=$MAIL_HOST + - MAIL_PORT=$MAIL_PORT + - MAIL_USERNAME=$MAIL_USERNAME + - MAIL_PASSWORD=$MAIL_PASSWORD + - MAIL_ENCRYPTION=$MAIL_ENCRYPTION + + wings: + image: "ghcr.io/pterodactyl/wings:latest" + environment: + - SERVICE_FQDN_WINGS_8443 + - "TZ=${TIMEZONE:-UTC}" + - WINGS_USERNAME=$SERVICE_USER_WINGS + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + - "/var/lib/docker/containers/:/var/lib/docker/containers/" + - "/var/lib/pterodactyl/volumes:/var/lib/pterodactyl/volumes" + - "/tmp/pterodactyl:/tmp/pterodactyl" + - wings_lib:/var/lib/pterodactyl/ + - wings_logs:/var/log/pterodactyl/ + - type: bind + source: ./etc/config.yml + target: /etc/pterodactyl/config.yml + content: | + debug: false + uuid: ReplaceConfig + token_id: ReplaceConfig + token: ReplaceConfig + api: + host: 0.0.0.0 + port: 8443 # Warning, panel must have 443 as daemon port, while here it should should be 8443, FQDN in Coolify for this service should be https://*:8443 + ssl: + enabled: false + cert: ReplaceConfig + key: ReplaceConfig + upload_limit: 100 + system: + data: /var/lib/pterodactyl/volumes + sftp: + bind_port: 2022 + allowed_mounts: [] + remote: '' + ports: + - '2022:2022' \ No newline at end of file diff --git a/templates/compose/pterodactyl.yaml b/templates/compose/pterodactyl.yaml index ea64de47a..32939ad7e 100644 --- a/templates/compose/pterodactyl.yaml +++ b/templates/compose/pterodactyl.yaml @@ -1,4 +1,3 @@ -# ignore: true # documentation: https://pterodactyl.io/ # slogan: Pterodactyl is a free, open-source game server management panel # tags: game, game server, management, panel, minecraft @@ -8,8 +7,6 @@ services: mariadb: image: mariadb:10.5 - restart: unless-stopped - command: --default-authentication-plugin=mysql_native_password healthcheck: test: ["CMD-SHELL", "healthcheck.sh --connect --innodb_initialized || exit 1"] @@ -18,17 +15,15 @@ services: timeout: 1s retries: 3 environment: - - SERVICE_PASSWORD_MYSQL - MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_MYSQLROOT - - MYSQL_DATABASE=panel - - MYSQL_USER=pterodactyl + - MYSQL_DATABASE=pterodactyl-db + - MYSQL_USER=$SERVICE_USER_MYSQL - MYSQL_PASSWORD=$SERVICE_PASSWORD_MYSQL volumes: - pterodactyl-db:/var/lib/mysql redis: image: redis:alpine - restart: unless-stopped healthcheck: test: ["CMD-SHELL", "redis-cli ping || exit 1"] interval: 10s @@ -37,7 +32,6 @@ services: pterodactyl: image: ghcr.io/pterodactyl/panel:latest - restart: unless-stopped volumes: - "panel-var:/app/var/" - "panel-nginx:/etc/nginx/http.d/" @@ -50,28 +44,26 @@ services: #!/bin/sh set -e - echo "Waiting for services to be ready..." - sleep 30 + echo "Setting logs permissions..." + chown -R nginx: /app/storage/logs/ - echo "Setting logs permissions..." - chown -R nginx: /app/storage/logs/ + USER_EXISTS=$(php artisan tinker --no-ansi --execute='echo \Pterodactyl\Models\User::where("email", "'"$ADMIN_EMAIL"'")->exists() ? "1" : "0";') - if ! php artisan p:user:list | grep -q "$ADMIN_EMAIL"; then - echo "Creating admin user..." - php artisan p:user:make --no-interaction \ - --admin=1 \ - --email="$ADMIN_EMAIL" \ - --username="$ADMIN_USERNAME" \ - --name-first="$ADMIN_FIRSTNAME" \ - --name-last="$ADMIN_LASTNAME" \ - --password="$ADMIN_PASSWORD" - echo "Admin user created" - else - echo "Admin user already exists, skipping creation" - fi - - exec supervisord -c --nodaemon + if [ "$USER_EXISTS" = "0" ]; then + echo "Admin User does not exist, creating user now." + php artisan p:user:make --no-interaction \ + --admin=1 \ + --email="$ADMIN_EMAIL" \ + --username="$ADMIN_USERNAME" \ + --name-first="$ADMIN_FIRSTNAME" \ + --name-last="$ADMIN_LASTNAME" \ + --password="$ADMIN_PASSWORD" + echo "Admin user created successfully!" + else + echo "Admin User already exists, skipping creation." + fi + exec supervisord --nodaemon command: ["/entrypoint.sh"] healthcheck: test: ["CMD-SHELL", "curl -sf http://localhost:80 || exit 1"] @@ -79,7 +71,7 @@ services: timeout: 1s retries: 3 environment: - - SERVICE_FQDN_PTERODACTYL + - SERVICE_FQDN_PTERODACTYL_80 - ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com} - ADMIN_USERNAME=${SERVICE_USER_ADMIN} - ADMIN_FIRSTNAME=${ADMIN_FIRSTNAME:-Admin} @@ -88,7 +80,7 @@ services: - PTERODACTYL_HTTPS=${PTERODACTYL_HTTPS:-false} - APP_ENV=production - APP_ENVIRONMENT_ONLY=false - - APP_URL=${PTERODACTYL_PUBLIC_FQDN:-$SERVICE_FQDN_PTERODACTYL} + - APP_URL=$SERVICE_FQDN_PTERODACTYL - APP_TIMEZONE=${TIMEZONE:-UTC} - APP_SERVICE_AUTHOR=${APP_SERVICE_AUTHOR:-author@example.com} - LOG_LEVEL=${LOG_LEVEL:-debug} @@ -96,6 +88,8 @@ services: - SESSION_DRIVER=redis - QUEUE_DRIVER=redis - REDIS_HOST=redis + - DB_DATABASE=pterodactyl-db + - DB_USERNAME=$SERVICE_USER_MYSQL - DB_HOST=mariadb - DB_PORT=3306 - DB_PASSWORD=$SERVICE_PASSWORD_MYSQL @@ -105,43 +99,4 @@ services: - MAIL_PORT=$MAIL_PORT - MAIL_USERNAME=$MAIL_USERNAME - MAIL_PASSWORD=$MAIL_PASSWORD - - MAIL_ENCRYPTION=$MAIL_ENCRYPTION - - wings: - image: ghcr.io/pterodactyl/wings:latest - restart: unless-stopped - environment: - - SERVICE_FQDN_WINGS_8080 - - TZ=${TIMEZONE:-UTC} - - WINGS_USERNAME=pterodactyl - volumes: - - "/var/run/docker.sock:/var/run/docker.sock" - - "/var/lib/docker/containers/:/var/lib/docker/containers/" - - "/var/lib/pterodactyl/:/var/lib/pterodactyl/" # See https://discord.com/channels/122900397965705216/493443725012500490/1272195151309045902 - - "/tmp/pterodactyl/:/tmp/pterodactyl/" # See https://discord.com/channels/122900397965705216/493443725012500490/1272195151309045902 - - "wings-logs:/var/log/pterodactyl/" - - - type: bind - source: ./etc/config.yml - target: /etc/pterodactyl/config.yml - content: | - docker: - network: - interface: 172.28.0.1 - dns: - - 1.1.1.1 - - 1.0.0.1 - name: pterodactyl_nw - ispn: false - driver: "" - network_mode: pterodactyl_nw - is_internal: false - enable_icc: true - network_mtu: 1500 - interfaces: - v4: - subnet: 172.28.0.0/16 - gateway: 172.28.0.1 - v6: - subnet: fdba:17c8:6c94::/64 - gateway: fdba:17c8:6c94::1011 + - MAIL_ENCRYPTION=$MAIL_ENCRYPTION \ No newline at end of file diff --git a/templates/compose/wings.yaml b/templates/compose/wings.yaml new file mode 100644 index 000000000..ce4a073f8 --- /dev/null +++ b/templates/compose/wings.yaml @@ -0,0 +1,44 @@ +# documentation: https://pterodactyl.io/ +# slogan: Wings is Pterodactyl's server control plane +# tags: game, game server, management, panel, minecraft +# logo: svgs/pterodactyl.png +# port: 8443 + +services: + wings: + image: "ghcr.io/pterodactyl/wings:latest" + environment: + - SERVICE_FQDN_WINGS_8443 + - "TZ=${TIMEZONE:-UTC}" + - WINGS_USERNAME=$SERVICE_USER_WINGS + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + - "/var/lib/docker/containers/:/var/lib/docker/containers/" + - "/var/lib/pterodactyl/volumes:/var/lib/pterodactyl/volumes" + - "/tmp/pterodactyl:/tmp/pterodactyl" + - wings_lib:/var/lib/pterodactyl/ + - wings_logs:/var/log/pterodactyl/ + - type: bind + source: ./etc/config.yml + target: /etc/pterodactyl/config.yml + content: | + debug: false + uuid: ReplaceConfig + token_id: ReplaceConfig + token: ReplaceConfig + api: + host: 0.0.0.0 + port: 8443 # Warning, panel must have 443 as daemon port, while here it should should be 8443, FQDN in Coolify for this service should be https://*:8443 + ssl: + enabled: false + cert: ReplaceConfig + key: ReplaceConfig + upload_limit: 100 + system: + data: /var/lib/pterodactyl/volumes + sftp: + bind_port: 2022 + allowed_mounts: [] + remote: '' + ports: + - '2022:2022' \ No newline at end of file