MCPcopy Create free account
hub / github.com/dot-agent/nextpy / deploy

Function deploy

nextpy/backend/deploy/hosting.py:394–507  ·  view source on GitHub ↗

Send a POST request to Control Plane to launch a new deployment. Args: frontend_file_name: The frontend file name. backend_file_name: The backend file name. export_dir: The directory where the frontend/backend zip files are exported. key: The deployment name.

(
    frontend_file_name: str,
    backend_file_name: str,
    export_dir: str,
    key: str,
    app_name: str,
    regions: list[str],
    app_prefix: str,
    vm_type: str | None = None,
    cpus: int | None = None,
    memory_mb: int | None = None,
    auto_start: bool | None = None,
    auto_stop: bool | None = None,
    frontend_hostname: str | None = None,
    envs: dict[str, str] | None = None,
    with_tracing: str | None = None,
    with_metrics: str | None = None,
)

Source from the content-addressed store, hash-verified

392
393
394def deploy(
395 frontend_file_name: str,
396 backend_file_name: str,
397 export_dir: str,
398 key: str,
399 app_name: str,
400 regions: list[str],
401 app_prefix: str,
402 vm_type: str | None = None,
403 cpus: int | None = None,
404 memory_mb: int | None = None,
405 auto_start: bool | None = None,
406 auto_stop: bool | None = None,
407 frontend_hostname: str | None = None,
408 envs: dict[str, str] | None = None,
409 with_tracing: str | None = None,
410 with_metrics: str | None = None,
411) -> DeploymentPostResponse:
412 """Send a POST request to Control Plane to launch a new deployment.
413
414 Args:
415 frontend_file_name: The frontend file name.
416 backend_file_name: The backend file name.
417 export_dir: The directory where the frontend/backend zip files are exported.
418 key: The deployment name.
419 app_name: The app name.
420 regions: The list of regions to deploy to.
421 app_prefix: The app prefix.
422 vm_type: The VM type.
423 cpus: The number of CPUs.
424 memory_mb: The memory in MB.
425 auto_start: Whether to auto start.
426 auto_stop: Whether to auto stop.
427 frontend_hostname: The frontend hostname to deploy to. This is used to deploy at hostname not in the regular domain.
428 envs: The environment variables.
429 with_tracing: A string indicating the command line prefix for tracing.
430 with_metrics: A string indicating the metrics endpoint.
431
432 Raises:
433 AssertionError: If the request is rejected by the hosting server.
434 Exception: If the operation fails. The exception message is the reason.
435
436 Returns:
437 The response containing the URL of the site to be deployed if successful, None otherwise.
438 """
439 # Check if the user is authenticated
440 if not (token := requires_access_token()):
441 raise Exception("not authenticated")
442
443 try:
444 params = DeploymentsPostParam(
445 key=key,
446 app_name=app_name,
447 regions_json=json.dumps(regions),
448 app_prefix=app_prefix,
449 cpus=cpus,
450 memory_mb=memory_mb,
451 auto_start=auto_start,

Callers

nothing calls this directly

Calls 8

requires_access_tokenFunction · 0.85
authorization_headerFunction · 0.85
joinMethod · 0.80
jsonMethod · 0.80
postMethod · 0.45
dictMethod · 0.45

Tested by

no test coverage detected