Application Binary Pattern Notes
This file keeps examples and rollout snippets. The normative rules live in contract.md.
Host Layout
Default application root:
/appdata/<appname>/
Example:
scp bin/myservice user@host:/appdata/myservice/myservice
scp docker-compose.yml user@host:/appdata/myservice/docker-compose.yml
ssh user@host "mkdir -p /appdata/myservice"
ssh user@host "cd /appdata/myservice && docker compose up -d"
Embedded Resources
Typical embedded assets:
- HTML templates
- static JS/CSS/icons
config.template.yaml- DB migrations
Config Template Example
# <appname> configuration
# Generated on first run. Edit as needed.
server:
port: 8080
database:
host: localhost
port: 5432
user: ""
password: ""
dbname: ""
First-Run Behavior
Start
-> config missing
-> create directory
-> write template
-> print config path
-> exit 0
Expected message:
Config created: ~/.config/<appname>/config.yaml
Edit the file and restart the application.
Build Examples
Without CGO:
CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/<appname> ./cmd/<appname>
With CGO where required:
CGO_ENABLED=1 go build -ldflags="-s -w" -o bin/<appname> ./cmd/<appname>