curl --request POST \
--url https://api.qovery.com/environment/{environmentId}/routingMode/migrate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qovery.com/environment/{environmentId}/routingMode/migrate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qovery.com/environment/{environmentId}/routingMode/migrate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qovery.com/environment/{environmentId}/routingMode/migrate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.qovery.com/environment/{environmentId}/routingMode/migrate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.qovery.com/environment/{environmentId}/routingMode/migrate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qovery.com/environment/{environmentId}/routingMode/migrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"dry_run": true,
"blockers": [
"BETA_FEATURE_NOT_ENABLED"
],
"services": [
{
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_type": "APPLICATION",
"legacy_hostname": "<string>",
"legacy_hostnames": [
"<string>"
],
"new_hostname": "<string>",
"variables": [
{
"name": "<string>",
"old_value": "<string>",
"new_value": "<string>"
}
]
}
],
"unrouted_services": [
{
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_type": "APPLICATION",
"removed_variables": [
"<string>"
]
}
],
"services_with_pending_changes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"title": "Conflict",
"status": 409,
"detail": "The environment cannot be migrated: ENVIRONMENT_STOPPED",
"type": "about:blank",
"instance": "<string>"
}{
"title": "Conflict",
"status": 409,
"detail": "The environment cannot be migrated: ENVIRONMENT_STOPPED",
"type": "about:blank",
"instance": "<string>"
}Migrate the environment routing mode
Move the environment from PER_ROUTER_LISTENER_SET (one router per service) to PER_HOSTNAME_LISTENER_SET (one router for the environment), so several services can share a custom domain by path.
Beta: only organizations enabled by Qovery support can migrate. For the others, the response lists the BETA_FEATURE_NOT_ENABLED blocker.
Needs the same permission as deploying the environment.
With dryRun=true, nothing changes: the response lists the blockers and what the migration would change. Call it first.
Without dryRun, the migration is refused with a 409 while any blocker applies. Otherwise it switches the routing mode, updates the services’ HOST_EXTERNAL and HOSTS_EXTERNAL variables to the new hostnames, and queues a deploy of the whole environment.
The deploy installs the environment router next to the service routers, then uninstalls the service routers once the new hostnames serve. Until then the old routing keeps serving.
Legacy Qovery hostnames listed in legacy_hostnames stay served until the service is deleted. There is no reverse migration.
curl --request POST \
--url https://api.qovery.com/environment/{environmentId}/routingMode/migrate \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qovery.com/environment/{environmentId}/routingMode/migrate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qovery.com/environment/{environmentId}/routingMode/migrate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qovery.com/environment/{environmentId}/routingMode/migrate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.qovery.com/environment/{environmentId}/routingMode/migrate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.qovery.com/environment/{environmentId}/routingMode/migrate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qovery.com/environment/{environmentId}/routingMode/migrate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"dry_run": true,
"blockers": [
"BETA_FEATURE_NOT_ENABLED"
],
"services": [
{
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_type": "APPLICATION",
"legacy_hostname": "<string>",
"legacy_hostnames": [
"<string>"
],
"new_hostname": "<string>",
"variables": [
{
"name": "<string>",
"old_value": "<string>",
"new_value": "<string>"
}
]
}
],
"unrouted_services": [
{
"service_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"service_type": "APPLICATION",
"removed_variables": [
"<string>"
]
}
],
"services_with_pending_changes": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"title": "Conflict",
"status": 409,
"detail": "The environment cannot be migrated: ENVIRONMENT_STOPPED",
"type": "about:blank",
"instance": "<string>"
}{
"title": "Conflict",
"status": 409,
"detail": "The environment cannot be migrated: ENVIRONMENT_STOPPED",
"type": "about:blank",
"instance": "<string>"
}Authorizations
JWT tokens should be used with OIDC account (human to machine). JWT tokens used by the Qovery console to communicate with the API have a TTL. Curl Example ' curl https://console.qovery.com/organization -H "Authorization: Bearer $qovery_token" '
Query Parameters
Response
The migration plan. Without dryRun, the migration is committed and its deploy is queued.
What the routing mode migration changes, or would change on a dry run.
Why the migration cannot run now. The migration runs only when this is empty. Always empty when dry_run is false.
Why the environment cannot move to PER_HOSTNAME_LISTENER_SET now.
BETA_FEATURE_NOT_ENABLED: the organization is not enabled for the beta. Ask Qovery support.ALREADY_MIGRATED: the environment already usesPER_HOSTNAME_LISTENER_SET.CLUSTER_WITHOUT_GATEWAY_API: the cluster does not deploy and use the Gateway API.CLUSTER_NOT_READY: the cluster is not ready for a deployment.ENVIRONMENT_STOPPED: the environment is stopped, uninstalled or deleted. Start it first.DEPLOYMENT_IN_PROGRESS: a deployment is queued or running.PUBLIC_REGEX_HTTP_PATH: a public HTTP port uses a regex path. The environment router matches path prefixes only.SEVERAL_PUBLIC_PORTS_NOT_SUPPORTED_YET: a service has more than one public port.EXPOSED_HELM_NOT_SUPPORTED_YET: a Helm service has a public port.PUBLIC_PORT_NOT_DEFAULT_NOT_SUPPORTED_YET: a service with a public HTTP or gRPC port has a private port marked as default. Make the public port the default one. A service with no default port is not blocked: the deploy marks its public port as default.
The NOT_SUPPORTED_YET values are no longer returned once support widens. More values may be added: treat an unknown value as a blocker.
BETA_FEATURE_NOT_ENABLED, ALREADY_MIGRATED, CLUSTER_WITHOUT_GATEWAY_API, CLUSTER_NOT_READY, ENVIRONMENT_STOPPED, DEPLOYMENT_IN_PROGRESS, PUBLIC_REGEX_HTTP_PATH, SEVERAL_PUBLIC_PORTS_NOT_SUPPORTED_YET, EXPOSED_HELM_NOT_SUPPORTED_YET, PUBLIC_PORT_NOT_DEFAULT_NOT_SUPPORTED_YET Was this page helpful?