Back to Zitadel

Download and adjust the example configuration file containing standard configuration

apps/docs/content/self-hosting/manage/configure/_linuxunix.mdx

5.0.0-base3.0 KB
Original Source

import ExampleZitadelConfig from './example-zitadel-config.yaml'; import ExampleZitadelSecrets from './example-zitadel-secrets.yaml'; import ExampleZitadelInitSteps from './example-zitadel-init-steps.yaml'; import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock';

Configure by Files

By executing the commands below, you will download the following files:

<details> <summary>example-zitadel-config.yaml</summary> <DynamicCodeBlock lang="yaml" code={ExampleZitadelConfig} /> </details> <details> <summary>example-zitadel-secrets.yaml</summary> <DynamicCodeBlock lang="yaml" code={ExampleZitadelSecrets} /> </details> <details> <summary>example-zitadel-init-steps.yaml</summary> <DynamicCodeBlock lang="yaml" code={ExampleZitadelInitSteps} /> </details>
bash
# Download and adjust the example configuration file containing standard configuration
wget https://raw.githubusercontent.com/zitadel/zitadel/main/apps/docs/content/self-hosting/manage/configure/example-zitadel-config.yaml

# Download and adjust the example configuration file containing secret configuration
wget https://raw.githubusercontent.com/zitadel/zitadel/main/apps/docs/content/self-hosting/manage/configure/example-zitadel-secrets.yaml

# Download and adjust the example configuration file containing database initialization configuration
wget https://raw.githubusercontent.com/zitadel/zitadel/main/apps/docs/content/self-hosting/manage/configure/example-zitadel-init-steps.yaml

# A single ZITADEL instance always needs the same 32 characters long masterkey
# If you haven't done so already, you can generate a new one
# The key must be passed as argument
ZITADEL_MASTERKEY="$(LC_ALL=C tr -dc '[:graph:]' </dev/urandom | head -c 32)"

# Pass zitadel configuration by configuration files
zitadel start-from-init \
    --config ./example-zitadel-config.yaml \
    --config ./example-zitadel-secrets.yaml \
    --steps ./example-zitadel-init-steps.yaml \
    --masterkey "${ZITADEL_MASTERKEY}"

Configure by Environment Variables

The environment variable approach uses a single DSN string instead of the individual field-based configuration shown above.

bash
# Set the PostgreSQL connection via a single DSN
# Use the "postgres" maintenance database so ZITADEL can create its own database during initialization
export ZITADEL_DATABASE_POSTGRES_DSN=postgresql://my_zitadel_db_user:[email protected]:5432/postgres?sslmode=disable
export ZITADEL_FIRSTINSTANCE_ORG_HUMAN_USERNAME="root"
export ZITADEL_FIRSTINSTANCE_ORG_HUMAN_PASSWORD="RootPassword1!"

# A single ZITADEL instance always needs the same 32 bytes long masterkey
# Generate one to a file if you haven't done so already and pass it as environment variable
LC_ALL=C tr -dc '[:graph:]' </dev/urandom | head -c 32 > ./zitadel-masterkey

# Let the zitadel binary read configuration from environment variables
zitadel start-from-init --masterkey "${ZITADEL_MASTERKEY}" --tlsMode disabled --masterkeyFile ./zitadel-masterkey