You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The page claimed a generated spec ships; only the attribute sources do.
Adds the credentials the fixtures seed as the first go-live step.
Signed-off-by: arhimede <julian@dotkernel.com>
Copy file name to clipboardExpand all lines: docs/book/v7/reference/production-readiness.md
+67-10Lines changed: 67 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,10 @@
2
2
3
3
## Summary
4
4
5
-
Dotkernel API ships a complete application: a PSR-15 middleware pipeline, OAuth2 authentication, RBAC, input filtering, problem-details error responses and a generated OpenAPI specification.
5
+
Dotkernel API ships a complete application: a PSR-15 middleware pipeline, OAuth2 authentication, RBAC, input filtering, problem-details error responses and the OpenAPI attribute sources you [generate the specification from](../openapi/generate-documentation.md).
6
6
What it does not ship is the operational layer a public API needs around it — rate limiting, API gateway integration, federated identity, log shipping and error tracking, health checks, metrics and response caching.
7
7
This page names each gap, says whether it belongs in the application or in the platform in front of it, and gives the concrete thing to configure until Dotkernel provides one.
8
+
It also covers the one thing that does ship and has to go before launch: the demo credentials the Doctrine fixtures seed.
8
9
9
10
## Details
10
11
@@ -21,6 +22,7 @@ Everything on this page was checked against the [dotkernel/api](https://github.c
21
22
22
23
| Concern | Ships with the API | Where it belongs | Tracked upstream |
23
24
| --- | --- | --- | --- |
25
+
| Default demo credentials | Yes — seeded by the Doctrine fixtures | Removed before launch | — |
24
26
| Rate limiting and throttling | No | Proxy, gateway, or a PSR-15 middleware |[#529](https://github.com/dotkernel/api/issues/529)|
25
27
| API gateway integration | No | Platform | — |
26
28
| External OAuth2 / OIDC provider | No — the API is its own authorization server | Application | — |
@@ -32,6 +34,32 @@ Everything on this page was checked against the [dotkernel/api](https://github.c
32
34
| Background jobs and async work | No — mail is sent in-request | Separate service | — |
| Scheduled dependency re-audit | No — Composer audits at resolution time, not on a schedule | Server |[#525](https://github.com/dotkernel/api/issues/525)|
37
+
| OpenAPI specification file | No — attribute sources only, generated on demand | Build step | — |
38
+
39
+
## Default credentials
40
+
41
+
Every other entry on this page is something missing.
42
+
This one is something present: the Doctrine fixtures seed four sets of credentials, and all four are published in the repository.
43
+
44
+
| Seeded by | Identity | Secret |
45
+
| --- | --- | --- |
46
+
|`AdminLoader`|`admin`|`dotadmin`|
47
+
|`UserLoader`|`test@dotkernel.com`|`dotkernel`|
48
+
|`OAuthClientLoader`|`admin`|`admin`|
49
+
|`OAuthClientLoader`|`frontend`|`frontend`|
50
+
51
+
The password grant needs both halves, a client and an account, and the fixtures supply a matching pair of each.
52
+
Running `php ./bin/doctrine fixtures:execute` against a production database therefore leaves `/security/generate-token` answering to the `admin` client with secret `admin` and the `admin` account with password `dotadmin`, which between them reach every administrator endpoint in the API.
53
+
54
+
Change them before you seed, by editing the loaders in `src/Core/src/App/src/Fixture/`:
55
+
56
+
-`AdminLoader.php` and `UserLoader.php` — `setIdentity()` for the identity, `usePassword()` for the password, and optionally `setFirstName()` and `setLastName()`.
57
+
-`OAuthClientLoader.php` — `setName()` and `setSecret()`.
58
+
59
+
If a database has already been seeded, treat all four as public.
60
+
Create a replacement administrator with `php ./bin/cli.php admin:create`, then remove the `admin` and `test@dotkernel.com` accounts and re-secret both OAuth clients.
61
+
62
+
[Basic Security](../security/basic-security.md) covers the demo accounts and [OAuth2 Security](../security/oauth2-security.md) the clients.
35
63
36
64
## Rate limiting
37
65
@@ -243,19 +271,43 @@ Until there is, either accept in-request sending or dispatch to a worker you wir
243
271
A server installed once and left alone has never been re-examined against advisories published since, so run `composer audit` there on a schedule rather than only at install time.
244
272
Issue #525 proposes pinning the policy explicitly in `composer.json` rather than inheriting the defaults.
245
273
274
+
## OpenAPI specification
275
+
276
+
The attributes ship; the specification file does not.
277
+
Every path, schema and security scheme is declared across four files — `src/App/src/OpenAPI.php`, `src/Admin/src/OpenAPI.php`, `src/Security/src/OpenAPI.php` and `src/User/src/OpenAPI.php` — and `public/` contains no `openapi.yaml` or `openapi.json`.
278
+
Producing one is a step you add to your own build or deploy:
`zircote/swagger-php` is a `require` rather than a `require-dev` dependency, so `vendor/bin/openapi` is present on a production install as well.
285
+
286
+
Two things to get right.
287
+
288
+
**The server URL defaults to localhost.**
289
+
`src/App/src/OpenAPI.php` declares `#[OA\Server(url: 'http://api.dotkernel.localhost')]`, so a specification generated without editing that line tells every client to call your development host.
290
+
291
+
**The file is a snapshot.**
292
+
No Composer script wraps the command and nothing regenerates the file when the attributes change, so a specification generated once drifts from the API it describes.
293
+
Regenerate it in the same step that deploys the code.
294
+
295
+
See [Generate documentation](../openapi/generate-documentation.md) for the version and format options, and [Render documentation](../openapi/render-documentation.md) for serving the result.
296
+
246
297
## A minimum before you go live
247
298
248
299
Ordered by what bites first:
249
300
250
-
1. Rate-limit `/security/generate-token` and `/error-report` at the proxy.
251
-
2. Disable the OAuth2 grants you do not use, starting with the implicit grant.
252
-
3. Point `dot-errorhandler` at a logger that reaches somebody — Sentry, or at least a shipped `stderr` stream.
253
-
4. Add `logrotate` for `log/`, or repoint the writer at standard output.
254
-
5. Add a readiness endpoint that checks the database, and point your load balancer at it rather than `/`.
255
-
6. Fix `X-Forwarded-For` handling at the proxy, since the application trusts the header as sent.
256
-
7. Set a default `Cache-Control` for the whole API instead of leaving it unset.
257
-
8. Schedule `composer audit` on each server — the install that generated its lock was audited, but nothing re-checks that lock afterwards.
258
-
9. Work through [Basic Security](../security/basic-security.md) and [OAuth2 Security](../security/oauth2-security.md), which cover the application-level hardening this page does not repeat.
301
+
1. Change every seeded credential — both demo accounts and both OAuth clients — or delete them once a real administrator exists.
302
+
2. Rate-limit `/security/generate-token` and `/error-report` at the proxy.
303
+
3. Disable the OAuth2 grants you do not use, starting with the implicit grant.
304
+
4. Point `dot-errorhandler` at a logger that reaches somebody — Sentry, or at least a shipped `stderr` stream.
305
+
5. Add `logrotate` for `log/`, or repoint the writer at standard output.
306
+
6. Add a readiness endpoint that checks the database, and point your load balancer at it rather than `/`.
307
+
7. Fix `X-Forwarded-For` handling at the proxy, since the application trusts the header as sent.
308
+
8. Set a default `Cache-Control` for the whole API instead of leaving it unset.
309
+
9. Schedule `composer audit` on each server — the install that generated its lock was audited, but nothing re-checks that lock afterwards.
310
+
10. Work through [Basic Security](../security/basic-security.md) and [OAuth2 Security](../security/oauth2-security.md), which cover the application-level hardening this page does not repeat.
259
311
260
312
## FAQ
261
313
@@ -265,6 +317,11 @@ A: No.
265
317
The application is complete and tested; what is missing is the operational layer around it, most of which is conventionally the platform's job.
266
318
The gap is documentation, not code — nothing tells you which half you still have to build.
267
319
320
+
**Q: What are the default credentials, and where do I change them?**
321
+
322
+
A: `admin` / `dotadmin` and `test@dotkernel.com` / `dotkernel` for the accounts, and OAuth clients `admin` / `admin` and `frontend` / `frontend`.
323
+
All four come from the fixture loaders in `src/Core/src/App/src/Fixture/`, so edit those before running `php ./bin/doctrine fixtures:execute`, or replace the records afterwards.
324
+
268
325
**Q: Which of these should I solve in the application rather than the platform?**
269
326
270
327
A: External identity provider integration, error tracking, the health endpoint, caching headers and asynchronous mail.
0 commit comments