---
title: "oz0 server init"
description: "Create a cluster once, before its first server starts."
canonical_url: "https://docs.oz0.ai/reference/cli/oz0/server/init"
---
# oz0 server init

> Create a cluster once, before its first server starts.

For: Operators and developers looking up a command.

Create a cluster once, before its first server starts. It creates the PostgreSQL databases and schemas, writes the master key, creates the cluster's CAs, the first tenant and the first operator, whose credentials go to --operator-dir.

## Usage

```bash
oz0 server init [flags]
```

## Flags

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --admin-password-file
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a file with the web UI admin's first password (at least 12 characters), instead of one made up and printed
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --advertise
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        127.0.0.1
      </code>
    </td>
    
    <td>
      server address to put in the operator's CLI context
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --ca-signer-command
      </code>
    </td>
    
    <td>
      command
    </td>
    
    <td>
      
    </td>
    
    <td>
      a command that signs with the cluster CA's key outside the server, such as in an HSM or a KMS: "COMMAND public-key" prints the key as PEM, "COMMAND sign sha256" signs the digest on stdin; the cluster CA is created with its key, and the database keeps no copy
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cluster-name
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        oz0
      </code>
    </td>
    
    <td>
      cluster name (lowercase letters, digits, dashes)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --data-dir
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        ~/.local/share/orchestrator-zero
      </code>
    </td>
    
    <td>
      server data directory
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --db-file
      </code>
    </td>
    
    <td>
      file
    </td>
    
    <td>
      
    </td>
    
    <td>
      a file (- for stdin) holding the PostgreSQL URL of the management database, such as postgres://oz0:PASSWORD@db:5432/oz0 (or set OZ0_DB); the URL can carry a password, so it never goes on the command line
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --exist-ok
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      when the database holds a cluster already, check that --master-key-file unseals it and exit without changing anything, so a job can run init before every install
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --history-shards
      </code>
    </td>
    
    <td>
      int
    </td>
    
    <td>
      <code>
        1024
      </code>
    </td>
    
    <td>
      Temporal history shards; can never change
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --master-key-command
      </code>
    </td>
    
    <td>
      command
    </td>
    
    <td>
      
    </td>
    
    <td>
      a command that unwraps the master key from --master-key-file when the file holds it wrapped, such as with an HSM or a KMS: "COMMAND unwrap" prints the key from the wrapped document on stdin, "COMMAND wrap" wraps one, "COMMAND describe" says what holds the wrapping key (see the docs on key commands) (or set OZ0_MASTER_KEY_COMMAND)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --master-key-file
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      use this master key, made beforehand and kept in a secret store such as a Kubernetes Secret, instead of writing a new one (32 random bytes in base64: head -c 32 /dev/urandom | base64)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --master-key-out
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        &lt;data-dir>/master.key
      </code>
    </td>
    
    <td>
      where to write the master key
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --operator
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        admin
      </code>
    </td>
    
    <td>
      first operator
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --operator-dir
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        &lt;config dir>/orchestrator-zero/&lt;cluster>
      </code>
    </td>
    
    <td>
      where to write the operator's credentials
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --release-channel
      </code>
    </td>
    
    <td>
      channel
    </td>
    
    <td>
      <code>
        the channel of the release in this server's dist folder, else stable
      </code>
    </td>
    
    <td>
      the release channel the cluster follows: stable, preview or lts-&lt;major>.&lt;minor>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --roles-apart
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      check what management apart from the edges needs of the database: CREATEROLE for its user, and pg_hba.conf letting the edges' role log in with a password from this host; fails with what to change
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --temporal-backend
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        embedded
      </code>
    </td>
    
    <td>
      the Temporal backend the servers will run against: embedded sets up Temporal's schemas in this PostgreSQL; external and cloud leave Temporal's database alone
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --tenant
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        default
      </code>
    </td>
    
    <td>
      first tenant; its Temporal namespace has the same name
    </td>
  </tr>
</tbody>
</table>

## Inherited flags

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --context
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        $OZ0_CONTEXT or &lt;config dir>/orchestrator-zero/context.json
      </code>
    </td>
    
    <td>
      CLI context file written by server init
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --log-level
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        info
      </code>
    </td>
    
    <td>
      log level: debug, info, warn or error
    </td>
  </tr>
</tbody>
</table>

See [all `oz0` commands](https://docs.oz0.ai/reference/cli/oz0) and the [global flags](https://docs.oz0.ai/reference/cli/oz0#global-flags).


## Sitemap

See the full [sitemap](https://docs.oz0.ai/sitemap.md) for all pages.
