Database clients
Functions of the tools module at v0.3.2. Each returns what a command runs in; import it with import * as tools from "tools".
psql
psql, pg_dump and the other PostgreSQL clients.
psql(
--image: Environment = #postgres:18.6-alpine3.24,
--host: String | Null = null,
--port: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--database: String | Null = null,
--sslmode: String | Null = null,
--network: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #postgres:18.6-alpine3.24 unless --image names another; use the major release of the server. lask sync pulls and pins whichever image is used (lask spec 10.3); a run never pulls.
Parameters
--imageThe image to run; another release is passed as image = #postgres:<tag>.--hostPGHOST.--portPGPORT.--userPGUSER.--password!!PGPASSWORD; masked in the command log.--databasePGDATABASE.--sslmodePGSSLMODE.--networkThe container's network: a Compose network, or "host".--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "psql" } on ... or $[...].
Image postgres:18.6-alpine3.24
lask eval psql --host host.docker.internal --user app --database appmysql
The MySQL client.
mysql(
--image: Environment = #mysql:8.4.11,
--host: String | Null = null,
--port: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--database: String | Null = null,
--network: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #mysql:8.4.11 (an LTS release) unless --image names another. The client reads the host, the port and the password from its environment (MYSQL_HOST, MYSQL_TCP_PORT, MYSQL_PWD), but no user and no database: those go on its command line. They are set as MYSQL_USER and MYSQL_DATABASE for that, mysql -u "$MYSQL_USER" "$MYSQL_DATABASE".
Parameters
--imageThe image to run; another release is passed as image = #mysql:<tag>.--hostMYSQL_HOST.--portMYSQL_TCP_PORT.--userMYSQL_USER, for the command line.--password!!MYSQL_PWD; masked in the command log.--databaseMYSQL_DATABASE, for the command line.--networkThe container's network: a Compose network, or "host".--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "mysql" } on ... or $[...].
Image mysql:8.4.11
lask eval mysql --host host.docker.internal --user appredis_cli
redis-cli.
redis_cli(
--image: Environment = #redis:8.10.2-alpine,
--password: String | Null = <secret>,
--network: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #redis:8.10.2-alpine unless --image names another. redis-cli reads its password from the environment (REDISCLI_AUTH) and nothing else: the host goes on its command line, redis-cli -h host.docker.internal.
Parameters
--imageThe image to run; another release is passed as image = #redis:<tag>.--password!!REDISCLI_AUTH; masked in the command log.--networkThe container's network: a Compose network, or "host".--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "redis-cli" } on ... or $[...].
Image redis:8.10.2-alpine
lask eval redis_climigrate
golang-migrate.
migrate(
--image: Environment = #migrate/migrate:v4.20.1,
--database_url: String | Null = <secret>,
--network: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #migrate/migrate:v4.20.1 unless --image names another. migrate takes its database on the command line only, so the URL is set as DATABASE_URL for it: migrate -database "$DATABASE_URL" -path db/migrations up. The URL carries the password, and is masked whole.
Parameters
--imageThe image to run; another release is passed as image = #migrate/migrate:<tag>.--database_url!!DATABASE_URL; masked in the command log.--networkThe container's network: a Compose network, or "host".--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "migrate" } on ... or $[...].
Image migrate/migrate:v4.20.1
lask eval migrate --database_url postgres://app:pw@host.docker.internal:5432/appflyway
Flyway.
flyway(
--image: Environment = #flyway/flyway:13.8.0-alpine,
--url: String | Null = null,
--user: String | Null = null,
--password: String | Null = <secret>,
--locations: String | Null = null,
--network: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #flyway/flyway:13.8.0-alpine unless --image names another. Flyway reads its connection from the environment, and sends no telemetry (REDGATE_DISABLE_TELEMETRY=true).
Parameters
--imageThe image to run; another release is passed as image = #flyway/flyway:<tag>.--urlFLYWAY_URL, a JDBC URL.--userFLYWAY_USER.--password!!FLYWAY_PASSWORD; masked in the command log.--locationsFLYWAY_LOCATIONS, e.g. "filesystem:db/migration".--networkThe container's network: a Compose network, or "host".--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "flyway" } on ... or $[...].
Image flyway/flyway:13.8.0-alpine
lask eval flyway --url jdbc:postgresql://host.docker.internal:5432/app --user app