Workspaces
A Polycrate workspace bundles configuration, inventory, encrypted secrets, blocks, and artifacts: layout, initialization, fix-permissions, and hybrid repos.
A workspace is the working directory where Polycrate brings together configuration, credentials, blocks, workflows, and generated artifacts. Technically, a workspace is a regular folder that can be versioned with Git and shared across team members.
Directory Structure
graph TB
WS[acme-production-1/] --> Config[workspace.poly]
WS --> Inv[inventory.yml]
WS --> Secrets[secrets.poly.age]
WS --> DF[Dockerfile.poly]
WS --> CL[CHANGELOG.poly]
WS --> Blocks[blocks/]
WS --> Arts[artifacts/]
Blocks --> B1[my-block/]
B1 --> BP1[block.poly]
B1 --> CL1[CHANGELOG.poly]
B1 --> EX1[examples.poly]
B1 --> IN1[install.yml]
Arts --> SecretsDir[secrets/]
Arts --> BlockArts[blocks/]
SecretsDir --> IdRsa[id_rsa.age]
SecretsDir --> WSKube[kubeconfig.yml.age]
Files in the Workspace Root
| File / Folder | Required | Sensitive | Description |
|---|---|---|---|
workspace.poly |
Yes | No | Central workspace configuration |
inventory.yml |
No | No | Central Ansible inventory (YAML) |
secrets.poly |
No | Yes | Unencrypted block secrets (never commit) |
secrets.poly.age |
No | No | age-encrypted secrets.poly (safe for Git) |
.workspace-encrypted |
No | No | Marker indicating enabled workspace encryption |
Dockerfile.poly |
No | No | Optional custom image based on the Polycrate container |
CHANGELOG.poly |
No | No | Workspace version history |
blocks/ |
No | No | Local template blocks and blocks pulled from registries |
artifacts/ |
No | Partial | Persistent outputs (artifacts/blocks/) and secrets (artifacts/secrets/) |
Sensitive Files under artifacts/secrets/
| Path | Description |
|---|---|
artifacts/secrets/id_rsa |
Workspace SSH private key |
artifacts/secrets/id_rsa.pub |
Workspace SSH public key |
artifacts/secrets/kubeconfig.yml |
Central Kubernetes configuration of the workspace |
artifacts/secrets/<block>/ |
Block-specific secret files |
Initializing and Managing a Workspace
Creating a New Workspace
mkdir -p "$HOME/.polycrate/workspaces/acme/acme-production-1"
cd "$HOME/.polycrate/workspaces/acme/acme-production-1"
# Standard initialization (creates workspace.poly + SSH keys in artifacts/secrets/)
polycrate workspace init --with-name acme-production-1 --with-organization acme
Shorthand: polycrate init --with-name acme-production-1 --with-organization acme. For environments connected to platform management, polycrate workspace create is also available.
Listing and Inspecting Local Workspaces
# List all local workspaces under ~/.polycrate/workspaces/
polycrate workspace list --local
# Filter by name
polycrate workspace list --local --filter production --no-pager
# Inspect the current workspace
polycrate workspace inspect
Fixing File Permissions (fix-permissions)
Actions run inside the container as root. On normal exit, Polycrate automatically restores ownership of all workspace files back to the host user. If files remain owned by root after an abrupt termination (e.g., SIGKILL or OOM kill), repair them without sudo:
# Preview affected files first
polycrate workspace fix-permissions --dry-run
# Fix permissions across the entire workspace
polycrate workspace fix-permissions
# Optionally limit to a subpath
polycrate workspace fix-permissions --path artifacts/secrets
Organization and Naming Conventions
Store workspaces under $HOME/.polycrate/workspaces/<organization>/<name>:
$HOME/.polycrate/workspaces/
└── acme/
├── acme-production-1/
├── acme-staging-1/
└── acme-dev-1/
Both name and organization in workspace.poly must follow the slug rule ^[a-z][a-z0-9-]*$ (lowercase letters, digits, and single hyphens only, starting with a lowercase letter). Recommended scheme: <org>-<purpose>-<count> (e.g., acme-production-1).
Hybrid Workspaces (Code + Infrastructure)
When a Git repository contains both application code and a Polycrate workspace, keep the build context and infrastructure files cleanly separated:
- Enable the pre-commit hook: Protects against accidentally committing unencrypted secrets:
polycrate workspace hook install
polycrate workspace hook status
- Maintain
.gitignore: Exclude unencrypted secrets while keeping.agefiles and.workspace-encrypted:
# Polycrate – exclude unencrypted secrets
secrets.poly
artifacts/secrets/*
!artifacts/secrets/*/
!artifacts/secrets/*.age
artifacts/secrets/*/*
!artifacts/secrets/*/*.age
!.workspace-encrypted
- Maintain
.dockerignorefor app builds: Exclude all workspace files (workspace.poly,secrets.poly*,inventory.yml,blocks/,artifacts/,Dockerfile.poly,.specs/) from your application's Docker build context so that infrastructure configuration or keys never leak into an application image.
See Also
- Configuration — All fields of
workspace.poly - Blocks — Block structure and versioning
- Artifacts — Persistent files under
artifacts/ - Workspace Encryption —
ageencryption and Git hook - Git Integration — Native Git commands