Skip to content

Commit e09cba4

Browse files
mythzclaude
andcommitted
docs(next-saas): cover the SQL Server and MySQL providers
Both follow the existing destination layout, so the provider table gains two columns rather than the guide gaining new machinery. Document the two constraints that make SQL Server different: it enforces a password policy that a hex password fails and needs roughly 2GB of memory, and it runs no initializer scripts, so its database and unprivileged login are created by the pre-deploy hook once the server accepts connections. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 3ee3e59 commit e09cba4

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

‎content/docs/next-saas/operations/choose-a-database.mdx‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,29 @@ Only the deployment layer differs between providers, and it is selected with a
1515
[Kamal destination](https://kamal-deploy.org): the `DB_PROVIDER` repository variable, which
1616
defaults to `sqlite`.
1717

18-
| Layer | `sqlite` | `postgres` |
19-
| --- | --- | --- |
20-
| Kamal overlay | `config/deploy.sqlite.yml` | `config/deploy.postgres.yml` |
21-
| Kamal secrets | `.kamal/secrets.sqlite` | `.kamal/secrets.postgres` |
22-
| Pre-deploy hook | none | `config/db/postgres/pre-deploy.sh` |
23-
| Accessory container | none | `<service>-postgres` |
24-
| Production JSON profile | `appsettings.deploy.sqlite.example.json` | `appsettings.deploy.postgres.example.json` |
18+
| Layer | `sqlite` | `postgres` | `mysql` | `sqlserver` |
19+
| --- | --- | --- | --- | --- |
20+
| Kamal overlay | `deploy.sqlite.yml` | `deploy.postgres.yml` | `deploy.mysql.yml` | `deploy.sqlserver.yml` |
21+
| Kamal secrets | `.kamal/secrets.sqlite` | `.kamal/secrets.postgres` | `.kamal/secrets.mysql` | `.kamal/secrets.sqlserver` |
22+
| Pre-deploy hook | none | `config/db/postgres/pre-deploy.sh` | `config/db/mysql/pre-deploy.sh` | `config/db/sqlserver/pre-deploy.sh` |
23+
| Accessory image | none | `postgres:18-alpine` | `mysql:8.4` | `mssql/server:2022-latest` |
24+
| Database and app login | n/a | `init.sh` initializer | image environment variables | `pre-deploy.sh` via `sqlcmd` |
25+
| Production JSON profile | `…sqlite…` | `…postgres…` | `…mysql…` | `…sqlserver…` |
26+
27+
Every server provider takes the same single `DB_PASSWORD` and connects as an unprivileged login
28+
that owns only its own database, never as the cluster administrator.
29+
30+
Two provider-specific constraints are worth knowing before choosing SQL Server:
31+
32+
- **It enforces a password policy** — at least eight characters drawn from three of uppercase,
33+
lowercase, digits, and symbols. A hex password satisfies only two categories and the container
34+
refuses to start, so `configure-deployment.sh` rejects it first. Generate one with
35+
`openssl rand -base64 48 | tr -dc 'A-Za-z0-9' | head -c 40`. It also needs roughly 2GB of memory,
36+
which rules out the smallest hosts.
37+
- **It runs no initializer scripts**, unlike the PostgreSQL and MySQL images. Its pre-deploy hook
38+
waits for the server to accept connections and then applies an idempotent `init.sql` through
39+
`sqlcmd`, and creates the data directory owned by uid 10001 because the image cannot write to a
40+
root-owned bind mount.
2541

2642
`config/deploy.yml` and `.kamal/secrets-common` hold everything shared by all providers. Kamal
2743
deep-merges the destination overlay over the base file and reads `.kamal/secrets-common` followed
@@ -96,7 +112,7 @@ create schema and do not copy rows between providers.
96112

97113
## Add another provider
98114

99-
Adding MySQL, SQL Server, or a managed database is additive:
115+
MySQL and SQL Server ship with the template. Adding a further RDBMS, or a managed database, is additive:
100116

101117
1. add its OrmLite and EF Core packages and a `Database:Provider` branch in `MyApp/Configure.Db.cs`;
102118
2. add `config/deploy.<provider>.yml` and `.kamal/secrets.<provider>`;

0 commit comments

Comments
 (0)