BWEZE Docs

Services

Web services, private services, background workers and cron jobs - what each runs as, its commands, port, resources, and sleeping when idle.

A service is one thing a project runs from its repo. You pick its type when you create it, on the Configure step of Deploy.

Types

TypeWhat it isReached at
Web serviceAn HTTP server, public over HTTPShttps://<name>-<id>.bweze.app and your custom domains
Private serviceAn HTTP server only your workspace's other services can reach: an internal API, a cache fronthttp://app-<name>-<id> from those services
Background workerA process that runs all the time and listens on no port: a queue consumer, a botNowhere: it reaches out, nothing reaches in
Cron jobA command run on a schedule; nothing runs between runsNowhere

The type is fixed once the service exists. To change it, create a new service from the same repo.

Port

Web and private services listen on the port in PORT: 3000 unless you set another, 80 for a static site. Workers and cron jobs listen on none, and setting a port on one is refused (invalid_port).

bweze services set <serviceId> --port 8080

Commands

Start command

Replaces the image's own command (CMD), for example node dist/worker.js. A cron job's start command is what each run executes.

Pre-deploy command

Runs once on each new release before it goes live, for example npm run migrate. If it fails, the deploy fails and the release that was live stays live. It is stopped after 30 minutes, cannot be cancelled, and a rollback does not run it again.

Commands run as /bin/sh -c "<command>" after the image's ENTRYPOINT, with the service's environment variables, so the image needs a shell. Each is at most 4,096 characters. Change them under the service's Settings, or from the CLI or API; they apply from the next deploy.

bweze services set <serviceId> --start-command "node dist/server.js"
bweze services set <serviceId> --pre-deploy-command "npm run migrate"
curl -X PATCH https://api.bweze.com/v1/services/SERVICE_ID \
  -H "authorization: Bearer bw_sk_..." -H "content-type: application/json" \
  -d '{ "pre_deploy_command": "npm run migrate" }'

PATCH /v1/services/{id} takes port, start_command, pre_deploy_command, cron_schedule, cron_timeout_seconds and sleep_after_minutes (see Sleep when idle), and needs deployment:update.

Resources

Each service runs one instance with 0.5 CPU and 512 MiB of memory. It can use the full 0.5 CPU and is guaranteed a quarter of it. Memory is billed as configured while the service runs, CPU as used (see Pricing). Instance size and instance count cannot be changed yet, and there is no autoscaling.

Sleep when idle

A web service can sleep: after some minutes with no request it scales to zero, and the next request wakes it. Nothing runs while it sleeps, so it costs nothing (see Pricing).

PlanBy defaultYou can choose
FreeSleeps after 15 idle minutesA shorter window, 5 to 15 minutes. It cannot stay always on.
Hobby, Pro, EnterpriseAlways onTo sleep after 5 to 1,440 idle minutes
  • A request is anything sent to the service's *.bweze.app address or its custom domains, by anyone, bots and uptime monitors included.
  • Waking. The first request after a sleep waits while the service starts: a few seconds, plus your app's own start-up time. If that takes more than 30 seconds, a browser sees a short "Starting up" page that reloads itself, and other clients get 503 with Retry-After: 5.
  • Calls from your other services to http://app-<name>-<id> do not go through the edge: they neither keep a service awake nor wake it.
  • WebSockets and streamed responses count when they close, so a service that only holds long-lived connections should stay always on.
  • A deploy wakes a sleeping service, so the new release is checked as usual; it sleeps again after its window. Its pull request previews sleep like it.
  • Private services, workers and cron jobs never sleep.
  • The service's status is sleeping while it sleeps.

Choose the window from the API; null goes back to the plan's default. It applies at once, and GET /v1/services/{id} shows the window in force as sleeps_after_minutes (null: always on).

curl -X PATCH https://api.bweze.com/v1/services/SERVICE_ID \
  -H "authorization: Bearer bw_sk_..." -H "content-type: application/json" \
  -d '{ "sleep_after_minutes": 30 }'

Health and rollouts

BWEZE checks that a web or private service accepts connections on its port. A new release takes traffic only once it does, and the old one stops only after that, so deploys have no downtime. If an instance stops answering it is restarted.

Networking

See Networking for who can reach a service, what it can reach, and the firewall.

On this page