Compare commits

...

2 Commits

Author SHA1 Message Date
simon
2d6db88f4c add apps 2024-10-29 12:54:53 -07:00
simon
c4e14d3670 hosting v1 2024-10-25 18:41:04 -07:00

View File

@ -481,12 +481,6 @@ def makemigrations(
@cli.command() @cli.command()
def deploy( def deploy(
key: Optional[str] = typer.Option(
None,
"-k",
"--deployment-key",
help="The name of the deployment. Domain name safe characters only.",
),
app_name: str = typer.Option( app_name: str = typer.Option(
config.app_name, config.app_name,
"--app-name", "--app-name",
@ -497,32 +491,21 @@ def deploy(
list(), list(),
"-r", "-r",
"--region", "--region",
help="The regions to deploy to.", help="The regions to deploy to. For multiple envs, repeat this option, e.g. --region sjc --region iad",
), ),
envs: List[str] = typer.Option( envs: List[str] = typer.Option(
list(), list(),
"--env", "--env",
help="The environment variables to set: <key>=<value>. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.", help="The environment variables to set: <key>=<value>. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.",
), ),
cpus: Optional[int] = typer.Option( vmtype: Optional[str] = typer.Option(
None, help="The number of CPUs to allocate.", hidden=True
),
memory_mb: Optional[int] = typer.Option(
None, help="The amount of memory to allocate.", hidden=True
),
auto_start: Optional[bool] = typer.Option(
None, None,
help="Whether to auto start the instance.", "--vmtype",
hidden=True, help="Vm type id. Run reflex apps vmtypes list to get options.",
), ),
auto_stop: Optional[bool] = typer.Option( hostname: Optional[str] = typer.Option(
None, None,
help="Whether to auto stop the instance.", "--hostname",
hidden=True,
),
frontend_hostname: Optional[str] = typer.Option(
None,
"--frontend-hostname",
help="The hostname of the frontend.", help="The hostname of the frontend.",
hidden=True, hidden=True,
), ),
@ -530,24 +513,21 @@ def deploy(
True, True,
help="Whether to list configuration options and ask for confirmation.", help="Whether to list configuration options and ask for confirmation.",
), ),
with_metrics: Optional[str] = typer.Option( envfile: Optional[str] = typer.Option(
None, None,
help="Setting for metrics scraping for the deployment. Setup required in user code.", "--envfile",
hidden=True, help="The path to an env file to use. Will override any envs set manually.",
),
with_tracing: Optional[str] = typer.Option(
None,
help="Setting to export tracing for the deployment. Setup required in user code.",
hidden=True,
),
upload_db_file: bool = typer.Option(
False,
help="Whether to include local sqlite db files when uploading to hosting service.",
hidden=True, hidden=True,
), ),
loglevel: constants.LogLevel = typer.Option( loglevel: constants.LogLevel = typer.Option(
config.loglevel, help="The log level to use." config.loglevel, help="The log level to use."
), ),
token: Optional[str] = typer.Option(
None,
"--token",
help="token to use for auth",
hidden=True,
),
): ):
"""Deploy the app to the Reflex hosting service.""" """Deploy the app to the Reflex hosting service."""
from reflex_cli import cli as hosting_cli from reflex_cli import cli as hosting_cli
@ -569,12 +549,7 @@ def deploy(
hosting_cli.deploy( hosting_cli.deploy(
app_name=app_name, app_name=app_name,
export_fn=lambda zip_dest_dir, export_fn=lambda zip_dest_dir, api_url, deploy_url, frontend, backend, zipping: export_utils.export(
api_url,
deploy_url,
frontend,
backend,
zipping: export_utils.export(
zip_dest_dir=zip_dest_dir, zip_dest_dir=zip_dest_dir,
api_url=api_url, api_url=api_url,
deploy_url=deploy_url, deploy_url=deploy_url,
@ -582,20 +557,15 @@ def deploy(
backend=backend, backend=backend,
zipping=zipping, zipping=zipping,
loglevel=loglevel.subprocess_level(), loglevel=loglevel.subprocess_level(),
upload_db_file=upload_db_file,
), ),
key=key,
regions=regions, regions=regions,
envs=envs, envs=envs,
cpus=cpus, vmtype=vmtype,
memory_mb=memory_mb, envfile=envfile,
auto_start=auto_start, hostname=hostname,
auto_stop=auto_stop,
frontend_hostname=frontend_hostname,
interactive=interactive, interactive=interactive,
with_metrics=with_metrics,
with_tracing=with_tracing,
loglevel=loglevel.subprocess_level(), loglevel=loglevel.subprocess_level(),
token=token,
) )
@ -603,7 +573,7 @@ cli.add_typer(db_cli, name="db", help="Subcommands for managing the database sch
cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.") cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.")
cli.add_typer( cli.add_typer(
deployments_cli, deployments_cli,
name="deployments", name="apps",
help="Subcommands for managing the Deployments.", help="Subcommands for managing the Deployments.",
) )
cli.add_typer( cli.add_typer(