Quickstart: allow passing DATABASE_STRING as parameter (#4580)
This commit is contained in:
committed by
GitHub
parent
6b6b546c5d
commit
6796e36c40
@@ -104,6 +104,13 @@ This is most helpful for first time run (db setup, db migrations etc).
|
|||||||
skyvern quickstart
|
skyvern quickstart
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you already have a database you want to use, pass a custom connection string to skip the
|
||||||
|
local Docker PostgreSQL setup:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
skyvern quickstart --database-string "postgresql+psycopg://user:password@localhost:5432/skyvern"
|
||||||
|
```
|
||||||
|
|
||||||
### 3. Run task
|
### 3. Run task
|
||||||
|
|
||||||
#### UI (Recommended)
|
#### UI (Recommended)
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ from .mcp import setup_local_organization, setup_mcp
|
|||||||
|
|
||||||
def init_env(
|
def init_env(
|
||||||
no_postgres: bool = typer.Option(False, "--no-postgres", help="Skip starting PostgreSQL container"),
|
no_postgres: bool = typer.Option(False, "--no-postgres", help="Skip starting PostgreSQL container"),
|
||||||
|
database_string: str = typer.Option(
|
||||||
|
"",
|
||||||
|
"--database-string",
|
||||||
|
help="Custom database connection string (e.g., postgresql+psycopg://user:password@host:port/dbname). When provided, skips Docker PostgreSQL setup.",
|
||||||
|
),
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Interactive initialization command for Skyvern."""
|
"""Interactive initialization command for Skyvern."""
|
||||||
console.print(
|
console.print(
|
||||||
@@ -40,7 +45,12 @@ def init_env(
|
|||||||
run_local = infra_choice == "local"
|
run_local = infra_choice == "local"
|
||||||
|
|
||||||
if run_local:
|
if run_local:
|
||||||
setup_postgresql(no_postgres)
|
if database_string:
|
||||||
|
console.print("🔗 [bold blue]Using custom database connection...[/bold blue]")
|
||||||
|
update_or_add_env_var("DATABASE_STRING", database_string)
|
||||||
|
console.print("✅ [green]Database connection string set in .env file.[/green]")
|
||||||
|
else:
|
||||||
|
setup_postgresql(no_postgres)
|
||||||
console.print("📊 [bold blue]Running database migrations...[/bold blue]")
|
console.print("📊 [bold blue]Running database migrations...[/bold blue]")
|
||||||
migrate_db()
|
migrate_db()
|
||||||
console.print("✅ [green]Database migration complete.[/green]")
|
console.print("✅ [green]Database migration complete.[/green]")
|
||||||
|
|||||||
@@ -33,25 +33,31 @@ def check_docker() -> bool:
|
|||||||
def quickstart(
|
def quickstart(
|
||||||
ctx: typer.Context,
|
ctx: typer.Context,
|
||||||
no_postgres: bool = typer.Option(False, "--no-postgres", help="Skip starting PostgreSQL container"),
|
no_postgres: bool = typer.Option(False, "--no-postgres", help="Skip starting PostgreSQL container"),
|
||||||
|
database_string: str = typer.Option(
|
||||||
|
"",
|
||||||
|
"--database-string",
|
||||||
|
help="Custom database connection string (e.g., postgresql+psycopg://user:password@host:port/dbname). When provided, skips Docker PostgreSQL setup.",
|
||||||
|
),
|
||||||
skip_browser_install: bool = typer.Option(
|
skip_browser_install: bool = typer.Option(
|
||||||
False, "--skip-browser-install", help="Skip Chromium browser installation"
|
False, "--skip-browser-install", help="Skip Chromium browser installation"
|
||||||
),
|
),
|
||||||
server_only: bool = typer.Option(False, "--server-only", help="Only start the server, not the UI"),
|
server_only: bool = typer.Option(False, "--server-only", help="Only start the server, not the UI"),
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Quickstart command to set up and run Skyvern with one command."""
|
"""Quickstart command to set up and run Skyvern with one command."""
|
||||||
# Check Docker
|
# Check Docker only if not using custom database
|
||||||
with console.status("Checking Docker installation...") as status:
|
if not database_string:
|
||||||
if not check_docker():
|
with console.status("Checking Docker installation...") as status:
|
||||||
console.print(
|
if not check_docker():
|
||||||
Panel(
|
console.print(
|
||||||
"[bold red]Docker is not installed or not running.[/bold red]\n"
|
Panel(
|
||||||
"Please install Docker and start it before running quickstart.\n"
|
"[bold red]Docker is not installed or not running.[/bold red]\n"
|
||||||
"Get Docker from: [link]https://www.docker.com/get-started[/link]",
|
"Please install Docker and start it before running quickstart.\n"
|
||||||
border_style="red",
|
"Get Docker from: [link]https://www.docker.com/get-started[/link]",
|
||||||
|
border_style="red",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
raise typer.Exit(1)
|
||||||
raise typer.Exit(1)
|
status.update("✅ Docker is installed and running")
|
||||||
status.update("✅ Docker is installed and running")
|
|
||||||
|
|
||||||
# Run initialization
|
# Run initialization
|
||||||
console.print(Panel("[bold green]🚀 Starting Skyvern Quickstart[/bold green]", border_style="green"))
|
console.print(Panel("[bold green]🚀 Starting Skyvern Quickstart[/bold green]", border_style="green"))
|
||||||
@@ -59,7 +65,7 @@ def quickstart(
|
|||||||
try:
|
try:
|
||||||
# Initialize Skyvern
|
# Initialize Skyvern
|
||||||
console.print("\n[bold blue]Initializing Skyvern...[/bold blue]")
|
console.print("\n[bold blue]Initializing Skyvern...[/bold blue]")
|
||||||
run_local = init_env(no_postgres=no_postgres)
|
run_local = init_env(no_postgres=no_postgres, database_string=database_string)
|
||||||
|
|
||||||
# Skip browser installation if requested
|
# Skip browser installation if requested
|
||||||
if not skip_browser_install:
|
if not skip_browser_install:
|
||||||
|
|||||||
Reference in New Issue
Block a user