Skip to content

Commit

Permalink
Merge branch 'develop' into fix/get-mimetype-from-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicPlayerA10 authored Aug 29, 2024
2 parents 85f2b4a + b4a9a1c commit 7cda224
Show file tree
Hide file tree
Showing 38 changed files with 834 additions and 293 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
runs-on: ubuntu-22.04
# Always run against a tag, even if the commit into the tag has [docker skip] within the commit message.
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
permissions:
contents: read
packages: write
steps:
- name: Code checkout
uses: actions/checkout@v4
Expand All @@ -22,7 +25,7 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/pterodactyl/wings
images: ghcr.io/${{ github.repository }}
flavor: |
latest=false
tags: |
Expand All @@ -40,8 +43,8 @@ jobs:
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get Build Information
id: build_info
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
build-and-test:
name: Build and Test
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
go: ["1.22.5"]
go: ["1.22.6", "1.23.0"]
goos: [linux]
goarch: [amd64, arm64]

Expand Down Expand Up @@ -62,14 +64,14 @@ jobs:
- name: Upload Release Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.22.5' }}
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.22.6' }}
with:
name: wings_linux_${{ matrix.goarch }}
path: dist/wings

- name: Upload Debug Artifact
uses: actions/upload-artifact@v4
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.22.5' }}
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.22.6' }}
with:
name: wings_linux_${{ matrix.goarch }}_debug
path: dist/wings_debug
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
release:
name: Release
runs-on: ubuntu-22.04
permissions:
contents: write # write is required to create releases and push.

steps:
- name: Code Checkout
Expand All @@ -17,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.5"
go-version: "1.22.6"

- name: Build release binaries
env:
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Stage 1 (Build)
FROM golang:1.22.5-alpine AS builder
FROM golang:1.22.6-alpine AS builder

ARG VERSION
RUN apk add --update --no-cache git make
RUN apk add --update --no-cache git make mailcap
WORKDIR /app/
COPY go.mod go.sum /app/
RUN go mod download
Expand All @@ -18,8 +18,11 @@ RUN echo "ID=\"distroless\"" > /etc/os-release
# Stage 2 (Final)
FROM gcr.io/distroless/static:latest
COPY --from=builder /etc/os-release /etc/os-release
COPY --from=builder /etc/mime.types /etc/mime.types

COPY --from=builder /app/wings /usr/bin/
CMD [ "/usr/bin/wings", "--config", "/etc/pterodactyl/config.yml" ]

EXPOSE 8080
ENTRYPOINT ["/usr/bin/wings"]
CMD ["--config", "/etc/pterodactyl/config.yml"]

EXPOSE 8080 2022
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ dependencies, and allowing users to authenticate with the same credentials they
I would like to extend my sincere thanks to the following sponsors for helping fund Pterodactyl's development.
[Interested in becoming a sponsor?](https://github.com/sponsors/matthewpi)

| Company | About |
|--------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [**Aussie Server Hosts**](https://aussieserverhosts.com/) | No frills Australian Owned and operated High Performance Server hosting for some of the most demanding games serving Australia and New Zealand. |
| [**CodeNode LLC**](https://codenode.gg/) | Looking for simplicity? Well, look no further! CodeNode has got you covered with everything you need at the rock-bottom price of $1.75 per GB, including dedicated IPs in Dallas, Texas, and Amsterdam, Netherlands. We're not just good, we're the best in the game! |
| [**BisectHosting**](https://www.bisecthosting.com/) | BisectHosting provides Minecraft, Valheim and other server hosting services with the highest reliability and lightning fast support since 2012. |
| [**MineStrator**](https://minestrator.com/) | Looking for the most highend French hosting company for your minecraft server? More than 24,000 members on our discord trust us. Give us a try! |
| [**HostEZ**](https://hostez.io) | US & EU Rust & Minecraft Hosting. DDoS Protected bare metal, VPS and colocation with low latency, high uptime and maximum availability. EZ! |
| [**Blueprint**](https://blueprint.zip/?pterodactyl=true) | Create and install Pterodactyl addons and themes with the growing Blueprint framework - the package-manager for Pterodactyl. Use multiple modifications at once without worrying about conflicts and make use of the large extension ecosystem. |
| [**indifferent broccoli**](https://indifferentbroccoli.com/) | indifferent broccoli is a game server hosting and rental company. With us, you get top-notch computer power for your gaming sessions. We destroy lag, latency, and complexity--letting you focus on the fun stuff. |
| Company | About |
|-----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [**Aussie Server Hosts**](https://aussieserverhosts.com/) | No frills Australian Owned and operated High Performance Server hosting for some of the most demanding games serving Australia and New Zealand. |
| [**CodeNode LLC**](https://codenode.gg/) | Looking for simplicity? Well, look no further! CodeNode has got you covered with everything you need at the rock-bottom price of $1.75 per GB, including dedicated IPs in Dallas, Texas, and Amsterdam, Netherlands. We're not just good, we're the best in the game! |
| [**BisectHosting**](https://www.bisecthosting.com/) | BisectHosting provides Minecraft, Valheim and other server hosting services with the highest reliability and lightning fast support since 2012. |
| [**MineStrator**](https://minestrator.com/) | Looking for the most highend French hosting company for your minecraft server? More than 24,000 members on our discord trust us. Give us a try! |
| [**HostEZ**](https://hostez.io) | US & EU Rust & Minecraft Hosting. DDoS Protected bare metal, VPS and colocation with low latency, high uptime and maximum availability. EZ! |
| [**Blueprint**](https://blueprint.zip/?utm_source=pterodactyl&utm_medium=sponsor) | Create and install Pterodactyl addons and themes with the growing Blueprint framework - the package-manager for Pterodactyl. Use multiple modifications at once without worrying about conflicts and make use of the large extension ecosystem. |
| [**indifferent broccoli**](https://indifferentbroccoli.com/) | indifferent broccoli is a game server hosting and rental company. With us, you get top-notch computer power for your gaming sessions. We destroy lag, latency, and complexity--letting you focus on the fun stuff. |

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"crypto/tls"
"encoding/json"
"fmt"
"io"
"net/http"
Expand All @@ -13,7 +14,6 @@ import (

"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/goccy/go-json"
"github.com/spf13/cobra"

"github.com/pterodactyl/wings/config"
Expand Down
2 changes: 1 addition & 1 deletion cmd/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
Expand All @@ -19,7 +20,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/parsers/operatingsystem"
"github.com/goccy/go-json"
"github.com/spf13/cobra"

"github.com/pterodactyl/wings/config"
Expand Down
13 changes: 7 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@ type Configuration struct {
// This function does not modify the currently stored global configuration.
func NewAtPath(path string) (*Configuration, error) {
var c Configuration
// Configures the default values for many of the configuration options present
// in the structs. Values set in the configuration file take priority over the
// default values.
if err := defaults.Set(&c); err != nil {
return nil, err
}
// Track the location where we created this configuration.
c.path = path
return &c, nil
Expand Down Expand Up @@ -563,6 +557,13 @@ func FromFile(path string) error {
return err
}

// Configures the default values for many of the configuration options present
// in the structs. Values set in the configuration file will not be overridden by the
// default values.
if err := defaults.Set(c); err != nil {
return err
}

// Store this configuration in the global state.
Set(c)
return nil
Expand Down
2 changes: 1 addition & 1 deletion config/config_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package config

import (
"encoding/base64"
"encoding/json"
"sort"

"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/registry"
"github.com/goccy/go-json"
)

type dockerNetworkInterfaces struct {
Expand Down
2 changes: 1 addition & 1 deletion environment/docker/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package docker

import (
"context"
"encoding/json"
"io"
"net/http"
"reflect"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/goccy/go-json"

"github.com/pterodactyl/wings/config"
)
Expand Down
10 changes: 5 additions & 5 deletions environment/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (e *Environment) Attach(ctx context.Context) error {
return nil
}

opts := types.ContainerAttachOptions{
opts := container.AttachOptions{
Stdin: true,
Stdout: true,
Stderr: true,
Expand Down Expand Up @@ -103,7 +103,7 @@ func (e *Environment) Attach(ctx context.Context) error {
// container. This allows memory, cpu, and IO limitations to be adjusted on the
// fly for individual instances.
func (e *Environment) InSituUpdate() error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

if _, err := e.ContainerInspect(ctx); err != nil {
Expand Down Expand Up @@ -270,7 +270,7 @@ func (e *Environment) Destroy() error {
// We set it to stopping than offline to prevent crash detection from being triggered.
e.SetState(environment.ProcessStoppingState)

err := e.client.ContainerRemove(context.Background(), e.Id, types.ContainerRemoveOptions{
err := e.client.ContainerRemove(context.Background(), e.Id, container.RemoveOptions{
RemoveVolumes: true,
RemoveLinks: false,
Force: true,
Expand Down Expand Up @@ -316,7 +316,7 @@ func (e *Environment) SendCommand(c string) error {
// is running or not, it will simply try to read the last X bytes of the file
// and return them.
func (e *Environment) Readlog(lines int) ([]string, error) {
r, err := e.client.ContainerLogs(context.Background(), e.Id, types.ContainerLogsOptions{
r, err := e.client.ContainerLogs(context.Background(), e.Id, container.LogsOptions{
ShowStdout: true,
ShowStderr: true,
Tail: strconv.Itoa(lines),
Expand Down Expand Up @@ -355,7 +355,7 @@ func (e *Environment) ensureImageExists(image string) error {
// Give it up to 15 minutes to pull the image. I think this should cover 99.8% of cases where an
// image pull might fail. I can't imagine it will ever take more than 15 minutes to fully pull
// an image. Let me know when I am inevitably wrong here...
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*15)
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
defer cancel()

// Get a registry auth configuration from the config.
Expand Down
8 changes: 2 additions & 6 deletions environment/docker/power.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"emperror.dev/errors"
"github.com/apex/log"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"

Expand All @@ -26,7 +25,7 @@ import (
// is running does not result in the server becoming un-bootable.
func (e *Environment) OnBeforeStart(ctx context.Context) error {
// Always destroy and re-create the server container to ensure that synced data from the Panel is used.
if err := e.client.ContainerRemove(ctx, e.Id, types.ContainerRemoveOptions{RemoveVolumes: true}); err != nil {
if err := e.client.ContainerRemove(ctx, e.Id, container.RemoveOptions{RemoveVolumes: true}); err != nil {
if !client.IsErrNotFound(err) {
return errors.WrapIf(err, "environment/docker: failed to remove container during pre-boot")
}
Expand Down Expand Up @@ -121,7 +120,7 @@ func (e *Environment) Start(ctx context.Context) error {
return errors.WrapIf(err, "environment/docker: failed to attach to container")
}

if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil {
if err := e.client.ContainerStart(actx, e.Id, container.StartOptions{}); err != nil {
return errors.WrapIf(err, "environment/docker: failed to start container")
}

Expand Down Expand Up @@ -305,13 +304,11 @@ func (e *Environment) SignalContainer(ctx context.Context, signal string) error
}

return nil

}

// Terminate forcefully terminates the container using the signal provided.
// then sets its state to stopped.
func (e *Environment) Terminate(ctx context.Context, signal string) error {

// Send the signal to the container to kill it
if err := e.SignalContainer(ctx, signal); err != nil {
return errors.WithStack(err)
Expand All @@ -322,5 +319,4 @@ func (e *Environment) Terminate(ctx context.Context, signal string) error {
e.SetState(environment.ProcessOfflineState)

return nil

}
2 changes: 1 addition & 1 deletion environment/docker/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package docker

import (
"context"
"encoding/json"
"io"
"math"
"time"

"emperror.dev/errors"
"github.com/docker/docker/api/types"
"github.com/goccy/go-json"

"github.com/pterodactyl/wings/environment"
)
Expand Down
2 changes: 1 addition & 1 deletion events/events.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package events

import (
"encoding/json"
"strings"

"emperror.dev/errors"
"github.com/goccy/go-json"

"github.com/pterodactyl/wings/system"
)
Expand Down
Loading

0 comments on commit 7cda224

Please sign in to comment.