Last updated: April 2026

2.6 -- Folder Structure

Context

Before installing services, create a consistent folder hierarchy. This prevents the "files everywhere" effect that makes maintenance impossible. This convention is used throughout the playbook.

Step 1: Create the Folder Structure

$ mkdir -p ~/docker/vault
$ mkdir -p ~/docker/postgres
$ mkdir -p ~/scripts
$ mkdir -p ~/backups/postgres
$ mkdir -p ~/backups/vault
$ mkdir -p ~/logs

Resulting Folder Structure

~/
β”œβ”€β”€ docker/
β”‚   β”œβ”€β”€ vault/              # docker-compose.yml + Vault config
β”‚   β”‚   β”œβ”€β”€ docker-compose.yml
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── data/
β”‚   └── postgres/           # docker-compose.yml + PostgreSQL data
β”‚       β”œβ”€β”€ docker-compose.yml
β”‚       └── data/
β”œβ”€β”€ scripts/                # Custom scripts (health check, deploy, backup)
β”‚   β”œβ”€β”€ health-check.sh
β”‚   β”œβ”€β”€ deploy.sh
β”‚   └── backup-postgres.sh
β”œβ”€β”€ backups/                # Local backups
β”‚   β”œβ”€β”€ postgres/           # SQL dumps
β”‚   └── vault/              # Vault snapshots
β”œβ”€β”€ logs/                   # Application logs (outside journalctl)
└── .openclaw/              # Created automatically by OpenClaw (section 11)

Conventions

Rule Explanation
~/docker/<service>/ Each Docker service gets its own subfolder
docker-compose.yml at the subfolder root Run docker compose up -d from this folder
~/scripts/ for custom scripts All utility scripts go here, with chmod +x
~/backups/ for local backups Backup crons write here
No files at the root of ~ Keep your home directory clean

Step 2: Make Scripts Executable

The folder is empty for now, but get into the habit:

$ chmod +x ~/scripts/*.sh 2>/dev/null || true

Common Mistakes

  • Putting all docker-compose.yml files in the same place: Each service gets its own folder. Otherwise volumes will mix.
  • Creating folders as root: Create everything as deploy (your user). Otherwise Docker will hit permission issues.
  • Forgetting the backups folder: Backups are configured in the following sections. The folder must exist.

Verification

$ ls -la ~/docker/
$ ls -la ~/scripts/
$ ls -la ~/backups/

Expected results: the folders exist and belong to your user (not root).

Estimated Time

5 minutes.

Well done, you completed this section!
You covered: Context, Step 1: Create the Folder Structure, Resulting Folder Structure, Conventions and 4 more. Continue →

Commentaires et discussions


← Node.js and PM2 HashiCorp Vault →