Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(server-transfer): accept legacy database port values and allow the kit VM network

Andras Bacsai9e52c6a140ec
diff --git a/app/Services/ServerTransfer/ServerTransferBundle.php b/app/Services/ServerTransfer/ServerTransferBundle.php
index 349afa96d0..dd75f61b2e 100644
--- a/app/Services/ServerTransfer/ServerTransferBundle.php
+++ b/app/Services/ServerTransfer/ServerTransferBundle.php
@@ -213,7 +213,6 @@ class ServerTransferBundle
}
foreach (self::items($environment['databases'] ?? null) as $d => $database) {
- self::checkDatabaseAttributes($errors, "{$at}.databases.{$d}", (array) ($database['attributes'] ?? []));
self::checkStorages($errors, "{$at}.databases.{$d}", $database);
self::checkScheduledBackups($errors, "{$at}.databases.{$d}", $database);
}
@@ -396,21 +395,4 @@ class ServerTransferBundle
self::checkPath($errors, "{$at}.scheduled_backups.{$i}.databases_to_backup", $backup['databases_to_backup'] ?? null);
}
}
-
- /**
- * The port checks of the database API. Names and passwords are not checked: older databases
- * have values that the current patterns refuse, and the values stay inside the containers.
- *
- * @param list<string> $errors
- * @param array<string, mixed> $attributes
- */
- private static function checkDatabaseAttributes(array &$errors, string $at, array $attributes): void
- {
- if (array_key_exists('ports_mappings', $attributes)) {
- self::check($errors, "{$at}.ports_mappings", $attributes['ports_mappings'], ValidationPatterns::portMappingRules());
- }
- if (array_key_exists('public_port', $attributes)) {
- self::check($errors, "{$at}.public_port", $attributes['public_port'], ['nullable', 'integer', 'between:1024,65535']);
- }
- }
}
diff --git a/scripts/transfer-test/reset.sh b/scripts/transfer-test/reset.sh
index 0abbea8c42..fde5f0abc9 100755
--- a/scripts/transfer-test/reset.sh
+++ b/scripts/transfer-test/reset.sh
@@ -57,7 +57,9 @@ tinker "$A" 'foreach (App\Models\Server::where("id", "!=", 0)->get() as $s) { $s
for side in source target; do
C="$A"
[[ "$side" == target ]] && C="$B"
- tinker "$C" '$s = App\Models\InstanceSettings::get(); $s->is_api_enabled = true; $s->save(); session(["currentTeam" => App\Models\Team::find(0)]); echo App\Models\User::find(0)->createToken("transfer-test", ["root"])->plainTextToken;' | tail -1 >"$STATE_DIR/$side.token"
+ # The dev .env runs Cloud mode, where the import check refuses private addresses unless the
+ # instance allows them. The VMs of A are on a private network.
+ tinker "$C" '$s = App\Models\InstanceSettings::get(); $s->is_api_enabled = true; $s->webhook_allowed_internal_hosts = ["10.221.'"$A_SLOT"'.0/24"]; $s->save(); session(["currentTeam" => App\Models\Team::find(0)]); echo App\Models\User::find(0)->createToken("transfer-test", ["root"])->plainTextToken;' | tail -1 >"$STATE_DIR/$side.token"
chmod 600 "$STATE_DIR/$side.token"
docker exec -u www-data "$C" php artisan horizon:terminate >/dev/null
done