# Self-host SQLPad

> Web based SQL editor for running queries against many databases, with saved queries, charts and sharing. The admin account is created from the install form.

- Page: https://levelrail.com/templates/sqlpad/
- JSON: https://levelrail.com/templates/sqlpad.json
- Category: Database Tools
- Licence: MIT (Permissive license)
- Source: https://github.com/sqlpad/sqlpad
- Upstream docs: https://getsqlpad.com/

## Requirements
- Memory: about 256 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: 7.5.7

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| sqlpad | sqlpad/sqlpad | 7.5.7 | 3000 | data -> /var/lib/sqlpad |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| sqlpad | SQLPAD_ADMIN | preset |
| sqlpad | SQLPAD_ADMIN_PASSWORD | generated |
| sqlpad | SQLPAD_APP_LOG_LEVEL | preset |
| sqlpad | SQLPAD_DB_PATH | preset |

## Deploy

### CLI

```bash
levelrail-cli templates install sqlpad --name my-sqlpad
```

Add --domain SERVICE=HOST to serve a service on your own domain, for example --domain sqlpad=app.example.com.

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://levelrail.example.com/api/v1/service-templates/sqlpad/install \
  -d '{
    "name": "my-sqlpad"
  }'
```

Create a token in the dashboard first. Name, env and domains are the request fields.

## First run
1. Sign in with the admin email and the generated password shown in the deployment variables, then add a connection to your database.

## Questions

### Can I deploy SQLPad on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for SQLPad, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image sqlpad/sqlpad:7.5.7 is what you deploy there.

Self-host SQLPad, SQLPad docker compose file, deploy SQLPad on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
