---
name: dewacloud-deploy
description: Deploy a project to Dewacloud (Dewaweb's managed PaaS in Jakarta, pay per use, git deploys, free HTTPS) using the dewacloud MCP tools - pick the stack and cloudlets, show the IDR cost range and get approval, create the environment, deploy from git or an archive, set env vars, add a custom domain, and hand back a working URL. Load whenever the user wants to deploy, host, launch or put online a web app, website or API without managing a server, mentions Dewacloud, or asks what PaaS hosting would cost.
---

# Deploy to Dewacloud

The dewacloud MCP server exposes `dewacloud_*` tools. Prices are IDR per hour. Reserved cloudlets
bill every hour; dynamic cloudlets bill only what the app actually uses. Cost is always shown and
approved before an environment is created.

Dewacloud is the right fit for a web app or API on one standard runtime with its code in git, with
or without a managed database next to it. A multi-service `compose.yaml`, root access, or custom
daemons fit DewaVPS better; if the dewavps tools are also connected, say so in one line.

## 1. Read the project first

- **Runtime and version**, **port**, **build** and **start** commands.
- **Services**: Postgres, MySQL, Redis.
- **Env vars** it reads (`.env.example`, config). Never upload a real `.env` without asking.
- **Where the code lives:** a git remote (GitHub/GitLab URL). Local-only code needs to be pushed
  first, or packed and hosted as a downloadable archive.
- **Domain:** whether the user has one.

## 2. Choose stack and size

Call `dewacloud_catalog` for regions (`edgedc` = cloudjkt01, `spacedc` = cloudjkt02), stacks and
balance.

| Project | `node_type` |
|---|---|
| Node.js | `nodejs` |
| Python | `pythonengine` or `apache-python` |
| Go | `golang` |
| PHP / Laravel | `lemp` or `nginxphp-dockerized` |
| Anything with a Dockerfile already published | `docker_image` instead of `node_type` |
| Database | `postgresql`, `mysql` (`node_group` `sqldb`), `redis` (`nosqldb`) |

1 cloudlet = 128 MiB RAM + 400 MHz CPU. Start an app node at `reserved_cloudlets` 1-2 and
`dynamic_cloudlet_limit` 8; a database at 4-8 reserved and 16 dynamic. Get the range from
`dewacloud_estimate_cost`.

## 3. Get approval, then create

1. `dewacloud_create_env` **without** `confirm`. Show the topology and the monthly cost range,
   wait for an explicit yes, then call again with `confirm: true`.
2. **Do not add a public IP** for a web app. Without one, only 80/443 through the shared load
   balancer are reachable, which is the secure default. The one exception is a custom domain
   over HTTPS, below, which needs one and asks first.
3. `dewacloud_set_env_vars` for configuration and database credentials.

## 4. Deploy

- `dewacloud_deploy` with `source: "git"`, the repo URL and branch (`git_token` for private
  repos), or `source: "archive"` with a downloadable zip URL.
- Docker-image layers use `dewacloud_redeploy_image` with a new tag.
- The app is live at `https://<env_name>.user.cloudjkt01.com` with a valid certificate.
- Custom domain over HTTPS needs a public IPv4 on the node (about Rp50.000 a month), because
  Dewacloud's Let's Encrypt add-on validates against that IP. Call `dewacloud_add_domain`
  without `confirm`, show the IP cost, and only confirm after the user agrees. It returns the
  `A` record to create (DNS only, not proxied). Once the domain resolves to that IP, call it
  again with `confirm: true`; it reports `active` only when the certificate is actually served.
- Redeploying from git verifies the branch: a missing branch is refused, and switching branches
  redeploys the context. Check `branch` and `commit` in the result.
- Debug with `dewacloud_logs` (list, then read a path) and `dewacloud_exec`.

## 5. Verify and hand back

- `curl -sI https://<url>` returns the app.
- Report: URL, region, monthly cost range, how to redeploy, how to read logs, how to remove it.

## Safety rules

- Only act on environments the user named or that were created in this conversation. List first.
- `dewacloud_delete_env` needs the environment name typed or confirmed by the user. No undo.
- Adding a balancer layer or a public IP to a live environment moves traffic immediately. Do it
  only when the user asks, and say so first.
- A stopped environment still bills disk and public IPs. To stop paying, delete it.
- Never repeat a create, deploy or delete because it errored or timed out. Check
  `dewacloud_get_env` first; it may already have applied.
- Errors carry a `result` code and `method`; fix the argument rather than guessing.
