---
title: "Deploy Coder on Pethost in one click"
description: "Remote development environments from Terraform templates, opened in VS Code, JetBrains, a browser or over SSH. A template for Pethost: in a minute or two the app is live on your machine, with HTTPS at its own address and nightly backups."
---

[← All templates](https://pethost.dev/templates/)

# Deploy Coder on Pethost in one click

Remote development environments from Terraform templates, opened in VS Code, JetBrains, a browser or over SSH

[Deploy on Pethost](https://console.pethost.dev/?template=coder)

## What happens

1. You sign in to Pethost or make an account, with a passkey, GitHub or Google.
2. No machine yet? You pick a plan, and we prepare one for you. The link waits in your browser until it is ready.
3. New project opens at the app. You fill in what it asks for and click Create project: **Email**, **Admin password**.
4. In a minute or two the app is live at its own address with HTTPS. Its secrets are made for it at random, and its data is in the nightly backup.
5. It is a project like any other: its compose.yaml, its .env, its logs and a terminal are in the panel, and your agent can change it, roll it back or restore it.

## First steps

Sign in with the email and the admin password you gave: the template makes that owner at the first start. A workspace comes from a template: pick one that provisions it on a cloud you have an account with or on Kubernetes; the Docker one needs a Docker socket the project does not have.

## What it runs

The template is this compose.yaml and the variables it writes into the project’s .env. Pethost runs the file as it is written.

```
services:
  coder:
    image: ghcr.io/coder/coder:v2.37.4
    restart: unless-stopped
    environment:
      CODER_PG_CONNECTION_URL: postgresql://coder:${POSTGRES_PASSWORD}@database/coder?sslmode=disable
      CODER_HTTP_ADDRESS: 0.0.0.0:7080
      CODER_ACCESS_URL: ${URL}
      CODER_TELEMETRY_ENABLE: "false"
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    # A new Coder lets its first visitor create the owner account. So, before it answers on its
    # own port, it is started on one nobody reaches and the email and password asked become the
    # owner, the first time only.
    entrypoint: ["/bin/sh", "-c"]
    command:
      - |
        CODER_HTTP_ADDRESS=127.0.0.1:3001 /opt/coder server &
        setup=$$!
        tries=0
        until wget -q -O /dev/null http://127.0.0.1:3001/healthz; do
          tries=$$((tries + 1))
          [ $$tries -lt 300 ] || exit 1
          sleep 1
        done
        if ! wget -q -O /dev/null http://127.0.0.1:3001/api/v2/users/first; then
          /opt/coder login http://127.0.0.1:3001 \
            --first-user-username admin --first-user-full-name Admin \
            --first-user-email "$$ADMIN_EMAIL" --first-user-password "$$ADMIN_PASSWORD" \
            --first-user-trial=false || exit 1
        fi
        kill $$setup
        wait $$setup
        exec /opt/coder server
    depends_on:
      database:
        condition: service_healthy

  database:
    image: postgres:17-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: coder
      POSTGRES_USER: coder
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - db:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U coder -d coder"]
      interval: 5s
      timeout: 5s
      retries: 10
      start_period: 30s

volumes:
  db:
```

[compose.yaml](https://pethost.dev/templates/coder/compose.yaml)[See it on GitHub](https://github.com/pethost-dev/templates/tree/main/coder)

Pethost · Stephan Gomer · NIP 1133096755

[Templates](https://pethost.dev/templates/) [About](https://pethost.dev/about/) [Blog](https://pethost.dev/blog/) [Terms](https://pethost.dev/terms/) [Privacy](https://pethost.dev/privacy/) [Refunds](https://pethost.dev/refunds/) [API](https://pethost.dev/docs/api/) [CLI](https://pethost.dev/docs/cli/) [Plugin](https://github.com/pethost-dev/plugin) [support@pethost.dev](mailto:support@pethost.dev)
