services & provision
Slasha can provision and manage containerised data services (PostgreSQL, MySQL, MongoDB, Redis) attached to your app. Each service runs in its own Docker container on the same host.
slasha provision
Provision a new service and attach it to an app. The server fetches the default environment variables for the chosen service kind automatically, so you don't need to supply credentials manually.
slasha provision --app my-api --kind postgresql --name db --version 16
slasha provision --app my-api --kind redis --name cache --version 7
slasha provision --app my-api --kind mysql --name mysql --version 8
slasha provision --app my-api --kind mongodb --name mongo --version 7--app <SLUG>— target app slug (optional ifslasha.tomlis present)--kind <KIND>— service type:postgresql,mysql,mongodb,redis--name <NAME>— a name for this service instance (used to reference it in other commands)--version <VERSION>— Docker image tag to use (e.g.16,8.0)
After provisioning the CLI suggests the commands to stream logs and open a local connection:
slasha services --app my-api logs db --follow
slasha services --app my-api proxy dbslasha services list
List services attached to an app. Output columns: ID, NAME, KIND, VERSION, STATUS.
slasha services --app my-api listslasha services logs
Stream container logs for a service. Accepts the service name or ID.
slasha services --app my-api logs db
slasha services --app my-api logs db --follow--follow— keep the stream open
slasha services restart
Restart a service container without reprovisioning it.
slasha services --app my-api restart dbslasha services redeploy
Stop, remove, and reprovision the service container from scratch. Existing data volumes are preserved and re-attached to the new container.
slasha services --app my-api redeploy dbslasha services stop
Stop a running service container. Prompts for confirmation unless -y is passed.
slasha services --app my-api stop db
slasha services --app my-api stop db -yslasha services delete
Delete a stopped or failed service and its associated volumes. This is irreversible. Prompts for confirmation unless -y is passed.
slasha services --app my-api delete db
slasha services --app my-api delete db -yslasha services backup
Stream a data dump from the service to stdout or write it to a file. The dump format depends on the service kind (e.g. pg_dump for PostgreSQL, mysqldump for MySQL).
# stream to stdout (pipe to a file or another tool)
slasha services --app my-api backup db > backup.sql
# write directly to a file
slasha services --app my-api backup db --file backup.sql-f/--file <FILE>— write dump to a file instead of stdout
slasha services proxy
Open a local TCP tunnel to a remote service over HTTPS/WebSocket. The CLI binds a random (or specified) local port and prints the full connection string so you can connect with your local database client immediately.
# bind to a random local port
slasha services --app my-api proxy db
# bind to a specific port
slasha services --app my-api proxy db --port 5432
# hide the password in the printed connection string
slasha services --app my-api proxy db --no-secret-p/--port <PORT>— local port to bind (defaults to a random available port)--no-secret— mask passwords in the printed connection string
Press Ctrl-C to close the tunnel. Each client connection opens an independent WebSocket tunnel to the server.
slasha services env
Manage environment variables for a service container (separate from app-level env vars).
slasha services --app my-api env db list
slasha services --app my-api env db set POSTGRES_MAX_CONNECTIONS=200
slasha services --app my-api env db unset SOME_KEY