Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Usage

Quick examples

  • Start a Nextcloud instance with postgresql, and s3 primary storage:

    haze start pgsql s3
    
  • Start a Nextcloud instance with sqlite, php 8.3 and an smb external storage:

    haze start 8.3 smb
    
  • Run specific units test against an oracle database

    haze test oracle apps/dav/tests/unit/Connector/Sabre
    

Managing instances

Starting an instance

haze start [--name <name>] [--detach] [database] [php-version] [services] [vX.Y.Z]

Where database is one of sqlite, mysql, mariadb, pgsql or oracle with an optional version (e.g. pgsql:12), defaults to sqlite. And php-version is one of 8.0, 8.1, 8.2, 8.3, 8.4 or 8.5, defaults to the maximum version support by the current Nextcloud version.

You can specify a version number (e.g. v32.0.2) to use the sources from a release instead of using the local sources.

Use --name <name> to give the instance a specific name instead of a randomly generated one. For example:

Use --detach to give the instance its own sources instead of sharing sources_root with all other instances.

See the services documentation for a list of available services.

List running instances

haze

or

haze list

Stop an instance

haze [match] stop

Remove all unpinned running instances

haze clean

Pin an instance

haze [match] pin

Pinned instances will not be removed by haze clean.

Unpin an instance

haze [match] unpin

Run commands in a temporary instance

haze shell [database] [php-version] [services] [cmd]

This will create an instance, run the provided command, and cleanup the instance.

If no cmd is specified it will launch bash

Run tests in a new instance

haze test [database] [php-version] [services] [phpunit version] [path]

Where path is a file or folder to run PHPUnit in, relative to the sources root.

This will create a fresh instance, run the PHPUnit tests, and clean up the created instance.

Interacting with running instances

The following commands run against the most recently started instance by default and allow optionally providing a match to select a specific instance by its name.

Open an instance in the browser

haze [match] open

Execute a command on an instance

haze [match] [service] [cmd]

If no cmd is specified it will launch bash

If a service name or db is provided, the command will be in the container of the service or database.

If no cmd is specified it will launch bash

Execute an occ command on an instance

haze [match] occ [cmd]

Connect to the database on an instance

haze [match] db

Show the logs of an instance

haze [match] logs

Edit a file in an instance with the local $EDITOR

haze [match] edit <path>

Where <path> is the path of a file inside the container, for example config/config.php.

Reload the PHP configuration of an instance

haze [match] reload

The PHP configuration can edit changed with haze edit /config/php.ini

Run a command with instance environment variables set

haze [match] env <cmd> [args]

Runs the provided command with NEXTCLOUD_URL, DATABASE_URL and REDIS_URL environment variables set for the matched instance.

This is intended to run a local push daemon against an instance.

Git tools

Haze provides a couple of utilities to make working with many git repositories for apps easier.

Checkout a branch for all local apps

haze git checkout [branch]

Checks out the branch in all git repositories within the apps folder.

Defaults to the branch matching the current checked out server versions (e.g. master or stable33).

master and main can be used interchangeably.

Pull remote changes for all local apps

haze git pull

Performs a pull in all git repositories within the apps folder.

Update the container images

haze update

Instances with their own sources

By default every instance shares the sources configured as sources_root, so all instances always run the same code. An instance started with --detach gets its own git worktree of sources_root instead, created in worktree_dir, which lets you run several instances on different branches at the same time.

haze start --name my-fix --detach

The worktree is checked out with a detached head. Every app in one of the app_directories that gets enabled during setup receives its own worktree as well, other apps keep running from the shared app directory.

The worktrees are removed together with the instance, by haze stop or haze clean.