Skip to content

Commit 2a3b5b3

Browse files
authored
Merge pull request #22 from pterodactyl/develop
sync
2 parents 0e2635b + ccae513 commit 2a3b5b3

27 files changed

+789
-443
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
indent_size = 4
6+
tab_width = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.go]
13+
max_line_length = 100
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
[*.{md,nix,yaml}]
19+
indent_style = space
20+
indent_size = 2
21+
tab_width = 2

.envrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
use flake
1+
#!/usr/bin/env sh
2+
3+
# Load the flake's `devShells.${currentSystem}.default`.
4+
if ! use flake .; then
5+
echo 'The development shell was unable to be built.' >&2
6+
echo 'The development environment was not loaded.' >&2
7+
echo 'Please make the necessary changes in flake.nix to fix any issues and hit enter to try again.' >&2
8+
fi

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
- package-ecosystem: gomod
8+
directory: /
9+
schedule:
10+
interval: weekly

.github/workflows/codeql.yaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,26 @@ on:
1313
jobs:
1414
analyze:
1515
name: Analyze
16-
runs-on: ubuntu-22.04
17-
16+
runs-on: ubuntu-24.04
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- language: go
22+
build-mode: autobuild
1823
permissions:
1924
actions: read
2025
contents: read
2126
security-events: write
22-
23-
strategy:
24-
fail-fast: false
25-
matrix:
26-
language:
27-
- go
28-
2927
steps:
30-
- name: Code Checkout
31-
uses: actions/checkout@v4
28+
- name: Code checkout
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3230

3331
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@v2
32+
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3533
with:
3634
languages: ${{ matrix.language }}
37-
38-
- name: Autobuild
39-
uses: github/codeql-action/autobuild@v2
35+
build-mode: ${{ matrix.build-mode }}
4036

4137
- name: Perform CodeQL Analysis
42-
uses: github/codeql-action/analyze@v2
38+
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18

.github/workflows/docker.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ on:
1111
jobs:
1212
build-and-push:
1313
name: Build and Push
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515
# Always run against a tag, even if the commit into the tag has [docker skip] within the commit message.
1616
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
1717
permissions:
1818
contents: read
1919
packages: write
2020
steps:
2121
- name: Code checkout
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323

2424
- name: Docker metadata
2525
id: docker_meta
26-
uses: docker/metadata-action@v5
26+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
2727
with:
2828
images: ghcr.io/${{ github.repository }}
2929
flavor: |
@@ -34,13 +34,13 @@ jobs:
3434
type=ref,event=branch
3535
3636
- name: Setup QEMU
37-
uses: docker/setup-qemu-action@v3
37+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
3838

3939
- name: Setup Docker buildx
40-
uses: docker/setup-buildx-action@v3
40+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
4141

4242
- name: Login to GitHub Container Registry
43-
uses: docker/login-action@v3
43+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
4444
with:
4545
registry: ghcr.io
4646
username: ${{ github.actor }}
@@ -53,7 +53,7 @@ jobs:
5353
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
5454
5555
- name: Build and Push (tag)
56-
uses: docker/build-push-action@v5
56+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
5757
if: "github.event_name == 'release' && github.event.action == 'published'"
5858
with:
5959
context: .
@@ -66,7 +66,7 @@ jobs:
6666
tags: ${{ steps.docker_meta.outputs.tags }}
6767

6868
- name: Build and Push (develop)
69-
uses: docker/build-push-action@v5
69+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
7070
if: "github.event_name == 'push' && contains(github.ref, 'develop')"
7171
with:
7272
context: .

.github/workflows/push.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,24 @@ jobs:
1212
build-and-test:
1313
name: Build and Test
1414
runs-on: ${{ matrix.os }}
15-
permissions:
16-
contents: read
1715
strategy:
1816
fail-fast: false
1917
matrix:
20-
os: [ubuntu-22.04]
21-
go: ["1.22.10", "1.23.4"]
18+
os: [ubuntu-24.04]
19+
go: ["1.23.7", "1.24.1"]
2220
goos: [linux]
2321
goarch: [amd64, arm64]
24-
22+
permissions:
23+
contents: read
2524
steps:
25+
- name: Code checkout
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
2628
- name: Setup Go
27-
uses: actions/setup-go@v5
29+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2830
with:
2931
go-version: ${{ matrix.go }}
3032

31-
- name: Code checkout
32-
uses: actions/checkout@v4
33-
3433
- name: go mod download
3534
env:
3635
CGO_ENABLED: 0
@@ -44,8 +43,8 @@ jobs:
4443
CGO_ENABLED: 0
4544
SRC_PATH: github.com/pterodactyl/wings
4645
run: |
47-
go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o dist/wings ${SRC_PATH}
48-
go build -v -trimpath -ldflags="-X ${SRC_PATH}/system.Version=dev-${GIT_COMMIT:0:7}" -o dist/wings_debug ${SRC_PATH}
46+
go build -v -trimpath -ldflags="-s -w -X ${SRC_PATH}/system.Version=dev-${GITHUB_SHA:0:7}" -o dist/wings ${SRC_PATH}
47+
go build -v -trimpath -ldflags="-X ${SRC_PATH}/system.Version=dev-${GITHUB_SHA:0:7}" -o dist/wings_debug ${SRC_PATH}
4948
chmod 755 dist/*
5049
5150
- name: go test
@@ -63,15 +62,15 @@ jobs:
6362
go test -race $(go list ./...)
6463
6564
- name: Upload Release Artifact
66-
uses: actions/upload-artifact@v4
67-
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.22.10' }}
65+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
66+
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.23.7' }}
6867
with:
6968
name: wings_linux_${{ matrix.goarch }}
7069
path: dist/wings
7170

7271
- name: Upload Debug Artifact
73-
uses: actions/upload-artifact@v4
74-
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.22.10' }}
72+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
73+
if: ${{ (github.ref == 'refs/heads/develop' || github.event_name == 'pull_request') && matrix.go == '1.23.7' }}
7574
with:
7675
name: wings_linux_${{ matrix.goarch }}_debug
7776
path: dist/wings_debug

.github/workflows/release.yaml

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ on:
88
jobs:
99
release:
1010
name: Release
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-24.04
1212
permissions:
1313
contents: write # write is required to create releases and push.
1414

1515
steps:
16-
- name: Code Checkout
17-
uses: actions/checkout@v4
16+
- name: Code checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1818

1919
- name: Setup Go
20-
uses: actions/setup-go@v5
20+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2121
with:
22-
go-version: "1.22.10"
22+
go-version: "1.23.7"
2323

2424
- name: Build release binaries
2525
env:
@@ -59,41 +59,13 @@ jobs:
5959
git push
6060
6161
- name: Create release
62-
id: create_release
63-
uses: softprops/action-gh-release@v1
62+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
6463
env:
6564
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6665
with:
6766
draft: true
6867
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
6968
body_path: ./RELEASE_CHANGELOG
70-
71-
- name: Upload amd64 binary
72-
uses: actions/upload-release-asset@v1
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
with:
76-
upload_url: ${{ steps.create_release.outputs.upload_url }}
77-
asset_path: dist/wings_linux_amd64
78-
asset_name: wings_linux_amd64
79-
asset_content_type: application/octet-stream
80-
81-
- name: Upload arm64 binary
82-
uses: actions/upload-release-asset@v1
83-
env:
84-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85-
with:
86-
upload_url: ${{ steps.create_release.outputs.upload_url }}
87-
asset_path: dist/wings_linux_arm64
88-
asset_name: wings_linux_arm64
89-
asset_content_type: application/octet-stream
90-
91-
- name: Upload checksum
92-
uses: actions/upload-release-asset@v1
93-
env:
94-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95-
with:
96-
upload_url: ${{ steps.create_release.outputs.upload_url }}
97-
asset_path: ./checksums.txt
98-
asset_name: checksums.txt
99-
asset_content_type: text/plain
69+
files: |
70+
dist/*
71+
checksums.txt

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1 (Build)
2-
FROM golang:1.22.10-alpine AS builder
2+
FROM golang:1.23.7-alpine AS builder
33

44
ARG VERSION
55
RUN apk add --update --no-cache git make mailcap

cmd/root.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"path/filepath"
1414
"runtime"
1515
"strconv"
16+
"syscall"
1617
"time"
1718

1819
"github.com/NYTimes/logrotate"
@@ -103,6 +104,7 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
103104

104105
if err := config.ConfigureTimezone(); err != nil {
105106
log.WithField("error", err).Fatal("failed to detect system timezone or use supplied configuration value")
107+
return
106108
}
107109
log.WithField("timezone", config.Get().System.Timezone).Info("configured wings with system timezone")
108110
if err := config.ConfigureDirectories(); err != nil {
@@ -111,9 +113,11 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
111113
}
112114
if err := config.EnsurePterodactylUser(); err != nil {
113115
log.WithField("error", err).Fatal("failed to create pterodactyl system user")
116+
return
114117
}
115118
if err := config.ConfigurePasswd(); err != nil {
116119
log.WithField("error", err).Fatal("failed to configure container passwd file")
120+
return
117121
}
118122
log.WithFields(log.Fields{
119123
"username": config.Get().System.Username,
@@ -125,29 +129,37 @@ func rootCmdRun(cmd *cobra.Command, _ []string) {
125129
return
126130
}
127131

132+
t := config.Get().Token
128133
pclient := remote.New(
129134
config.Get().PanelLocation,
130-
remote.WithCredentials(config.Get().AuthenticationTokenId, config.Get().AuthenticationToken),
135+
remote.WithCredentials(t.ID, t.Token),
131136
remote.WithHttpClient(&http.Client{
132137
Timeout: time.Second * time.Duration(config.Get().RemoteQuery.Timeout),
133138
}),
134139
)
135140

136141
if err := database.Initialize(); err != nil {
137142
log.WithField("error", err).Fatal("failed to initialize database")
143+
return
138144
}
139145

140146
manager, err := server.NewManager(cmd.Context(), pclient)
141147
if err != nil {
142148
log.WithField("error", err).Fatal("failed to load server configurations")
149+
return
143150
}
144151

145152
if err := environment.ConfigureDocker(cmd.Context()); err != nil {
146153
log.WithField("error", err).Fatal("failed to configure docker environment")
154+
return
147155
}
148156

149157
if err := config.WriteToDisk(config.Get()); err != nil {
150-
log.WithField("error", err).Fatal("failed to write configuration to disk")
158+
if !errors.Is(err, syscall.EROFS) {
159+
log.WithField("error", err).Error("failed to write configuration to disk")
160+
} else {
161+
log.WithField("error", err).Debug("failed to write configuration to disk")
162+
}
151163
}
152164

153165
// Just for some nice log output.

0 commit comments

Comments
 (0)