Last updated: April 2026
What you will learn
▼
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 →
Proposer une modification sur GitHub