---
title: Orchitect - Set Up a Kingdom
description: Learn how to set up a Kindgom within Orchitect
image: https://orchitect.io/hubfs/orc-2.png
---

[![orchitect logo](https://orchitect.io/hs-fs/hubfs/orchitect_logo_dark-1.png?width=300&height=131&name=orchitect_logo_dark-1.png "orchitect logo")](https://orchitect.io?hsLang=en)

[Login](https://the.orchitect.io/orc/login)

# Setting up a Kingdom

 

This is the 'hub' of your deployment. The Kingdom should be publicly available via the internet so clients and agents can connect.

An example docker-compose.yaml is provided for deployment. In this example, you'll see several environment variables, all of these are necessary and must be kept secret

**SERVICE\_TOKEN** - Fiefs need to match this token to communicate with the Kingdom. 

**TOKEN\_SECRET** - Used for user authentication. When a user authenticates, they authenticate with the Kingdom, not the web portal. This is to ensure you, and only you, retain ownership over all user data and secrets

**DB\_ENCRYPTION\_KEY** - This is used for encrypting sensitive information within the Kingdom's internal database.

 Note that Kingdoms do not share data outside your ecosystem. Orchitect has no knowledge or access to your Kingdom

 docker-compose.yaml

 Caddyfile

> services:  
>   kingdom:  
>     container\_name: kingdom  
>     image: orchitect/kingdom-agent:latest
> 
>     environment:  
>       SERVICE\_TOKEN: 'token'  
>       TOKEN\_SECRET: 'token\_secret'  
>       DB\_ENCRYPTION\_KEY: 'db\_encryption\_key'  
>     volumes:  
>       - kingdom\_data:/var/lib/postgresql/data  
>     expose:  
>       - 9876
> 
>   caddy:  
>     container\_name: caddy  
>     image: caddy:latest  
>     restart: unless-stopped  
>     depends\_on:  
>       - kingdom  
>     ports:  
>       - "9876:9876"  
>     volumes:  
>       - ./Caddyfile:/etc/caddy/Caddyfile  
>       - caddy\_data:/data  
>       - caddy\_config:/config  
>     networks:  
>       - app\_network  
> networks:  
>   app\_network:  
>     driver: bridge
> 
> volumes:  
>   caddy\_data:  
>   caddy\_config:  
>   kingdom\_data:

 

> https://example.com:9876 {  
>     reverse\_proxy kingdom:9876  
> }

 

 

When you start your Kingdom, a username and password will be generated randomly and printed in the output log, use this to log into your Kingdom for the first time and create a new account. 

 

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Running Migrations  
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
> Database is available.  
> Creating default account.  
> \===========================  
> Default account details  
> Username: xXxXXxXxxX  
> Password: XXxXxXXxxXXXxxXxxX  
> ===========================

[![Orc Logo](https://orchitect.io/hs-fs/hubfs/orc-2.png?width=150&height=150&name=orc-2.png "Orc Logo")](https://orchitect.io/?hsLang=en)

© 2026. All rights reserved.