Database pack template
Connection details for PostgreSQL or MySQL, plus the command that opens a shell on it.
Adds #database to the browser demo. No account.
Keys
- host
- db.example.internal
- port
- 5432
- database
- app
- username
- app
- password:secret
- (encrypted secret, masked)
- psql_cmd:command
- psql -h db.example.internal -U app app
Example values. Rename, add or remove keys after you create the pack.
In a task
check slow queries on #database.host after the deploy @tomorrow
In the terminal
tsk env database
HOST=db.example.internal
PORT=5432
DATABASE=app
USERNAME=app
PASSWORD='********'
PSQL_CMD='psql -h db.example.internal -U app app'The real tsk decrypts secrets on your machine and prints them.
Connection details are the values you look up most and remember least. This template holds one database: where it is, who to log in as and the command you would type to get a prompt.
tsk get database.psql_cmd
tsk exec database -- ./scripts/backup.sh
tsk exec gives the command HOST, PORT, DATABASE, USERNAME and PASSWORD as environment variables, and nothing is written to disk. Rename the keys to pghost, pgport and so on if you want psql to pick them up on its own. The password is a secret field, encrypted on your device before it syncs.