Plumber Manual ⚔

see cheatsexternal link

General #

Emergency #

Formatting & extra information #

System information #

Processes #

Files, devices and filesystems #

  • Statistics: df, duf (pretty df), iotop, iostat
  • File
  • FS: tune2fs, dumpe2fs, /proc/filesystems
  • Block device: blkid, findmnt, blockdev (good for getting various sizes), /sys/block/sda/queue/scheduler
  • Disk: fdisk, smartctl

Memory #

/proc/meminfo
/proc/buddyinfo
/proc/[pid]/smaps
/proc/[pid]/statm
/proc/[pid]/status
  • Statistics: free, vmstat, slabtop
  • Inspection: pmap, vmtouch

Network & Security #

Opinionated development practices #

SQL/Databases #

  • Table names
    • Should be singular. i.e user instead of users. This also helps with foreign key names(user_id), junction table names (eg. actor_film for actor and film tables) etc.
    • But main deal is keeping it consistent, whatever we end up picking. Singular/Plural
    • Sometimes may conflict with the database engine keywords, so consider using prefix
  • Booleans columns
  • Query building
  • Migrations
    • While dropping tables, drop the ones with fk first when writing migrations
    • If developing in golang, if using a migration tool(eg. goose) and sqlc, sqlc’s schema.sql will have duplicate table create statement. It’s fine and OK to have this duplication.
  • NULL
    • If you have a column set to NOT NULL, you probably also want to set a CHECK (column_name <> '') to it aswell, not always but most times.
  • Primary Keys
    • Natural keys / Surrogate keys if applicable
    • For identifier column name, if it has to be id, i’d prefer id over <table_name>_id, just cleaner.
    • If not using serial keys, use timestamp ordered random ids instead of plain UUID (eg. ULID/UUIDv7)
  • Upserts
    • TODO

Data Interchange #

  • Don’t think too much and just do the manual conversion of timestamp to protobuf’s format from postgresexternal link when needed.
  • If developing using golang and using sqlc and protobuf, we’d have two different generated structs of the same entity. They might look similar but they’re for different purposes, we want to keep this separated. One is for database and another one is for interchange.