English
Get started
← All templates

Deploy Nextcloud on Pethost in one click

File sync, calendar and contacts on a server of your own

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: 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 as admin with the password you gave.

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:
  app:
    image: nextcloud:34-apache
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    environment: &nextcloud_env
      POSTGRES_HOST: db
      POSTGRES_DB: nextcloud
      POSTGRES_USER: nextcloud
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      REDIS_HOST: redis
      # The first start installs Nextcloud with this admin, so no setup page is left open.
      NEXTCLOUD_ADMIN_USER: admin
      NEXTCLOUD_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      NEXTCLOUD_TRUSTED_DOMAINS: ${HOST}
      OVERWRITEPROTOCOL: https
      OVERWRITEHOST: ${HOST}
      OVERWRITECLIURL: ${URL}
      # The machine's proxy reaches the container from this range.
      TRUSTED_PROXIES: 10.192.0.0/10
    volumes:
      - nextcloud:/var/www/html

  # Runs Nextcloud's background jobs every five minutes.
  cron:
    image: nextcloud:34-apache
    restart: unless-stopped
    entrypoint: /cron.sh
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    environment: *nextcloud_env
    volumes:
      - nextcloud:/var/www/html

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

  redis:
    image: redis:8-alpine
    restart: unless-stopped
    volumes:
      - redis:/data
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"]
      interval: 5s
      timeout: 3s
      retries: 12

volumes:
  nextcloud:
  db:
  redis: