---
title: "Deploy Spree Commerce on Pethost in one click"
description: "An open-source e-commerce platform: products, orders, payments and a headless API for any storefront. 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 Spree Commerce on Pethost in one click

An open-source e-commerce platform: products, orders, payments and a headless API for any storefront

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

## 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 to https://spree.sam.pethost.app/admin with the email and the admin password you gave: Spree makes that admin at the first start. Products, payment methods and shipping are set up there.

## 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:
  spree:
    image: ghcr.io/spree/spree:5.6.1
    restart: unless-stopped
    environment:
      DATABASE_URL: postgres://spree:${POSTGRES_PASSWORD}@postgres:5432/spree_production
      SECRET_KEY_BASE: ${SECRET_KEY_BASE}
      ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY: ${ENCRYPTION_PRIMARY_KEY}
      ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY: ${ENCRYPTION_DETERMINISTIC_KEY}
      ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT: ${ENCRYPTION_KEY_DERIVATION_SALT}
      SPREE_HOST: ${HOST}
      RAILS_HOST: ${HOST}
      # The seed makes the first admin from these instead of a stock account.
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    volumes:
      - storage:/rails/storage
    depends_on:
      postgres:
        condition: service_healthy

  postgres:
    image: postgres:18-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: spree
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: spree_production
    volumes:
      - db:/var/lib/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U spree -d spree_production"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  storage:
  db:
```

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

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)
