Skip to content

Commit 4e0733f

Browse files
authored
Merge pull request #38 from NodeByteHosting/staging
Build to Beta Release
2 parents 0b49e1f + 5cb5273 commit 4e0733f

539 files changed

Lines changed: 18185 additions & 13665 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.git
2+
.github
3+
.husky
4+
.turbo
5+
**/.env
6+
**/.env.*
7+
!apps/web/.env.example
8+
**/.next
9+
**/.vercel
10+
**/coverage
11+
**/dist
12+
**/node_modules
13+
Dockerfile
14+
docker-compose.yml

‎.env.example‎

Lines changed: 0 additions & 45 deletions
This file was deleted.

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @NodeByteLTD
1+
* @BytePanelLTD

‎.github/CONTRIBUTING.md‎

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to NodeByte GSM
1+
# Contributing to BytePanel
22

3-
Thanks for contributing to NodeByte Game Server Manager (GSM). This repository contains the web control plane plus shared platform logic for managing dedicated game servers.
3+
Thanks for contributing to BytePanel. This repository contains the web control plane plus shared platform logic for managing dedicated game servers.
44

55
## Ways to contribute
66

@@ -21,7 +21,7 @@ Setup:
2121

2222
```bash
2323
bun install
24-
cp .env.example .env.local
24+
cp apps/web/.env.example apps/web/.env.local
2525
bun migrate
2626
bun dev
2727
```
@@ -36,22 +36,6 @@ bun run types
3636
bun run test
3737
```
3838

39-
If your changes affect generated provider schemas:
40-
41-
```bash
42-
bun run codegen
43-
```
44-
45-
## Working with submodules
46-
47-
This repo uses git submodules for independently versioned components such as GSA.
48-
49-
```bash
50-
git submodule update --init --recursive
51-
```
52-
53-
When a submodule commit changes, include the submodule pointer update in your PR.
54-
5539
## Pull request guidelines
5640

5741
- Keep PRs focused and scoped to one concern.

‎.github/FUNDING.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github: [CodeMeAPixel, NodeByteLTD]
1+
github: [CodeMeAPixel, BytePanelLTD]

‎.github/MIGRATION.md‎

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Migrating from Pterodactyl
2+
3+
This guide moves an existing Pterodactyl install to BytePanel: the panel's data first, then each node from Wings to the BytePanel agent. Server files stay where they are on each node and are never copied, so game servers come back with their worlds, configs and backups intact.
4+
5+
The migration has two parts:
6+
7+
1. **Panel:** import the Pterodactyl database into BytePanel with `migrate:pterodactyl`.
8+
2. **Nodes:** on each node, replace Wings with the agent using `bytepanel-daemon import-wings`.
9+
10+
Plan a maintenance window. Each node's servers are offline from the moment you stop them until the agent starts them again, which is usually a few minutes per node.
11+
12+
## Before you start
13+
14+
- A running BytePanel with its database migrated (`bun run db:deploy` in `apps/web`, or the Docker image, which does this on start). See the [README](README.md).
15+
- `BETTER_AUTH_SECRET` and `DATABASE_URL` set in `apps/web/.env`. The import encrypts the new node tokens with `BETTER_AUTH_SECRET`, so use the same value as the running panel.
16+
- Bun 1.3.13+ on the machine running the import, plus a checkout of this repository with `bun install` done.
17+
- Access to the Pterodactyl database, either directly (`mysql://...`) or as a dump.
18+
- Root SSH access to every node.
19+
- A fresh backup of the Pterodactyl database and of `/etc/pterodactyl` on each node.
20+
21+
## Part 1: Import the panel data
22+
23+
### 1. Choose a source
24+
25+
The importer can read from the live Pterodactyl database:
26+
27+
```bash
28+
--source mysql://pterodactyl:password@127.0.0.1:3306/panel
29+
```
30+
31+
Or from a dump file (`.sql` or `.sql.gz`), which is handy when the BytePanel host can't reach MySQL:
32+
33+
```bash
34+
mysqldump -u pterodactyl -p panel > panel.sql
35+
# optional: keep the dump small by leaving out log tables
36+
mysqldump -u pterodactyl -p panel --ignore-table=panel.activity_logs --ignore-table=panel.activity_log_subjects > panel.sql
37+
```
38+
39+
Dumps need their table structure (the default). If you made one with `--no-create-info`, re-dump it with `--complete-insert`.
40+
41+
If your Pterodactyl tables use a prefix (`DB_PREFIX` in Pterodactyl's `.env`), pass it with `--prefix`.
42+
43+
### 2. Do a dry run
44+
45+
From `apps/web`:
46+
47+
```bash
48+
bun run migrate:pterodactyl --source panel.sql --dry-run
49+
```
50+
51+
A dry run performs the whole import inside a transaction and rolls it back. It prints how many rows of each type it would import, any egg features BytePanel can't represent, and the tables it skips. Fix anything it complains about before continuing.
52+
53+
### 3. Run the import
54+
55+
```bash
56+
bun run migrate:pterodactyl --source panel.sql
57+
```
58+
59+
The import runs in a single transaction, so it either fully succeeds or changes nothing. It is safe to run again, for example after a newer dump: rows are matched by email, UUID, location short code, nest name or egg name and updated in place.
60+
61+
### What gets imported
62+
63+
| Pterodactyl | BytePanel | Notes |
64+
| --- | --- | --- |
65+
| Users | Users | Passwords carry over (see [Signing in](#signing-in-after-the-migration)). Root admins become admins. |
66+
| Locations, nodes, allocations | Locations, nodes, allocations | Nodes get new daemon tokens; Wings tokens can't be reused. |
67+
| Nests, eggs, egg variables | Nests, eggs, egg variables | Eggs that copy config or scripts from another egg are resolved. |
68+
| Servers, server variables | Servers, server variables | UUIDs are kept, so files on the node line up. Primary and extra allocations are kept. |
69+
| Backups | Backups | The archives themselves are moved in Part 2. |
70+
| Subusers | Server members | Mapped to a role: read-only permissions become *viewer*, user management becomes *admin*, everything else *member*. |
71+
72+
### What doesn't carry over
73+
74+
| Pterodactyl data | Why |
75+
| --- | --- |
76+
| Two-factor (TOTP) secrets | BytePanel doesn't use TOTP. Users can add a passkey instead. |
77+
| API keys, SSH keys, recovery tokens | Different credential formats; users recreate them. |
78+
| Database hosts and databases | BytePanel doesn't manage databases. The databases themselves are untouched. |
79+
| Schedules and tasks | BytePanel has no schedules. |
80+
| Mounts | Re-create them as `extraMounts` on the eggs that need them. |
81+
| Activity, audit and API logs | History only. |
82+
| Sessions, password resets, jobs, notifications, settings | Pterodactyl runtime state. Configure panel settings again in BytePanel's admin area. |
83+
84+
Egg config-file rules that BytePanel can't express, such as conditional values or the XML parser, are dropped. Each one is printed as a warning, so check those eggs afterwards.
85+
86+
## Part 2: Switch each node from Wings to the agent
87+
88+
Do this one node at a time. Nothing on the node is deleted, so a node can be rolled back at any point (see [Rolling back](#rolling-back-a-node)).
89+
90+
### 1. Stop the node's servers
91+
92+
Stop every server on the node from Pterodactyl, while Wings is still running, so each one shuts down with its egg's stop command and saves cleanly.
93+
94+
### 2. Install and configure the agent
95+
96+
Install the agent, then open the node's page in the BytePanel admin area and run the `configure` command shown there:
97+
98+
```bash
99+
bytepanel-daemon configure --panel https://panel.example.com --token <tokenId.token>
100+
```
101+
102+
Don't start the agent yet. Wings still holds ports 8080 and 2022.
103+
104+
### 3. Import the Wings setup
105+
106+
Preview what will happen, then run it:
107+
108+
```bash
109+
bytepanel-daemon import-wings --dry-run
110+
bytepanel-daemon import-wings
111+
```
112+
113+
`import-wings` reads `/etc/pterodactyl/config.yml` and:
114+
115+
- stops and disables `wings.service`
116+
- removes the Wings containers (the agent recreates them with its own settings on first start) and the `pterodactyl_nw` Docker network
117+
- moves backup archives from `/var/lib/pterodactyl/backups` into the agent's backup directory
118+
- reuses Wings' SFTP host key, so SFTP clients don't warn about a changed key
119+
- keeps Wings' data directory, file owner UID/GID, timezone, DNS servers, allowed origins and TLS certificate paths
120+
121+
| Flag | Default | Use |
122+
| --- | --- | --- |
123+
| `--dry-run` | off | Print the plan without changing anything. |
124+
| `--stop-running` | off | Stop servers that are still running (SIGTERM, 60s) instead of refusing. |
125+
| `--force` | off | Continue even if the Wings config belongs to a different node. |
126+
| `--wings-config` | `/etc/pterodactyl/config.yml` | Path to the Wings config. |
127+
| `--wings-service` | `wings` | Name of the Wings systemd unit. |
128+
| `--config` | `/etc/bytepanel/daemon.json` | Path to the agent config. |
129+
130+
> [!IMPORTANT]
131+
> Running `configure` again later resets the imported settings to the panel's values, including the file owner UID/GID, which breaks permissions on migrated servers. If you re-run `configure`, run `import-wings` straight after it. It's safe to repeat while `/etc/pterodactyl/config.yml` is still on the node.
132+
133+
### 4. Start the agent and check it
134+
135+
```bash
136+
systemctl enable --now bytepanel-daemon
137+
journalctl -u bytepanel-daemon -f
138+
```
139+
140+
Start one server from BytePanel and check that the console, file manager, SFTP and a backup restore all work. Then start the rest.
141+
142+
### 5. Clean up
143+
144+
When the node has run well for a while, you can remove Wings:
145+
146+
```bash
147+
rm /usr/local/bin/wings /etc/systemd/system/wings.service
148+
rm -rf /etc/pterodactyl /var/lib/pterodactyl/archives /var/lib/pterodactyl/.sftp
149+
```
150+
151+
Leave `/var/lib/pterodactyl/volumes` alone: that's where the server files still live. To move them somewhere else later, stop the node's servers, move the folder, and change both the node's daemon base in the panel and `system.data` in `/etc/bytepanel/daemon.json`.
152+
153+
## Signing in after the migration
154+
155+
How imported users sign in depends on the panel's billing provider:
156+
157+
- **BytePay:** customers sign in with BytePay, and staff (admins) sign in with their password or a passkey. When a customer signs in with BytePay for the first time, it links to their imported account by email address, so their servers are waiting for them. Make sure customers' BytePay emails match the ones they used in Pterodactyl.
158+
- **Any other provider:** everyone signs in with their existing Pterodactyl email and password. Pterodactyl's bcrypt password hashes are accepted as they are.
159+
160+
Imported admins become admins, not super admins. Promote the accounts that need it in the admin area.
161+
162+
SFTP uses a separate password in BytePanel. Each user sets one from their account settings before connecting. The host and port are unchanged.
163+
164+
## Rolling back a node
165+
166+
Until you clean up, Wings can be brought back:
167+
168+
```bash
169+
systemctl disable --now bytepanel-daemon
170+
docker ps -a --filter label=bytepanel.server -q | xargs -r docker rm -f
171+
systemctl enable --now wings
172+
```
173+
174+
Backup archives moved in Part 2 are in `/var/lib/bytepanel/backups`. Move them back to `/var/lib/pterodactyl/backups` if Wings needs them. The Pterodactyl panel and its database are not changed by the import, so they keep working.
175+
176+
## Troubleshooting
177+
178+
| Problem | Fix |
179+
| --- | --- |
180+
| `Table ... is not in the dump (wrong --prefix?)` | The dump is missing a table, or the tables use a prefix. Pass `--prefix`, or dump the whole database. |
181+
| `INSERT into ... has no column list` | The dump has no table structure. Re-dump without `--no-create-info`, or with `--complete-insert`. |
182+
| `Wings is node ... but the agent is configured for node ...` | You ran `configure` with another node's token. Use the command from this node's admin page. |
183+
| `server(s) are still running under Wings` | Stop them from Pterodactyl, or pass `--stop-running`. |
184+
| Servers fail with permission errors | The agent isn't using Wings' file owner. Check `system.user` in `/etc/bytepanel/daemon.json` against `id pterodactyl`, or re-run `import-wings`. |
185+
| Servers have no files | The node's `system.data` doesn't point at the Wings volumes. Check it against `system.data` in the Wings config. |
186+
| `subnet 172.18.0.0/16 is in use` in the agent log | The `pterodactyl_nw` network is still there. Remove it after the Wings containers are gone, or let the agent pick another subnet. |
187+
| Timestamps are off by a few hours | Dates are read as UTC. If Pterodactyl's `APP_TIMEZONE` wasn't UTC, created and backup dates shift by that offset. Nothing else is affected. |
188+
189+
Need help? Ask on [Discord](https://discord.gg/53byT2VrhQ).

0 commit comments

Comments
 (0)