Skip to main content

gws up

Deploy services to a Kubernetes cluster.

Usageโ€‹

gws up [options]

Output:

๐Ÿš€ Deploying GetWebstack...

โœ“ Validating dependencies...
โœ“ Docker: 24.0.0
โœ“ Git: 2.40.0
โœ“ mkcert: 1.4.4

โœ“ Creating k3d cluster 'myapp'... (15s)
โœ“ Generating TLS certificates...
โœ“ Created: *.local.getwebstack.dev

โœ“ Building Docker images...
โœ“ api: localhost:5000/myapp-api:latest (25s)
โœ“ app: localhost:5000/myapp-app:latest (30s)

โœ“ Deploying to namespace 'myapp'...
โœ“ Created namespace
โœ“ Deployed 2 services
โœ“ Pods running (2/2)

โœ“ Configuring Gateway API...
โœ“ Created HTTPRoutes
โœ“ Port-forward active (8080, 9443)

โœ“ Starting file sync...
โœ“ api: active (0.5s latency)
โœ“ app: active (0.6s latency)

โœ“ Activating auto-rebuild watchers...
โœ“ Watching Dockerfiles

Deployment successful! ๐ŸŽ‰

Services available at:
๐Ÿ”— API: https://api.myapp.local.getwebstack.dev
๐Ÿ”— App: https://app.myapp.local.getwebstack.dev

File sync active:
๐Ÿ“ File sync: โœ“ (0.5s latency)
๐Ÿ”„ Auto-rebuild: โœ“ (Dockerfile changes)

Next steps:
- Edit code locally (changes sync automatically)
- View status: gws status
- View logs: gws logs
- Stop: gws down

Note: This command must be run from within your project directory.


Optionsโ€‹

OptionDescriptionDefault
-w, --worktree <name>Worktree name to deployMain project deployment
-p, --project <name>Project name to deploy fromAuto-detected from current directory
-y, --yesSkip confirmation promptsfalse

Examples:


# Deploy from a specific project, a specific worktree
gws up -p myapp -w feature-auth

# Deploy specific worktree for current directory project.
gws up -w feature-auth

# Deploy from a specific project. Deploys the main project, not a worktree.
gws up -p myapp

# Skip prompts
gws up -y

# deploy project from current dorectory
gws up

Multirepo Behaviorโ€‹

When running gws up in a multirepo setup, the command deploys all services from each repository to a single Kubernetes namespace.

Project Structureโ€‹

myapp/                          # Parent directory
โ”œโ”€โ”€ .worktrees/ # Shared worktrees folder (at parent level)
โ”‚ โ””โ”€โ”€ feature-auth/ # One folder per worktree name
โ”‚ โ”œโ”€โ”€ api/ # Worktree for api repo
โ”‚ โ”‚ โ””โ”€โ”€ src/
โ”‚ โ””โ”€โ”€ app/ # Worktree for app repo
โ”‚ โ””โ”€โ”€ src/
โ”œโ”€โ”€ api/ # Git repo 1
โ”‚ โ”œโ”€โ”€ .git/
โ”‚ โ””โ”€โ”€ src/
โ””โ”€โ”€ app/ # Git repo 2
โ”œโ”€โ”€ .git/
โ””โ”€โ”€ src/

Deploying Main Workspaceโ€‹

cd myapp
gws up

What happens:

  1. Detects all repositories in myapp/ (api, app)
  2. Builds Docker image for each service
  3. Deploys all services to namespace myapp
  4. Sets up routing for all services

Result:

Services available at:
๐Ÿ”— API: https://api.myapp.local.getwebstack.dev
๐Ÿ”— App: https://app.myapp.local.getwebstack.dev

Deploying Worktreeโ€‹

cd myapp
gws up -w feature-auth

What happens:

  1. Detects all repositories in myapp/
  2. Finds worktree feature-auth under .worktrees/
  3. Builds Docker images from worktree directories
  4. Deploys all services to namespace myapp-feature-auth
  5. Sets up routing for all services

Result:

Services available at (same hostnames as the default deployment;
the `gws-namespace` cookie selects this fork):
๐Ÿ”— API: https://api.myapp.local.getwebstack.dev
๐Ÿ”— App: https://app.myapp.local.getwebstack.dev
๐Ÿ”— Picker: https://myapp.local.getwebstack.dev (choose deployment)

Key Points:

  • All services from different repos deploy to the same namespace
  • Each worktree gets its own isolated namespace
  • File sync is active for all services in the deployment

Troubleshootingโ€‹

Docker Not Runningโ€‹

# Start Docker Desktop (macOS/Windows)
open -a Docker

# Or start Docker daemon (Linux)
sudo systemctl start docker

# Verify
docker ps

# Try again
gws up

Port Already in Useโ€‹

# Find process using port
sudo lsof -ti:8080

# Kill process
sudo lsof -ti:8080 | xargs kill -9

# Try again
gws up

Build Failedโ€‹

# Ensure Dockerfile exists
ls api/Dockerfile

# Check pod logs
gws logs api

DNS Not Resolvingโ€‹

# Test DNS
nslookup api.myapp.local.getwebstack.dev
# Should return: 127.0.0.1

# Flush DNS cache:
# macOS: sudo dscacheutil -flushcache
# Linux: sudo systemd-resolve --flush-caches
# Windows: ipconfig /flushdns

See Alsoโ€‹